more comments \o/
This commit is contained in:
parent
89ea3fec16
commit
93cd4f0e77
5 changed files with 53 additions and 0 deletions
|
@ -109,6 +109,7 @@ class AccessPermissionForm(Form):
|
|||
for restriction in self.cleaned_data['access_restrictions']:
|
||||
expire_date = self.cleaned_data['expires']
|
||||
author_expire_date = self.author_access_permissions.get(restriction.pk)
|
||||
# make sure that each permission is not granted for a longer time than the author has it
|
||||
if author_expire_date is not None:
|
||||
expire_date = author_expire_date if expire_date is None else min(expire_date, author_expire_date)
|
||||
restrictions.append(AccessPermissionTokenItem(pk=restriction.pk, expire_date=expire_date,
|
||||
|
|
|
@ -4,6 +4,9 @@ from c3nav.control.models import UserPermissions
|
|||
|
||||
|
||||
class UserPermissionsMiddleware:
|
||||
"""
|
||||
This middleware adds request.user_permissions to get the UserPermissions for the current request/user.
|
||||
"""
|
||||
def __init__(self, get_response):
|
||||
self.get_response = get_response
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue