@staticmethod<EOL><INDENT>def requires_permission(permission_s, logical_operator=all):<DEDENT>
def outer_wrap(fn):<EOL><INDENT>@functools.wraps(fn)<EOL>def inner_wrap(*args, **kwargs):<EOL><INDENT>subject = WebYosai.get_current_subject()<EOL>try:<EOL><INDENT>subject.check_permission(permission_s, logical_operator)<EOL><DEDENT>except ValueError:<EOL><INDENT>msg = ("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>")<EOL>raise WebYosai.get_current_webregistry().raise_unauthorized(msg)<EOL><DEDENT>except AuthorizationException:<EOL><INDENT>msg = "<STR_LIT>"<EOL>raise WebYosai.get_current_webregistry().raise_forbidden(msg)<EOL><DEDENT>return fn(*args, **kwargs)<EOL><DEDENT>return inner_wrap<EOL><DEDENT>return outer_wrap<EOL>
Requires that the calling Subject be authorized to the extent that is
required to satisfy the permission_s specified and the logical operation
upon them.

:param permission_s:   the permission(s) required
:type permission_s:  a List of Strings or List of Permission instances

:param logical_operator:  indicates whether all or at least one permission
                          is true (and, any)
:type: and OR all (from python standard library)

Elaborate Example:
    requires_permission(
        permission_s=['domain1:action1,action2', 'domain2:action1'],
        logical_operator=any)

Basic Example:
    requires_permission(['domain1:action1,action2'])