Creation de droit_light
darcs-hash:20070412083706-c992d-875263d158a1396c9d103141d0101859dcd0da6d.gz
This commit is contained in:
parent
04446f0d84
commit
47d0d6016e
1 changed files with 41 additions and 5 deletions
|
@ -2159,12 +2159,9 @@ class Adherent(BaseProprietaire):
|
|||
|
||||
if droits == None:
|
||||
return map(decode, self._data.get('droits', []))
|
||||
|
||||
|
||||
# A raffiner
|
||||
|
||||
# if not isadm:
|
||||
# raise EnvironmentError(u'Il faut être administrateur pour effectuer cette opération.')
|
||||
if not isadm:
|
||||
raise EnvironmentError(u'Il faut être administrateur pour effectuer cette opération.')
|
||||
|
||||
if type(droits) != list:
|
||||
raise TypeError(u'Une liste est attendue')
|
||||
|
@ -2181,6 +2178,45 @@ class Adherent(BaseProprietaire):
|
|||
self._set('droits', new)
|
||||
|
||||
return new
|
||||
|
||||
def droits_light(self, droits=None):
|
||||
""" droits_light ne verifie pas isadm et ne touche pas aux droits critiques """
|
||||
|
||||
if droits != None and 'cransAccount' not in self._data.get('objectClass', []):
|
||||
raise EnvironmentError(u'Il faut avoir un compte pour avoir des droits.')
|
||||
|
||||
if droits == None:
|
||||
return map(decode, self._data.get('droits', []))
|
||||
|
||||
if type(droits) != list:
|
||||
raise TypeError(u'Une liste est attendue')
|
||||
|
||||
new = []
|
||||
for droit in droits:
|
||||
if droit == '': continue
|
||||
droit = unicode(droit.strip(), 'iso-8859-15')
|
||||
if droit not in droits_possibles:
|
||||
raise ValueError(u'Droit %s incorrect' % droit)
|
||||
new.append(droit.encode('utf-8'))
|
||||
|
||||
ancien = self._data.get('droits',[])
|
||||
diff = []
|
||||
for droit in new:
|
||||
if droit not in ancien:
|
||||
diff.append(droit)
|
||||
for droit in ancien:
|
||||
if droit not in new:
|
||||
diff.append(droit)
|
||||
dc = [] # snif...
|
||||
for droit in droits_critiques:
|
||||
dc.append(droit.encode('utf-8'))
|
||||
for droit in diff:
|
||||
if droit in dc:
|
||||
raise("Droits critiques modifies (?)")
|
||||
if new != self._data.get('droits', []):
|
||||
self._set('droits', new)
|
||||
|
||||
return new
|
||||
|
||||
|
||||
def rewriteMailHeaders(self, rewrite=None):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue