Part of lp.services.webapp.authorization View In Hierarchy
Function decorator that ensures the user has the given permission on a context object. The context object is one of the function arguments and is specified by nominating the argument name. If no keyword arguments are present, then the first non-keyword argument is used. Use it like: @available_with_permission('launchpad.Edit', 'context_arg') def some_function(self, context_arg, another_arg): # do something And the calling code would be: obj.some_function(context, another) or obj.some_function(context_arg=context, another_arg=another)
Method | __init__ | Make a new available_with_permission function decorator. |
Method | __call__ | Undocumented |