[CMF-checkins] CVS: Products/CMFCore - MemberDataTool.py:1.15 MembershipTool.py:1.20 RegistrationTool.py:1.12

Andrew Sawyers andrew@zope.com
Mon, 18 Mar 2002 10:27:50 -0500


Update of /cvs-repository/Products/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv32652/CMFCore

Modified Files:
	MemberDataTool.py MembershipTool.py RegistrationTool.py 
Log Message:

*Moved site policies around out from the Registration Tool.  
* setProperties moved to MemberDataTool
* setPassword moved to MembershipTool
* Skins and python scripts updated to support these changes...


=== Products/CMFCore/MemberDataTool.py 1.14 => 1.15 ===
         return self.getUser().getUserName()
 
+    security.declareProtected(CMFCorePermissions.SetOwnProperties, 'setProperties')
+    def setProperties(self, properties=None, **kw):
+        '''Allows the authenticated member to set his/her own properties.
+        Accepts either keyword arguments or a mapping for the "properties"
+        argument.
+        '''
+        if properties is None:
+            properties = kw
+        membership = getToolByName(self, 'portal_membership')
+        registration = getToolByName(self, 'portal_registration', None)
+        if not membership.isAnonymousUser():
+            member = membership.getAuthenticatedMember()
+            if registration:
+                failMessage = registration.testPropertiesValidity(properties, member)
+                if failMessage is not None:
+                    raise 'Bad Request', failMessage
+            member.setMemberProperties(properties)
+        else:
+            raise 'Bad Request', 'Not logged in.'
+
     security.declarePrivate('setMemberProperties')
     def setMemberProperties(self, mapping):
         '''Sets the properties of the member.


=== Products/CMFCore/MembershipTool.py 1.19 => 1.20 ===
     manage_mapRoles = DTMLFile('membershipRolemapping', _dtmldir )
  
+    security.declareProtected(CMFCorePermissions.SetOwnPassword, 'setPassword')
+    def setPassword(self, password, domains=None):
+        '''Allows the authenticated member to set his/her own password.
+        '''
+        registration = getToolByName(self, 'portal_registration', None)
+        if not self.isAnonymousUser():
+            member = self.getAuthenticatedMember()
+            if registration:
+                failMessage = registration.testPasswordValidity(password)
+                if failMessage is not None:
+                    raise 'Bad Request', failMessage
+            member.setSecurityProfile(password=password, domains=domains)
+        else:
+            raise 'Bad Request', 'Not logged in.'
+
     security.declarePublic('getAuthenticatedMember')
     def getAuthenticatedMember(self):
         '''


=== Products/CMFCore/RegistrationTool.py 1.11 => 1.12 ===
         raise 'NotImplemented'
 
-    security.declareProtected(SetOwnPassword, 'setPassword')
-    def setPassword(self, password, domains=None):
-        '''Allows the authenticated member to set his/her own password.
-        '''
-        membership = getToolByName(self, 'portal_membership')
-        if not membership.isAnonymousUser():
-            member = membership.getAuthenticatedMember()
-            failMessage = self.testPasswordValidity(password)
-            if failMessage is not None:
-                raise 'Bad Request', failMessage
-            member.setSecurityProfile(password=password, domains=domains)
-        else:
-            raise 'Bad Request', 'Not logged in.'
-            
-    security.declareProtected(SetOwnProperties, 'setProperties')
-    def setProperties(self, properties=None, **kw):
-        '''Allows the authenticated member to set his/her own properties.
-        Accepts either keyword arguments or a mapping for the "properties"
-        argument.
-        '''
-        if properties is None:
-            properties = kw
-        membership = getToolByName(self, 'portal_membership')
-        if not membership.isAnonymousUser():
-            member = membership.getAuthenticatedMember()
-            failMessage = self.testPropertiesValidity(properties, member)
-            if failMessage is not None:
-                raise 'Bad Request', failMessage
-            member.setMemberProperties(properties)
-        else:
-            raise 'Bad Request', 'Not logged in.'
-
-
 InitializeClass(RegistrationTool)