Created
June 24, 2016 20:35
-
-
Save devintyler/d80ed9b785e758fdbead8ed333d47fe4 to your computer and use it in GitHub Desktop.
Script used to update the user profile with the username upon user creation
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']) | |
user_id = ARGS['owner'] | |
user_profile_id = ARGS['id'] | |
user = User.please.get( | |
id=user_id | |
) | |
print "Adding username and read permissions for user {user}".format(user=user.username) | |
Object.please.update( | |
id=user_profile_id, | |
class_name='user_profile', | |
other_permissions='read', | |
username=user.username #optional - for this to work, user_profile must have a `username` of type String column | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment