def placement_authorize(context, action, target=None):
 placement_init()
 if (target is None):
  target = {'project_id': context.tenant, 'user_id': context.user}
 credentials = context.to_policy_values()
 result = _ENFORCER_PLACEMENT.enforce(action, target, credentials, do_raise=False, exc=None, action=action)
 if (result is False):
  LOG.debug('Policy check for %(action)s failed with credentials %(credentials)s', {'action': action, 'credentials': credentials})
 return result

def placement_authorize ( context , action , target = None ) : placement_init ( ) if ( target is None ) : target = { 'project_id' : context . tenant , 'user_id' : context . user } credentials = context . to_policy_values ( ) result = _ENFORCER_PLACEMENT . enforce ( action , target , credentials , do_raise = False , exc = None , action = action ) if ( result is False ) : LOG . debug ( 'Policy check for %(action)s failed with credentials %(credentials)s' , { 'action' : action , 'credentials' : credentials } ) return result
verifies that the action is valid on the target in this context .