Skip to content
Snippets Groups Projects
Commit 81f261c6 authored by Timothy Allen's avatar Timothy Allen
Browse files

Expand docstrings for .login_required() and .group_required()

Now .login_required() and .group_required() document what they require
LDAP_LOGIN_VIEW to do.
parent a067a985
No related branches found
No related tags found
No related merge requests found
......@@ -222,8 +222,13 @@ class LDAP(object):
@staticmethod
def login_required(func):
"""Used to decorate a view function to require LDAP login but does NOT
require membership from a specific group.
"""When applied to a view function, any unauthenticated requests will
be redirected to the view named in LDAP_LOGIN_VIEW. Authenticated
requests do NOT require membership from a specific group.
The login view is responsible for asking for credentials, checking
them, and setting ``flask.g.user`` to the name of the authenticated
user if the credentials are acceptable.
:param func: The view function to decorate.
"""
......@@ -237,8 +242,14 @@ class LDAP(object):
@staticmethod
def group_required(groups=None):
"""Used to decorate a view function to require LDAP login AND membership
from one of the groups within the groups list.
"""When applied to a view function, any unauthenticated requests will
be redirected to the view named in LDAP_LOGIN_VIEW. Authenticated
requests are only permitted if they belong to one of the listed groups.
The login view is responsible for asking for credentials, checking
them, and setting ``flask.g.user`` to the name of the authenticated
user and ``flask.g.ldap_groups`` to the authenticated's user's groups
if the credentials are acceptable.
:param list groups: List of groups that should be able to access the view
function.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment