diff options
author | Leif Johansson <leifj@sunet.se> | 2011-02-22 15:59:40 +0100 |
---|---|---|
committer | Leif Johansson <leifj@sunet.se> | 2011-02-22 15:59:40 +0100 |
commit | 3ff9d9544a047fc65d1666cd68fbd37f1b3aa5eb (patch) | |
tree | 6dd85dcb314b5bd7653bec6048e004daf924ed12 /coip/apps/name | |
parent | 3590b6d57da21772bc03657058b5f973e7cd0863 (diff) |
setacl fix
Diffstat (limited to 'coip/apps/name')
-rw-r--r-- | coip/apps/name/models.py | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/coip/apps/name/models.py b/coip/apps/name/models.py index 530775f..104c0ef 100644 --- a/coip/apps/name/models.py +++ b/coip/apps/name/models.py @@ -94,17 +94,9 @@ class Name(models.Model): return NameLink.objects.filter(src=self,dst=dst,type=type,data=data).count() > 0 def setacl(self,name,perm): - (link,b) = NameLink.objects.get_or_create(src=self,dst=name,type=NameLink.access_control) - save = False - if not link.data: - link.data = '' - save = True - for p in perm: - #pprint(p) - if link.data.find(p) == -1: - link.data = link.data+p - save = True - if save: + (link,created) = NameLink.objects.get_or_create(src=self,dst=name,type=NameLink.access_control) + if not (link.data and link.data == perm): + link.data = perm link.save() def rmacl(self,name,perm): @@ -140,8 +132,8 @@ class Name(models.Model): if NameLink.objects.filter(src=self,type=NameLink.access_control,data__contains=perm,dst__memberships__user=user).count() > 0: return True - if user.is_superuser: - return True + #if user.is_superuser: + # return True return False #user.is_superuser |