8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-24 20:33:11 +00:00

Warning message with acl

This commit is contained in:
detraz 2019-03-18 00:05:02 +01:00
parent 3ab860fccd
commit 5ee0f05193

View file

@ -148,20 +148,19 @@ ModelC)
can_change_fct = getattr(target, 'can_change_' + field)
yield can_change_fct(request.user, *args, **kwargs)
error_messages = [
x[1] for x in chain.from_iterable(
process_target(x[0], x[1]) for x in group_targets()
) if not x[0]
]
if error_messages:
for msg in error_messages:
for accept, msg in chain.from_iterable(process_target(x[0], x[1]) for x in group_targets()):
if not accept:
messages.error(
request, msg or _("You don't have the right to access"
" this menu."))
return redirect(reverse(
'users:profil',
kwargs={'userid': str(request.user.id)}
))
" this menu.")
)
return redirect(reverse(
'users:profil',
kwargs={'userid': str(request.user.id)}
))
elif msg:
messages.warning(request, msg)
return view(request, *chain(instances, args), **kwargs)
return wrapper
return decorator