(api_name, act=None)
return wrapper
This is a decorator to simplify wsgi action policy rule check.

        :param api_name: The collection name to be evaluate.
        :param act: The function name of wsgi action.

       example:
           from magnum.common import policy
           class ClustersController(rest.RestController):
               ....
               @policy.enforce_wsgi("cluster", "delete")
               @wsme_pecan.wsexpose(None, types.uuid_or_name, status_code=204)
               def delete(self, cluster_ident):
                   ...
This is a decorator to simplify wsgi action policy rule check.
This is a decorator to simplify wsgi action policy rule check .
def enforce_wsgi(api_name, act=None):
    """This is a decorator to simplify wsgi action policy rule check.

        :param api_name: The collection name to be evaluate.
        :param act: The function name of wsgi action.

       example:
           from magnum.common import policy
           class ClustersController(rest.RestController):
               ....
               @policy.enforce_wsgi("cluster", "delete")
               @wsme_pecan.wsexpose(None, types.uuid_or_name, status_code=204)
               def delete(self, cluster_ident):
                   ...
    """
    @decorator.decorator
    def wrapper(fn, *args, **kwargs):
        action = "%s:%s" % (api_name, (act or fn.__name__))
        enforce(pecan.request.context, action,
                exc=exception.PolicyNotAuthorized, action=action)
        return fn(*args, **kwargs)
    return wrapper
def enforce_wsgi ( api_name , act = None ) : @ decorator . decorator def wrapper ( fn , * args , * * kwargs ) : action = "%s:%s" % ( api_name , ( act or fn . __name__ ) ) enforce ( pecan . request . context , action , exc = exception . PolicyNotAuthorized , action = action ) return fn ( * args , * * kwargs ) return wrapper