(perms, satisfy=DEFAULT_SATISFY, login_url=None,
                         raise_exception=False)
return user_passes_test(check_perms, login_url=login_url)
Check for the permissions given based on the strategy chosen.

    :param iterable perms:
    :param string satisfy: Allowed values are "all" and "any".
    :param string login_url:
    :param bool raise_exception: If set to True, the ``PermissionDenied``
        exception is raised on failures.
    :return bool:

    :example:
    >>> @login_required
    >>> @permissions_required(satisfy='any', perms=[
    >>>     'dash.add_dashboardentry',
    >>>     'dash.change_dashboardentry',
    >>>     'dash.delete_dashboardentry',
    >>>     'dash.add_dashboardworkspace',
    >>>     'dash.change_dashboardworkspace',
    >>>     'dash.delete_dashboardworkspace',
    >>>     'dash.add_dashboardsettings',
    >>>     'dash.change_dashboardsettings',
    >>>     'dash.delete_dashboardsettings',
    >>> ])
    >>> def edit_dashboard(request):
    >>>     # your code
Check for the permissions given based on the strategy chosen.
Check for the permissions given based on the strategy chosen .
def permissions_required(perms, satisfy=DEFAULT_SATISFY, login_url=None,
                         raise_exception=False):
    """Check for the permissions given based on the strategy chosen.

    :param iterable perms:
    :param string satisfy: Allowed values are "all" and "any".
    :param string login_url:
    :param bool raise_exception: If set to True, the ``PermissionDenied``
        exception is raised on failures.
    :return bool:

    :example:
    >>> @login_required
    >>> @permissions_required(satisfy='any', perms=[
    >>>     'dash.add_dashboardentry',
    >>>     'dash.change_dashboardentry',
    >>>     'dash.delete_dashboardentry',
    >>>     'dash.add_dashboardworkspace',
    >>>     'dash.change_dashboardworkspace',
    >>>     'dash.delete_dashboardworkspace',
    >>>     'dash.add_dashboardsettings',
    >>>     'dash.change_dashboardsettings',
    >>>     'dash.delete_dashboardsettings',
    >>> ])
    >>> def edit_dashboard(request):
    >>>     # your code
    """
    assert satisfy in (SATISFY_ANY, SATISFY_ALL)

    if SATISFY_ALL == satisfy:
        # ``SATISFY_ALL`` case
        def check_perms(user):
            # First check if the user has the permission (even anon users)
            if user.has_perms(perms):
                return True
            # In case the 403 handler should be called raise the exception
            if raise_exception:
                raise PermissionDenied
            # As the last resort, show the login form
            return False
    else:
        # ``SATISFY_ANY`` case
        def check_perms(user):
            # First check if the user has the permission (even anon users)
            for perm in perms:
                if user.has_perm(perm):
                    return True

            # In case the 403 handler should be called raise the exception
            if raise_exception:
                raise PermissionDenied
            # As the last resort, show the login form
            return False

    return user_passes_test(check_perms, login_url=login_url)
def permissions_required ( perms , satisfy = DEFAULT_SATISFY , login_url = None , raise_exception = False ) : assert satisfy in ( SATISFY_ANY , SATISFY_ALL ) if SATISFY_ALL == satisfy : # ``SATISFY_ALL`` case def check_perms ( user ) : # First check if the user has the permission (even anon users) if user . has_perms ( perms ) : return True # In case the 403 handler should be called raise the exception if raise_exception : raise PermissionDenied # As the last resort, show the login form return False else : # ``SATISFY_ANY`` case def check_perms ( user ) : # First check if the user has the permission (even anon users) for perm in perms : if user . has_perm ( perm ) : return True # In case the 403 handler should be called raise the exception if raise_exception : raise PermissionDenied # As the last resort, show the login form return False return user_passes_test ( check_perms , login_url = login_url )