X-Git-Url: https://scm.cri.ensmp.fr/git/Plinn.git/blobdiff_plain/9dbf7a7a52bc8ae454d8770edaafaefc8621536d..db27711c73a072eea8522dcdc19b15b31a84da46:/MemberDataTool.py?ds=inline diff --git a/MemberDataTool.py b/MemberDataTool.py index 4a432eb..c83ff49 100755 --- a/MemberDataTool.py +++ b/MemberDataTool.py @@ -40,6 +40,7 @@ from Products.CMFCore.interfaces import IRegistrationTool #from Products.CMFCore.utils import getToolByName from Products.CMFCore.CMFCatalogAware import CMFCatalogAware from Products.CMFCore.DynamicType import DynamicType +from Products.CMFCore.exceptions import BadRequest from utils import formatFullName from permissions import SetMemberProperties, SetMemberPassword @@ -117,10 +118,23 @@ class MemberAdapter(BaseMemberAdapter, SimpleItem, DynamicType, CMFCatalogAware) registration = getUtility(IRegistrationTool) failMessage = registration.testPasswordValidity(password) if failMessage is not None : - raise ValueError(failMessage) + raise BadRequest(failMessage) self.setSecurityProfile(password=password, domains=domains) + security.declarePrivate('setSecurityProfile') + def setSecurityProfile(self, password=None, roles=None, domains=None): + """Set the user's basic security profile""" + u = self.getUser() + # This is really hackish. The Zope User API needs methods + # for performing these functions. + if password is not None: + u.setPassword(password) + if roles is not None: + u.setRoles(roles) + if domains is not None: + u.setDomains(domains) + security.declarePrivate('manage_beforeDelete') def manage_beforeDelete(self) : """ uncatalog object """ @@ -140,7 +154,8 @@ class MemberAdapter(BaseMemberAdapter, SimpleItem, DynamicType, CMFCatalogAware) return super(MemberAdapter, self).getId() def getRoles(self): - return super(MemberAdapter, self).getRoles() + return self._user.aq_inner.getRoles() + # return super(MemberAdapter, self).getRoles() def getRolesInContext(self, object): return super(MemberAdapter, self).getRolesInContext(object) @@ -177,20 +192,21 @@ class MemberData (BaseData, DynamicType, CMFCatalogAware): # if user_folder.meta_type == 'Group User Folder' : # self.changePassword(password) - + +#migré #XXX restore the previous implementation for GRUF 2 I'll remove that later... - security.declarePrivate('setSecurityProfile') - def setSecurityProfile(self, password=None, roles=None, domains=None): - """Set the user's basic security profile""" - u = self.getUser() - # This is really hackish. The Zope User API needs methods - # for performing these functions. - if password is not None: - u.__ = password - if roles is not None: - u.roles = roles - if domains is not None: - u.domains = domains +# security.declarePrivate('setSecurityProfile') +# def setSecurityProfile(self, password=None, roles=None, domains=None): +# """Set the user's basic security profile""" +# u = self.getUser() +# # This is really hackish. The Zope User API needs methods +# # for performing these functions. +# if password is not None: +# u.__ = password +# if roles is not None: +# u.roles = roles +# if domains is not None: +# u.domains = domains # migré # def getMemberFullName(self, nameBefore=1) :