mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-28 15:42:25 +00:00
Warning message with acl
This commit is contained in:
parent
3ab860fccd
commit
5ee0f05193
1 changed files with 11 additions and 12 deletions
23
re2o/acl.py
23
re2o/acl.py
|
@ -148,20 +148,19 @@ ModelC)
|
||||||
can_change_fct = getattr(target, 'can_change_' + field)
|
can_change_fct = getattr(target, 'can_change_' + field)
|
||||||
yield can_change_fct(request.user, *args, **kwargs)
|
yield can_change_fct(request.user, *args, **kwargs)
|
||||||
|
|
||||||
error_messages = [
|
for accept, msg in chain.from_iterable(process_target(x[0], x[1]) for x in group_targets()):
|
||||||
x[1] for x in chain.from_iterable(
|
if not accept:
|
||||||
process_target(x[0], x[1]) for x in group_targets()
|
|
||||||
) if not x[0]
|
|
||||||
]
|
|
||||||
if error_messages:
|
|
||||||
for msg in error_messages:
|
|
||||||
messages.error(
|
messages.error(
|
||||||
request, msg or _("You don't have the right to access"
|
request, msg or _("You don't have the right to access"
|
||||||
" this menu."))
|
" this menu.")
|
||||||
return redirect(reverse(
|
)
|
||||||
'users:profil',
|
return redirect(reverse(
|
||||||
kwargs={'userid': str(request.user.id)}
|
'users:profil',
|
||||||
))
|
kwargs={'userid': str(request.user.id)}
|
||||||
|
))
|
||||||
|
elif msg:
|
||||||
|
messages.warning(request, msg)
|
||||||
|
|
||||||
return view(request, *chain(instances, args), **kwargs)
|
return view(request, *chain(instances, args), **kwargs)
|
||||||
return wrapper
|
return wrapper
|
||||||
return decorator
|
return decorator
|
||||||
|
|
Loading…
Reference in a new issue