mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-23 15:33:45 +00:00
Merge branch 'matthieu_acl_fix' into 'master'
Fix #79 Closes #79 See merge request federez/re2o!98
This commit is contained in:
commit
a03a92070e
2 changed files with 4 additions and 3 deletions
|
@ -168,12 +168,12 @@ class Switch(models.Model):
|
||||||
|
|
||||||
def can_view_all(user_request, *args, **kwargs):
|
def can_view_all(user_request, *args, **kwargs):
|
||||||
if not user_request.has_perm('topologie.view_switch'):
|
if not user_request.has_perm('topologie.view_switch'):
|
||||||
return False, u"Vous n'avez pas le droit de coir les switch"
|
return False, u"Vous n'avez pas le droit de voir les switch"
|
||||||
return True, None
|
return True, None
|
||||||
|
|
||||||
def can_view(self, user_request, *args, **kwargs):
|
def can_view(self, user_request, *args, **kwargs):
|
||||||
if not user_request.has_perm('topologie.view_switch'):
|
if not user_request.has_perm('topologie.view_switch'):
|
||||||
return False, u"Vous n'avez pas le droit de coir les switch"
|
return False, u"Vous n'avez pas le droit de voir les switch"
|
||||||
return True, None
|
return True, None
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
|
|
@ -285,7 +285,8 @@ class User(FieldPermissionModelMixin, AbstractBaseUser, PermissionsMixin):
|
||||||
@property
|
@property
|
||||||
def is_admin(self):
|
def is_admin(self):
|
||||||
""" Renvoie si l'user est admin"""
|
""" Renvoie si l'user est admin"""
|
||||||
return self.is_superuser
|
admin,_ = Group.objects.get_or_create(name="admin")
|
||||||
|
return self.is_superuser or admin in self.groups.all()
|
||||||
|
|
||||||
def get_full_name(self):
|
def get_full_name(self):
|
||||||
""" Renvoie le nom complet de l'user formaté nom/prénom"""
|
""" Renvoie le nom complet de l'user formaté nom/prénom"""
|
||||||
|
|
Loading…
Reference in a new issue