Created
June 24, 2016 20:53
-
-
Save devintyler/4a433dc76899ec8bbc73b0f63f1a0a34 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import syncano | |
from syncano.models import User | |
from syncano.models import Object | |
syncano.connect(api_key='ACCOUNT_KEY', instance_name=META['instance']) | |
def add_username_to_user(user): | |
print user.id | |
user_profile = Object.please.list( | |
class_name='user_profile' | |
).filter(owner__eq=user.id).first() | |
print user_profile | |
Object.please.update( | |
id=user_profile.id, | |
class_name='user_profile', | |
other_permissions='read', | |
username=user.username | |
) | |
users = User.please.list() | |
for user in users: | |
print "Adding username and read permissions for user {user}".format(user=user.username) | |
add_username_to_user(user) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment