8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-28 01:43:46 +00:00

Merge branch 'matthieu_acl_fix' into 'master'

Fix #79

Closes #79

See merge request federez/re2o!98
This commit is contained in:
moamoak 2018-03-08 18:51:45 +01:00
commit a03a92070e
2 changed files with 4 additions and 3 deletions

View file

@ -168,12 +168,12 @@ class Switch(models.Model):
def can_view_all(user_request, *args, **kwargs):
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
def can_view(self, user_request, *args, **kwargs):
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
def __str__(self):

View file

@ -285,7 +285,8 @@ class User(FieldPermissionModelMixin, AbstractBaseUser, PermissionsMixin):
@property
def is_admin(self):
""" 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):
""" Renvoie le nom complet de l'user formaté nom/prénom"""