Test links ACL against the view's resolved_object or fallback to test against the {{ object }} context variable. Solves GL issue #230.

This commit is contained in:
Roberto Rosario
2015-10-25 01:54:18 -04:00
parent 9bbd148497
commit ce07077f3e
4 changed files with 132 additions and 2 deletions

View File

@@ -222,6 +222,13 @@ class Link(object):
current_path = request.META['PATH_INFO']
current_view = resolve(current_path).view_name
# ACL is tested agains the resolved_object or just {{ object }} if not
if not resolved_object:
try:
resolved_object = Variable('object').resolve(context=context)
except VariableDoesNotExist:
pass
# If this link has a required permission check that the user have it
# too
if self.permissions: