Commit a03a9207 authored by moamoak's avatar moamoak

Merge branch 'matthieu_acl_fix' into 'master'

Fix #79

Closes #79

See merge request federez/re2o!98
parents 26e87451 2e9de93a
......@@ -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):
......
......@@ -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"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment