Skip to content

Instantly share code, notes, and snippets.

@devintyler
Created June 24, 2016 20:35
Show Gist options
  • Save devintyler/d80ed9b785e758fdbead8ed333d47fe4 to your computer and use it in GitHub Desktop.
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
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