def user_generate_apikey(context, data_dict):
 model = context['model']
 user = context['user']
 session = context['session']
 schema = (context.get('schema') or schema_.default_generate_apikey_user_schema())
 context['schema'] = schema
 id = _get_or_bust(data_dict, 'id')
 user_obj = model.User.get(id)
 context['user_obj'] = user_obj
 if (user_obj is None):
  raise NotFound('User was not found.')
 _check_access('user_generate_apikey', context, data_dict)
 old_data = _get_action('user_show')(context, data_dict)
 old_data['apikey'] = model.types.make_uuid()
 data_dict = old_data
 return _get_action('user_update')(context, data_dict)

def user_generate_apikey ( context , data_dict ) : model = context [ 'model' ] user = context [ 'user' ] session = context [ 'session' ] schema = ( context . get ( 'schema' ) or schema_ . default_generate_apikey_user_schema ( ) ) context [ 'schema' ] = schema id = _get_or_bust ( data_dict , 'id' ) user_obj = model . User . get ( id ) context [ 'user_obj' ] = user_obj if ( user_obj is None ) : raise NotFound ( 'User was not found.' ) _check_access ( 'user_generate_apikey' , context , data_dict ) old_data = _get_action ( 'user_show' ) ( context , data_dict ) old_data [ 'apikey' ] = model . types . make_uuid ( ) data_dict = old_data return _get_action ( 'user_update' ) ( context , data_dict )
cycle a users api key .