[CMF-checkins] CVS: CMF/CMFCore - MembershipTool.py:1.32.10.4

Yvo Schubbe schubbe at web.de
Mon Sep 29 07:13:06 EDT 2003


Update of /cvs-repository/CMF/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv25044/CMFCore

Modified Files:
      Tag: CMF-1_4-branch
	MembershipTool.py 
Log Message:
fixed getCandidateLocalRoles:
- filter out 'Member' correctly (Collector #148 and #169)
- also filter out 'Authenticated'

=== CMF/CMFCore/MembershipTool.py 1.32.10.3 => 1.32.10.4 ===
--- CMF/CMFCore/MembershipTool.py:1.32.10.3	Wed Sep 24 10:24:45 2003
+++ CMF/CMFCore/MembershipTool.py	Mon Sep 29 07:12:35 2003
@@ -354,19 +354,18 @@
 
         return md.searchMemberDataContents( search_param, search_term )
 
-        
     security.declareProtected(View, 'getCandidateLocalRoles')
-    def getCandidateLocalRoles( self, obj ):
-        """ What local roles can I assign? """
+    def getCandidateLocalRoles(self, obj):
+        """ What local roles can I assign?
+        """
         member = self.getAuthenticatedMember()
-
         if 'Manager' in member.getRoles():
-            return self.getPortalRoles()
+            local_roles = self.getPortalRoles()
         else:
-            member_roles = list( member.getRolesInContext( obj ) )
-            del member_roles[member_roles.index( 'Member')]
-
-        return tuple( member_roles )
+            local_roles = [ role for role in member.getRolesInContext(obj)
+                            if role not in ('Member', 'Authenticated') ]
+        local_roles.sort()
+        return tuple(local_roles)
 
     security.declareProtected(View, 'setLocalRoles')
     def setLocalRoles( self, obj, member_ids, member_role, reindex=1 ):




More information about the CMF-checkins mailing list