fix(dgsi): We can use is_staff now instead
This commit is contained in:
parent
60c227a942
commit
561d5c60d7
3 changed files with 3 additions and 7 deletions
|
@ -13,7 +13,7 @@ class StaffRequiredMixin(UserPassesTestMixin):
|
|||
|
||||
assert isinstance(self.request.user, User)
|
||||
|
||||
return self.request.user.is_admin
|
||||
return self.request.user.is_staff
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
# NOTE: We are only allowed to do this if a class is supplied to the right when constructing the view
|
||||
|
|
|
@ -205,12 +205,8 @@ class User(AbstractUser):
|
|||
logging.error(f"Erreur lors de la requête à Kanidm: {e}")
|
||||
return None
|
||||
|
||||
@property
|
||||
def is_admin(self) -> bool:
|
||||
return self.part_of(settings.DGSI_STAFF_GROUP)
|
||||
|
||||
def part_of(self, group: str) -> bool:
|
||||
return (self.kanidm is not None) and group in self.kanidm.person.memberof
|
||||
return (self.kanidm is not None) and (group in self.kanidm.person.memberof)
|
||||
|
||||
def can_access_archive(self, archive: Archive) -> bool:
|
||||
# Prepare a more complex workflow
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if user.is_admin %}
|
||||
{% if user.is_staff %}
|
||||
<hr>
|
||||
{% for link in links.admin %}
|
||||
{% include "_index_link.html" %}
|
||||
|
|
Loading…
Add table
Reference in a new issue