def get_limited_to(headers):
 policy_dict = dict()
 policy_dict['roles'] = headers.get('X-Roles', '').split(',')
 policy_dict['user_id'] = headers.get('X-User-Id')
 policy_dict['project_id'] = headers.get('X-Project-Id')
 rule_name = ('segregation' if _has_rule('segregation') else 'context_is_admin')
 if (not pecan.request.enforcer.enforce(rule_name, {}, policy_dict)):
  return (headers.get('X-User-Id'), headers.get('X-Project-Id'))
 return (None, None)

def get_limited_to ( headers ) : policy_dict = dict ( ) policy_dict [ 'roles' ] = headers . get ( 'X-Roles' , '' ) . split ( ',' ) policy_dict [ 'user_id' ] = headers . get ( 'X-User-Id' ) policy_dict [ 'project_id' ] = headers . get ( 'X-Project-Id' ) rule_name = ( 'segregation' if _has_rule ( 'segregation' ) else 'context_is_admin' ) if ( not pecan . request . enforcer . enforce ( rule_name , { } , policy_dict ) ) : return ( headers . get ( 'X-User-Id' ) , headers . get ( 'X-Project-Id' ) ) return ( None , None )
return the user and project the request should be limited to .