@manager.command()
@argument('email')
@option('--org', 'organization', default='default', help="the organization the user belongs to, (leave blank for 'default').")
def grant_admin(email, organization='default'):
 try:
  org = models.Organization.get_by_slug(organization)
  admin_group = org.admin_group
  user = models.User.get_by_email_and_org(email, org)
  if (admin_group.id in user.group_ids):
   print 'User is already an admin.'
  else:
   user.group_ids = (user.group_ids + [org.admin_group.id])
   models.db.session.add(user)
   models.db.session.commit()
   print 'User updated.'
 except NoResultFound:
  print ('User [%s] not found.' % email)

@ manager . command ( ) @ argument ( 'email' ) @ option ( '--org' , 'organization' , default = 'default' , help = "the organization the user belongs to, (leave blank for 'default')." ) def grant_admin ( email , organization = 'default' ) : try : org = models . Organization . get_by_slug ( organization ) admin_group = org . admin_group user = models . User . get_by_email_and_org ( email , org ) if ( admin_group . id in user . group_ids ) : print 'User is already an admin.' else : user . group_ids = ( user . group_ids + [ org . admin_group . id ] ) models . db . session . add ( user ) models . db . session . commit ( ) print 'User updated.' except NoResultFound : print ( 'User [%s] not found.' % email )
grant admin access to user email .