def authorize_project_context(context, project_id):
 if is_user_context(context):
  if (not context.project_id):
   raise exception.Forbidden()
  elif (context.project_id != project_id):
   raise exception.Forbidden()

def authorize_project_context ( context , project_id ) : if is_user_context ( context ) : if ( not context . project_id ) : raise exception . Forbidden ( ) elif ( context . project_id != project_id ) : raise exception . Forbidden ( )
ensures a request has permission to access the given project .