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

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