def add_admin_for_app(user, app, secret):
 global db
 global user_schema
 global app_schema
 global super_secret
 if (secret != super_secret):
  return 'Error: bad secret'
 try:
  user_result = db.get_entity(USER_TABLE, user, user_schema)
 except AppScaleDBConnectionError as db_error:
  return 'Error: {}'.format(db_error)
 if ((user_result[0] not in ERROR_CODES) or (len(user_result) <= 1)):
  return user_result
 user_result = user_result[1:]
 n_user = Users('a', 'b', 'c')
 n_user.unpackit(user_result)
 n_user.applications_.append(app)
 t = datetime.datetime.now()
 n_user.date_change_ = str(time.mktime(t.timetuple()))
 array = n_user.arrayit()
 result = db.put_entity(USER_TABLE, user, user_schema, array)
 if (result[0] in ERROR_CODES):
  return 'true'
 else:
  return 'Error: Unable to update the user.'

def add_admin_for_app ( user , app , secret ) : global db global user_schema global app_schema global super_secret if ( secret != super_secret ) : return 'Error: bad secret' try : user_result = db . get_entity ( USER_TABLE , user , user_schema ) except AppScaleDBConnectionError as db_error : return 'Error: {}' . format ( db_error ) if ( ( user_result [ 0 ] not in ERROR_CODES ) or ( len ( user_result ) <= 1 ) ) : return user_result user_result = user_result [ 1 : ] n_user = Users ( 'a' , 'b' , 'c' ) n_user . unpackit ( user_result ) n_user . applications_ . append ( app ) t = datetime . datetime . now ( ) n_user . date_change_ = str ( time . mktime ( t . timetuple ( ) ) ) array = n_user . arrayit ( ) result = db . put_entity ( USER_TABLE , user , user_schema , array ) if ( result [ 0 ] in ERROR_CODES ) : return 'true' else : return 'Error: Unable to update the user.'
grants admin role to a given application .