Commit ea8fc941 authored by Jim Fulton's avatar Jim Fulton

Added some machinery to fix bugs in reseting old permission settings.

parent 454fd3e6
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
__doc__='''short description __doc__='''short description
$Id: Permission.py,v 1.1 1998/05/08 14:45:20 jim Exp $''' $Id: Permission.py,v 1.2 1998/05/11 14:58:28 jim Exp $'''
__version__='$Revision: 1.1 $'[11:-2] __version__='$Revision: 1.2 $'[11:-2]
from Globals import HTMLFile, MessageDialog from Globals import HTMLFile, MessageDialog
from string import join, strip, split, find from string import join, strip, split, find
...@@ -80,16 +80,20 @@ class Permission: ...@@ -80,16 +80,20 @@ class Permission:
return roles return roles
def setRoles(self, roles): def setRoles(self, roles):
obj=self.obj
if type(roles) is ListType and not roles: if type(roles) is ListType and not roles:
if hasattr(self.obj, self._p): delattr(self.obj, self._p) if hasattr(obj, self._p): delattr(obj, self._p)
else: else:
setattr(self.obj, self._p, roles) setattr(obj, self._p, roles)
for name in self.data: for name in self.data:
if name=='': attr=self.obj if name=='': attr=obj
else: attr=getattr(self.obj, name) else: attr=getattr(obj, name)
try: del attr.__roles__ try: del attr.__roles__
except: pass except: pass
try: delattr(obj,name+'__roles__')
except: pass
def setRole(self, role, present): def setRole(self, role, present):
roles=self.getRoles() roles=self.getRoles()
...@@ -113,6 +117,9 @@ class Permission: ...@@ -113,6 +117,9 @@ class Permission:
############################################################################## ##############################################################################
# #
# $Log: Permission.py,v $ # $Log: Permission.py,v $
# Revision 1.2 1998/05/11 14:58:28 jim
# Added some machinery to fix bugs in reseting old permission settings.
#
# Revision 1.1 1998/05/08 14:45:20 jim # Revision 1.1 1998/05/08 14:45:20 jim
# new permission machinery # new permission machinery
# #
......
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