mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-23 15:33:45 +00:00
Correct customs acl list for extensions
This commit is contained in:
parent
4f4b71c5b4
commit
62561b27de
1 changed files with 26 additions and 0 deletions
|
@ -981,6 +981,32 @@ class Extension(RevMixin, AclMixin, models.Model):
|
||||||
("machines.use_all_extension",),
|
("machines.use_all_extension",),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def can_list(cls, user_request, *_args, **_kwargs):
|
||||||
|
"""All users can list unprivileged extensions
|
||||||
|
Only members of privileged groups can list all.
|
||||||
|
|
||||||
|
:param user_request: The user who wants to view the list.
|
||||||
|
:return: True if the user can view the list and an explanation
|
||||||
|
message.
|
||||||
|
|
||||||
|
"""
|
||||||
|
can, _message, _group = cls.can_use_all(user_request)
|
||||||
|
if can:
|
||||||
|
return (
|
||||||
|
True,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
cls.objects.all()
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return (
|
||||||
|
False,
|
||||||
|
_("You don't have the right to list all extensions."),
|
||||||
|
("machines.use_all_extension",),
|
||||||
|
cls.objects.filter(need_infra=False),
|
||||||
|
)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue