r662 - in zope-plonepas/trunk: . Extensions debian plugins tests tools

Fabio Tranchitella kobold at alioth.debian.org
Fri Feb 9 15:48:31 CET 2007


Author: kobold
Date: 2007-02-09 15:48:30 +0100 (Fri, 09 Feb 2007)
New Revision: 662

Modified:
   zope-plonepas/trunk/Extensions/Install.py
   zope-plonepas/trunk/README.txt
   zope-plonepas/trunk/__init__.py
   zope-plonepas/trunk/config.py
   zope-plonepas/trunk/debian/changelog
   zope-plonepas/trunk/gruf_support.py
   zope-plonepas/trunk/ldapmp.py
   zope-plonepas/trunk/pas.py
   zope-plonepas/trunk/patch.py
   zope-plonepas/trunk/plugins/cookie_handler.py
   zope-plonepas/trunk/plugins/group.py
   zope-plonepas/trunk/plugins/gruf.py
   zope-plonepas/trunk/plugins/local_role.py
   zope-plonepas/trunk/plugins/property.py
   zope-plonepas/trunk/plugins/role.py
   zope-plonepas/trunk/plugins/user.py
   zope-plonepas/trunk/sheet.py
   zope-plonepas/trunk/storage.py
   zope-plonepas/trunk/tests/cookie_auth.txt
   zope-plonepas/trunk/tests/test_basic_ops.py
   zope-plonepas/trunk/tests/test_doctests.py
   zope-plonepas/trunk/tests/test_groups_tool.py
   zope-plonepas/trunk/tools/groupdata.py
   zope-plonepas/trunk/tools/groups.py
   zope-plonepas/trunk/tools/memberdata.py
   zope-plonepas/trunk/tools/membership.py
   zope-plonepas/trunk/tools/plonetool.py
   zope-plonepas/trunk/utils.py
   zope-plonepas/trunk/version.txt
Log:
New upstream release.


Modified: zope-plonepas/trunk/Extensions/Install.py
===================================================================
--- zope-plonepas/trunk/Extensions/Install.py	2007-02-09 14:47:50 UTC (rev 661)
+++ zope-plonepas/trunk/Extensions/Install.py	2007-02-09 14:48:30 UTC (rev 662)
@@ -13,7 +13,7 @@
 #
 ##############################################################################
 """
-$Id: Install.py 26125 2006-07-15 11:42:09Z wichert $
+$Id: Install.py 35192 2006-12-29 20:56:56Z wichert $
 """
 
 from sets import Set
@@ -321,15 +321,15 @@
         # be careful of non-ZODB member sources, like LDAP
         member = mtool.getMemberById(u[0])
         if member is None:
-            mtool.addMember(*u[:-1])
+            mtool.addMember(*u[:4])
             print >> out, " : adding member '%s'" % u[0]
         else:
             # set any properties. do we need anything else? roles, maybe?
-            member.setMemberProperties(u[-1])
+            member.setMemberProperties(u[4])
             print >> out, " : setting props on member '%s'" % member.getId()
 
-        if u[-1] is not None:
-            mdtool._setPortrait(u[-1], u[0])
+        if u[5] is not None:
+            mdtool._setPortrait(u[5], u[0])
 
     print >> out, "...restore done"
 

Modified: zope-plonepas/trunk/README.txt
===================================================================
--- zope-plonepas/trunk/README.txt	2007-02-09 14:47:50 UTC (rev 661)
+++ zope-plonepas/trunk/README.txt	2007-02-09 14:48:30 UTC (rev 662)
@@ -9,7 +9,7 @@
 
 Versions
 
-  - Currently targeted to Plone 3.0, and its standard dependencies.
+  - Currently targeted to Plone 2.1 and 2.5, and its standard dependencies.
 
 Depends On
 

Modified: zope-plonepas/trunk/__init__.py
===================================================================
--- zope-plonepas/trunk/__init__.py	2007-02-09 14:47:50 UTC (rev 661)
+++ zope-plonepas/trunk/__init__.py	2007-02-09 14:48:30 UTC (rev 662)
@@ -13,7 +13,7 @@
 #
 ##############################################################################
 """
-$Id: __init__.py 19804 2006-02-26 12:17:06Z hannosch $
+$Id: __init__.py 35196 2006-12-29 21:50:54Z wichert $
 """
 
 from AccessControl.Permissions import add_user_folders

Modified: zope-plonepas/trunk/config.py
===================================================================
--- zope-plonepas/trunk/config.py	2007-02-09 14:47:50 UTC (rev 661)
+++ zope-plonepas/trunk/config.py	2007-02-09 14:48:30 UTC (rev 662)
@@ -13,7 +13,7 @@
 #
 ##############################################################################
 """
-$Id: config.py 21957 2006-04-09 13:36:36Z wichert $
+$Id: config.py 35196 2006-12-29 21:50:54Z wichert $
 """
 
 PROJECTNAME = 'PlonePAS'

Modified: zope-plonepas/trunk/debian/changelog
===================================================================
--- zope-plonepas/trunk/debian/changelog	2007-02-09 14:47:50 UTC (rev 661)
+++ zope-plonepas/trunk/debian/changelog	2007-02-09 14:48:30 UTC (rev 662)
@@ -1,3 +1,9 @@
+zope-plonepas (2.2-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Fabio Tranchitella <kobold at debian.org>  Fri,  9 Feb 2007 15:48:19 +0100
+
 zope-plonepas (2.1-1) unstable; urgency=low
 
   * New upstream release.

Modified: zope-plonepas/trunk/gruf_support.py
===================================================================
--- zope-plonepas/trunk/gruf_support.py	2007-02-09 14:47:50 UTC (rev 661)
+++ zope-plonepas/trunk/gruf_support.py	2007-02-09 14:48:30 UTC (rev 662)
@@ -20,7 +20,7 @@
 
 open question if this mode will be supported at all
 
-$Id: gruf_support.py 21960 2006-04-09 13:53:57Z wichert $
+$Id: gruf_support.py 35196 2006-12-29 21:50:54Z wichert $
 """
 
 import logging
@@ -57,7 +57,7 @@
         try:
             uid_and_name = auth.authenticateCredentials(credentials)
 
-            if uid_and_name == (None,None):
+            if uid_and_name is None or uid_and_name == (None,None):
                 continue
 
             user_id, name = uid_and_name

Modified: zope-plonepas/trunk/ldapmp.py
===================================================================
--- zope-plonepas/trunk/ldapmp.py	2007-02-09 14:47:50 UTC (rev 661)
+++ zope-plonepas/trunk/ldapmp.py	2007-02-09 14:48:30 UTC (rev 662)
@@ -13,7 +13,7 @@
 #
 ##############################################################################
 """
-$Id: ldapmp.py 26036 2006-07-11 22:56:18Z rochael $
+$Id: ldapmp.py 35196 2006-12-29 21:50:54Z wichert $
 """
 
 from Products.PlonePAS.patch import call, wrap_method

Modified: zope-plonepas/trunk/pas.py
===================================================================
--- zope-plonepas/trunk/pas.py	2007-02-09 14:47:50 UTC (rev 661)
+++ zope-plonepas/trunk/pas.py	2007-02-09 14:48:30 UTC (rev 662)
@@ -14,7 +14,7 @@
 ##############################################################################
 """
 pas alterations and monkies
-$Id: pas.py 29332 2006-08-25 20:29:03Z rochael $
+$Id: pas.py 35196 2006-12-29 21:50:54Z wichert $
 """
 from sets import Set
 
@@ -72,7 +72,10 @@
                                    " delete users.")
 
     for userdeleter_id, userdeleter in userdeleters:
-        userdeleter.doDeleteUser(id)
+        try:
+            userdeleter.doDeleteUser(id)
+        except _SWALLOWABLE_PLUGIN_EXCEPTIONS:
+            pass
 PluggableAuthService._doDelUser = _doDelUser
 
 security.declareProtected(ManageUsers, 'userFolderDelUsers')

Modified: zope-plonepas/trunk/patch.py
===================================================================
--- zope-plonepas/trunk/patch.py	2007-02-09 14:47:50 UTC (rev 661)
+++ zope-plonepas/trunk/patch.py	2007-02-09 14:48:30 UTC (rev 662)
@@ -13,7 +13,7 @@
 #
 ##############################################################################
 """
-$Id: patch.py 25192 2006-06-20 19:31:53Z wichert $
+$Id: patch.py 35196 2006-12-29 21:50:54Z wichert $
 """
 import logging
 

Modified: zope-plonepas/trunk/plugins/cookie_handler.py
===================================================================
--- zope-plonepas/trunk/plugins/cookie_handler.py	2007-02-09 14:47:50 UTC (rev 661)
+++ zope-plonepas/trunk/plugins/cookie_handler.py	2007-02-09 14:48:30 UTC (rev 662)
@@ -9,6 +9,7 @@
 """
 
 from base64 import encodestring
+from urllib import quote
 from Acquisition import aq_base
 from AccessControl.SecurityInfo import ClassSecurityInfo
 from Globals import InitializeClass, DTMLFile
@@ -39,6 +40,7 @@
 manage_addExtendedCookieAuthHelperForm = DTMLFile("../zmi/ExtendedCookieAuthHelperForm", globals())
 
 
+
 class ExtendedCookieAuthHelper(BasePlugin):
     """Multi-plugin which adds ability to override the updating of cookie via
     a setAuthCookie method/script.
@@ -56,7 +58,7 @@
         if setAuthCookie:
             cookie_val = encodestring('%s:%s' % (login, new_password))
             cookie_val = cookie_val.rstrip()
-            setAuthCookie(response, self.cookie_name, cookie_val)
+            setAuthCookie(response, self.cookie_name, quote(cookie_val))
         else:
             BasePlugin.updateCredentials(self, request, response, login, new_password)
 

Modified: zope-plonepas/trunk/plugins/group.py
===================================================================
--- zope-plonepas/trunk/plugins/group.py	2007-02-09 14:47:50 UTC (rev 661)
+++ zope-plonepas/trunk/plugins/group.py	2007-02-09 14:48:30 UTC (rev 662)
@@ -16,7 +16,7 @@
 ZODB Group Implementation with basic introspection and
 management (ie. rw) capabilities.
 
-$Id: group.py 30156 2006-09-09 01:37:59Z hannosch $
+$Id: group.py 32095 2006-10-20 20:38:17Z rossp $
 """
 
 import logging
@@ -26,13 +26,15 @@
 from Globals import InitializeClass
 from AccessControl import ClassSecurityInfo
 
+from zope.interface import implementedBy
+
 from Products.PluggableAuthService.PluggableAuthService import _SWALLOWABLE_PLUGIN_EXCEPTIONS
 from Products.PluggableAuthService.plugins.ZODBGroupManager import ZODBGroupManager
 from Products.PluggableAuthService.interfaces.plugins import IGroupsPlugin, IGroupEnumerationPlugin
 from Products.PluggableAuthService.interfaces.plugins import IPropertiesPlugin
 from Products.PluggableAuthService.interfaces.plugins import IRolesPlugin
 from Products.PluggableAuthService.utils import createViewName
-from Products.PluggableAuthService.utils import classImplements, implementedBy
+from Products.PluggableAuthService.utils import classImplements
 
 from Products.PlonePAS.interfaces.group import IGroupManagement, IGroupIntrospection
 from Products.PlonePAS.interfaces.capabilities import IGroupCapability
@@ -58,6 +60,7 @@
 class GroupManager(ZODBGroupManager):
 
     meta_type = "Group Manager"
+
     security = ClassSecurityInfo()
 
     def __init__(self, *args, **kw):
@@ -151,6 +154,7 @@
         if user_id in group_members: return 1
         return 0
 
+
     #################################
     # group wrapping mechanics
 
@@ -173,6 +177,7 @@
 
         return PloneGroup(group_id, name).__of__(self)
 
+
     security.declarePrivate('_findGroup')
     def _findGroup(self, plugins, group_id, title=None, request=None):
         """ group_id -> decorated_group
@@ -207,7 +212,9 @@
             rolemakers = plugins.listPlugins(IRolesPlugin)
 
             for rolemaker_id, rolemaker in rolemakers:
+
                 roles = rolemaker.getRolesForPrincipal(group, request)
+
                 if roles:
                     group._addRoles(roles)
 
@@ -218,7 +225,8 @@
             if getattr(base_group, '_p_jar', None) is None:
                 self.ZCacheable_set(base_group
                                    , view_name=view_name
-                                   , keywords=keywords)
+                                   , keywords=keywords
+                                  )
 
         return group.__of__(self)
 
@@ -241,11 +249,13 @@
             view_name = createViewName('_verifyGroup', group_id)
             cached_info = self.ZCacheable_get(view_name=view_name
                                              , keywords=criteria
-                                             , default=None)
+                                             , default=None
+                                            )
 
             if cached_info is not None:
                 return cached_info
 
+
             enumerators = plugins.listPlugins(IGroupEnumerationPlugin)
 
             for enumerator_id, enumerator in enumerators:
@@ -321,4 +331,10 @@
         """
         return 0
 
+# there was a comment in the class before saying:
+#    # __implements__ = (IGroup,)  # this should be made true
+#
+# if this is ever implemented, it should be made like this
+# classImplements(PloneGroup, IGroup)
+
 InitializeClass(PloneGroup)

Modified: zope-plonepas/trunk/plugins/gruf.py
===================================================================
--- zope-plonepas/trunk/plugins/gruf.py	2007-02-09 14:47:50 UTC (rev 661)
+++ zope-plonepas/trunk/plugins/gruf.py	2007-02-09 14:48:30 UTC (rev 662)
@@ -18,13 +18,15 @@
 management plugin functionalities within pas via delegation to a contained gruf
 instance.
 
-$Id: gruf.py 30156 2006-09-09 01:37:59Z hannosch $
+$Id: gruf.py 32095 2006-10-20 20:38:17Z rossp $
 """
 
 from Globals import DTMLFile, InitializeClass
 from OFS.ObjectManager import ObjectManager
 
-from Products.PluggableAuthService.utils import classImplements, implementedBy
+from zope.interface import implementedBy
+
+from Products.PluggableAuthService.utils import classImplements
 from Products.PluggableAuthService.plugins.DelegatingMultiPlugin \
      import DelegatingMultiPlugin
 from Products.PluggableAuthService.interfaces import plugins
@@ -100,6 +102,7 @@
         gruf_principal = gruf.getUser( pid )
         return gruf_principal.getGroupsWithoutPrefix()
 
+
     #################################
     # group management
 

Modified: zope-plonepas/trunk/plugins/local_role.py
===================================================================
--- zope-plonepas/trunk/plugins/local_role.py	2007-02-09 14:47:50 UTC (rev 661)
+++ zope-plonepas/trunk/plugins/local_role.py	2007-02-09 14:48:30 UTC (rev 662)
@@ -20,7 +20,7 @@
 ie. containers/objects which denote that they do not wish to acquire local
 roles from their containment structure.
 
-$Id: local_role.py 30156 2006-09-09 01:37:59Z hannosch $
+$Id: local_role.py 32095 2006-10-20 20:38:17Z rossp $
 """
 
 from sets import Set
@@ -28,7 +28,9 @@
 from Acquisition import aq_inner, aq_parent
 from Globals import DTMLFile, InitializeClass
 
-from Products.PluggableAuthService.utils import classImplements, implementedBy
+from zope.interface import implementedBy
+
+from Products.PluggableAuthService.utils import classImplements
 from Products.PluggableAuthService.plugins.LocalRolePlugin import LocalRolePlugin
 from Products.PlonePAS.interfaces.plugins import ILocalRolesPlugin
 
@@ -57,6 +59,7 @@
         self._id = self.id = id
         self.title = title
 
+
     #security.declarePrivate( 'getRolesInContext' )
     def getRolesInContext( self, user, object):
         user_id = user.getId()
@@ -69,9 +72,11 @@
         object = aq_inner( object )
 
         while 1:
+
             local_roles = getattr( object, '__ac_local_roles__', None )
 
             if local_roles:
+
                 if callable( local_roles ):
                     local_roles = local_roles()
 
@@ -94,6 +99,7 @@
             new = getattr( object, 'im_self', None )
 
             if new is not None:
+
                 object = aq_inner( new )
                 continue
 
@@ -101,6 +107,7 @@
 
         return list( user.getRoles() ) + local.keys()
 
+
     #security.declarePrivate( 'checkLocalRolesAllowed' )
     def checkLocalRolesAllowed( self, user, object, object_roles ):
         # Still have not found a match, so check local roles. We do
@@ -119,17 +126,20 @@
             local_roles = getattr( inner_obj, '__ac_local_roles__', None )
 
             if local_roles:
+
                 if callable( local_roles ):
                     local_roles = local_roles()
 
                 dict = local_roles or {}
 
                 for principal_id in principal_ids:
+
                     local_roles = dict.get( principal_id, [] )
 
                     for role in object_roles:
 
                         if role in local_roles:
+
                             if user._check_context( object ):
                                 return 1
 
@@ -155,15 +165,17 @@
 
         return None
 
+
     def getAllLocalRolesInContext(self, context):
         roles = {}
         object = aq_inner( context )
 
         while True:
 
-            local_roles = getattr(object, '__ac_local_roles__', None)
+            local_roles = getattr( object, '__ac_local_roles__', None )
 
             if local_roles:
+
                 if callable( local_roles ):
                     local_roles = local_roles()
 
@@ -175,6 +187,7 @@
 
                     roles[principal].update(localroles)
 
+
             inner = aq_inner( object )
             parent = aq_parent( inner )
 
@@ -188,6 +201,7 @@
             new = getattr( object, 'im_self', None )
 
             if new is not None:
+
                 object = aq_inner( new )
                 continue
 
@@ -195,6 +209,9 @@
 
         return roles
 
+
+
+
 classImplements(LocalRolesManager,
                 ILocalRolesPlugin, *implementedBy(LocalRolePlugin))
 

Modified: zope-plonepas/trunk/plugins/property.py
===================================================================
--- zope-plonepas/trunk/plugins/property.py	2007-02-09 14:47:50 UTC (rev 661)
+++ zope-plonepas/trunk/plugins/property.py	2007-02-09 14:48:30 UTC (rev 662)
@@ -14,7 +14,7 @@
 ##############################################################################
 """
 Mutable Property Provider
-$Id: property.py 30156 2006-09-09 01:37:59Z hannosch $
+$Id: property.py 19381 2006-02-16 01:18:52Z alecm $
 """
 from sets import Set
 
@@ -46,7 +46,6 @@
 manage_addZODBMutablePropertyProviderForm = DTMLFile(
     "../zmi/MutablePropertyProviderForm", globals())
 
-
 class ZODBMutablePropertyProvider(BasePlugin):
     """Storage for mutable properties in the ZODB for users/groups.
 

Modified: zope-plonepas/trunk/plugins/role.py
===================================================================
--- zope-plonepas/trunk/plugins/role.py	2007-02-09 14:47:50 UTC (rev 661)
+++ zope-plonepas/trunk/plugins/role.py	2007-02-09 14:48:30 UTC (rev 662)
@@ -17,14 +17,16 @@
 is a member of, in addition to the explicit roles assigned directly
 to the principal.
 
-$Id: role.py 30156 2006-09-09 01:37:59Z hannosch $
+$Id: role.py 32095 2006-10-20 20:38:17Z rossp $
 """
 
 from AccessControl import ClassSecurityInfo
 from Globals import DTMLFile, InitializeClass
 from Acquisition import aq_parent, aq_inner
 
-from Products.PluggableAuthService.utils import classImplements, implementedBy
+from zope.interface import implementedBy
+
+from Products.PluggableAuthService.utils import classImplements
 from Products.PluggableAuthService.plugins.ZODBRoleManager \
      import ZODBRoleManager
 
@@ -47,7 +49,6 @@
 manage_addGroupAwareRoleManagerForm = DTMLFile(
     '../zmi/GroupAwareRoleManagerForm', globals())
 
-
 class GroupAwareRoleManager( ZODBRoleManager ):
 
     meta_type = "Group Aware Role Manager"
@@ -71,6 +72,7 @@
                 except KeyError:
                     pass
 
+
     security.declareProtected( ManageUsers, 'assignRolesToPrincipal' )
     def assignRolesToPrincipal( self, roles, principal_id ):
         """ Assign a specific set of roles, and only those roles, to a principal.
@@ -99,6 +101,7 @@
             roles.extend( self._principal_roles.get( pid, () ) )
         return tuple( unique( roles ) )
 
+
     ## implement IAssignRoleCapability
 
     def getRoleInfo(self, role_id):

Modified: zope-plonepas/trunk/plugins/user.py
===================================================================
--- zope-plonepas/trunk/plugins/user.py	2007-02-09 14:47:50 UTC (rev 661)
+++ zope-plonepas/trunk/plugins/user.py	2007-02-09 14:48:30 UTC (rev 662)
@@ -15,18 +15,19 @@
 """
 ZODB based user manager with introspection and management interfaces.
 
-$Id: user.py 30156 2006-09-09 01:37:59Z hannosch $
+$Id: user.py 32095 2006-10-20 20:38:17Z rossp $
 """
 
 from AccessControl import ClassSecurityInfo, AuthEncoding
 from Globals import InitializeClass, DTMLFile
 
+from zope.interface import implementedBy
+
 from Products.PlonePAS.interfaces.plugins import IUserManagement, IUserIntrospection
 from Products.PlonePAS.interfaces.capabilities import IDeleteCapability, IPasswordSetCapability
 
 from Products.PluggableAuthService.utils import createViewName
 from Products.PluggableAuthService.utils import classImplements
-from Products.PluggableAuthService.utils import implementedBy
 from Products.PluggableAuthService.plugins.ZODBUserManager import ZODBUserManager as BasePlugin
 
 manage_addUserManagerForm = DTMLFile('../zmi/UserManagerForm',
@@ -50,6 +51,7 @@
     """
 
     meta_type = 'User Manager'
+
     security = ClassSecurityInfo()
 
     def addUser(self, user_id, login_name, password):

Modified: zope-plonepas/trunk/sheet.py
===================================================================
--- zope-plonepas/trunk/sheet.py	2007-02-09 14:47:50 UTC (rev 661)
+++ zope-plonepas/trunk/sheet.py	2007-02-09 14:48:30 UTC (rev 662)
@@ -17,7 +17,7 @@
 
 also a property schema type registry which is extensible.
 
-$Id: sheet.py 14077 2005-11-18 15:03:37Z wichert $
+$Id: sheet.py 35196 2006-12-29 21:50:54Z wichert $
 """
 
 from types import StringTypes, BooleanType, IntType

Modified: zope-plonepas/trunk/storage.py
===================================================================
--- zope-plonepas/trunk/storage.py	2007-02-09 14:47:50 UTC (rev 661)
+++ zope-plonepas/trunk/storage.py	2007-02-09 14:48:30 UTC (rev 662)
@@ -17,7 +17,7 @@
 
 main use.. cmfmember integration w/ properties providers
 
-$Id: storage.py 14081 2005-11-19 06:03:38Z wichert $
+$Id: storage.py 35196 2006-12-29 21:50:54Z wichert $
 """
 
 from AccessControl import ClassSecurityInfo

Modified: zope-plonepas/trunk/tests/cookie_auth.txt
===================================================================
--- zope-plonepas/trunk/tests/cookie_auth.txt	2007-02-09 14:47:50 UTC (rev 661)
+++ zope-plonepas/trunk/tests/cookie_auth.txt	2007-02-09 14:48:30 UTC (rev 662)
@@ -2,7 +2,8 @@
 ====================
 
   >>> import base64
-  >>> from Products.PluggableAuthService.utils import implementedBy
+  >>> from urllib import quote
+  >>> from zope.interface import implementedBy
   >>> from Interface.Implements import flattenInterfaces
   >>> from Products.PloneTestCase.PloneTestCase import portal_name
 
@@ -108,5 +109,16 @@
   >>> print http(r"""
   ... GET /%s/manage HTTP/1.1
   ... Cookie: __ac=%s;
-  ... """ % (portal_name, encoded), handle_errors=False)
+  ... """ % (portal_name, quote(encoded)), handle_errors=False)
   HTTP/1.1 200 OK...
+
+The cookie set by PlonePAS should be URL-quoted.
+
+  >>> print http(r"""
+  ... GET /%s/logged_in HTTP/1.1
+  ... Cookie: __ac=%s
+  ... """ % (portal_name, quote(encoded)), handle_errors=False)
+  HTTP/1.1 200 OK
+  ...
+  Set-Cookie: __ac="Og%3D%3D"; Path=/...
+

Modified: zope-plonepas/trunk/tests/test_basic_ops.py
===================================================================
--- zope-plonepas/trunk/tests/test_basic_ops.py	2007-02-09 14:47:50 UTC (rev 661)
+++ zope-plonepas/trunk/tests/test_basic_ops.py	2007-02-09 14:48:30 UTC (rev 662)
@@ -13,7 +13,7 @@
 #
 ##############################################################################
 """
-$Id: test_basic_ops.py 25193 2006-06-20 19:40:55Z wichert $
+$Id: test_basic_ops.py 33814 2006-11-17 01:19:02Z rafrombrc $
 """
 
 import os, sys
@@ -133,6 +133,17 @@
         self.failUnless("created_user1" in usernames,
                         "'created_user1' not in %s" % usernames)
 
+    def test_searchMissingInfo(self):
+        self.createUser("created_user1")
+        self.createUser("created_user2")
+        mt = self.portal.portal_membership
+        retlist = mt.searchForMembers(REQUEST=None, email="does at notexist.com")
+        self.failIf(len(retlist) != 0)
+        retlist = mt.searchForMembers(REQUEST=None, name="Does NotExist")
+        self.failIf(len(retlist) != 0)
+        retlist = mt.searchForMembers(REQUEST=None, login="doesnotexist")
+        self.failIf(len(retlist) != 0)
+
     def test_setpw(self):
         # there is more than one place where one can set the password.
         # insane. anyway we have to check the patch in pas.py userSetPassword 

Modified: zope-plonepas/trunk/tests/test_doctests.py
===================================================================
--- zope-plonepas/trunk/tests/test_doctests.py	2007-02-09 14:47:50 UTC (rev 661)
+++ zope-plonepas/trunk/tests/test_doctests.py	2007-02-09 14:48:30 UTC (rev 662)
@@ -13,7 +13,7 @@
 #
 ##############################################################################
 """
-$Id: test_doctests.py 18307 2006-01-22 17:28:37Z alecm $
+$Id: test_doctests.py 32811 2006-11-06 14:01:12Z shh42 $
 """
 import os, sys
 
@@ -24,12 +24,15 @@
 import unittest
 from Testing import ZopeTestCase
 from Products.PloneTestCase.PloneTestCase import FunctionalTestCase
+from Products.PloneTestCase.PloneTestCase import setupPloneSite
 
 from Products.CMFCore.utils import getToolByName
 
 from zExceptions.ExceptionFormatter import format_exception
 from ZPublisher.HTTPResponse import HTTPResponse
 
+setupPloneSite()
+
 # Silence Plone's handling of exceptions
 orig_exception = HTTPResponse.exception
 def exception(self, **kw):

Modified: zope-plonepas/trunk/tests/test_groups_tool.py
===================================================================
--- zope-plonepas/trunk/tests/test_groups_tool.py	2007-02-09 14:47:50 UTC (rev 661)
+++ zope-plonepas/trunk/tests/test_groups_tool.py	2007-02-09 14:48:30 UTC (rev 662)
@@ -13,7 +13,7 @@
 #
 ##############################################################################
 """
-$Id: test_groups_tool.py 24131 2006-05-31 04:54:21Z alecm $
+$Id: test_groups_tool.py 34143 2006-11-27 05:52:45Z alecm $
 """
 
 import os, sys
@@ -68,6 +68,17 @@
         self.failUnless(isinstance(group, GroupData))
         self.failUnless(isinstance(aq_parent(group), PloneGroup))
 
+    def test_group_cannot_have_same_id_as_member(self):
+        mt = getToolByName(self.portal, 'portal_membership')
+        mt.addMember('groupconflict', 'pw', ['Member'], [],
+                     {'email': 'member1 at host.com',
+                      'title': 'Member #1'})
+        success = self.gt.addGroup('groupconflict', ['Reviewer'], [],
+                                   {'email': 'group1 at host.com',
+                                    'title': 'Group #1'})
+        self.failIf(success, 'Should not be able to add group with same id as '
+                    'user')
+
 class GroupWorkspacesTest(PlonePASTestCase):
 
     def afterSetUp(self):

Modified: zope-plonepas/trunk/tools/groupdata.py
===================================================================
--- zope-plonepas/trunk/tools/groupdata.py	2007-02-09 14:47:50 UTC (rev 661)
+++ zope-plonepas/trunk/tools/groupdata.py	2007-02-09 14:48:30 UTC (rev 662)
@@ -13,18 +13,20 @@
 #
 ##############################################################################
 """
-$Id: groupdata.py 24813 2006-06-13 13:57:58Z wichert $
+$Id: groupdata.py 32095 2006-10-20 20:38:17Z rossp $
 """
 from Globals import InitializeClass
 from Acquisition import aq_base
 from AccessControl import ClassSecurityInfo
 from AccessControl import Unauthorized
 
+from zope.interface import implementedBy
+
 from Products.CMFPlone.GroupDataTool import GroupDataTool as BaseGroupDataTool
 from Products.GroupUserFolder.GroupDataTool import GroupData as BaseGroupData
 from Products.GroupUserFolder.GroupDataTool import _marker
 
-from Products.PluggableAuthService.utils import classImplements, implementedBy
+from Products.PluggableAuthService.utils import classImplements
 from Products.PluggableAuthService.interfaces.authservice \
      import IPluggableAuthService
 

Modified: zope-plonepas/trunk/tools/groups.py
===================================================================
--- zope-plonepas/trunk/tools/groups.py	2007-02-09 14:47:50 UTC (rev 661)
+++ zope-plonepas/trunk/tools/groups.py	2007-02-09 14:48:30 UTC (rev 662)
@@ -13,7 +13,7 @@
 #
 ##############################################################################
 """
-$Id: groups.py 26126 2006-07-15 11:52:51Z wichert $
+$Id: groups.py 34143 2006-11-27 05:52:45Z alecm $
 """
 import sys
 import logging
@@ -25,13 +25,15 @@
 from Globals import InitializeClass
 from OFS.SimpleItem import SimpleItem
 
+from zope.interface import implementedBy
+
 from Products.CMFPlone import ToolNames
 from Products.CMFPlone.GroupsTool import GroupsTool as PloneGroupsTool
 from Products.CMFCore.utils import getToolByName, UniqueObject
 
 from Products.PlonePAS.interfaces import group as igroup
 from Products.PluggableAuthService.interfaces.plugins import IRoleAssignerPlugin
-from Products.PluggableAuthService.utils import classImplements, implementedBy
+from Products.PluggableAuthService.utils import classImplements
 from Products.PluggableAuthService.PluggableAuthService import \
                                     _SWALLOWABLE_PLUGIN_EXCEPTIONS
 from Products.GroupUserFolder.GroupsToolPermissions import ViewGroups, DeleteGroups, ManageGroups
@@ -63,6 +65,10 @@
         if groups is None:
             groups = []
 
+        # Check to see if a user with the id already exists fail if it does
+        results = self.acl_users.searchPrincipals(id=id)
+        if results:
+            return 0
         if not managers:
             raise NotSupported, 'No plugins allow for group management'
         for mid, manager in managers:

Modified: zope-plonepas/trunk/tools/memberdata.py
===================================================================
--- zope-plonepas/trunk/tools/memberdata.py	2007-02-09 14:47:50 UTC (rev 661)
+++ zope-plonepas/trunk/tools/memberdata.py	2007-02-09 14:48:30 UTC (rev 662)
@@ -13,12 +13,14 @@
 #
 ##############################################################################
 """
-$Id: memberdata.py 30156 2006-09-09 01:37:59Z hannosch $
+$Id: memberdata.py 32095 2006-10-20 20:38:17Z rossp $
 """
 from Globals import InitializeClass
 from Acquisition import aq_base
 from AccessControl import ClassSecurityInfo
 
+from zope.interface import implementedBy
+
 from Products.CMFPlone.MemberDataTool import MemberDataTool as BaseMemberDataTool
 
 from Products.CMFCore.MemberDataTool import MemberData as BaseMemberData
@@ -28,7 +30,7 @@
 from Products.CMFCore.MemberDataTool import CleanupTemp
 from Products.CMFPlone.MemberDataTool import _marker
 
-from Products.PluggableAuthService.utils import classImplements, implementedBy
+from Products.PluggableAuthService.utils import classImplements
 from Products.PluggableAuthService.interfaces.authservice import IPluggableAuthService
 from Products.PluggableAuthService.interfaces.plugins import IPropertiesPlugin, IRoleAssignerPlugin
 
@@ -81,6 +83,15 @@
         # the user as context.
         return m.__of__(self).__of__(u)
 
+#    ## use the default implementation instead; this doesn't meet the original expectation
+#    ## (I also don't think this is used anywhere!)
+#    def searchFulltextForMembers(self, s):
+#        """PAS-specific search for members by id, email, full name.
+#        """
+#        acl_users = getToolByName( self, 'acl_users')
+#        return acl_users.searchUsers(name=s, exact_match=False)
+#        # I don't think this is right: we need to return Members
+
     def deleteMemberData(self, member_id):
         """ Delete member data of specified member.
         """
@@ -111,6 +122,7 @@
     def _getPlugins(self):
         return self.acl_users.plugins
 
+
 InitializeClass(MemberDataTool)
 
 
@@ -198,10 +210,12 @@
         # delegate back to the base implementation.
         return BaseMemberData.getProperty(self, id, default)
 
+
     def getPassword(self):
         """Returns None. Present to avoid NotImplementedError."""
         return None
 
+
     ## IManageCapabilities methods
 
     def canDelete(self):
@@ -215,6 +229,7 @@
                     return manager.allowDeletePrincipal(self.getId())
         return 0
 
+
     def canPasswordSet(self):
         """True iff user can change password."""
         # IUserManagement provides doChangeUser
@@ -240,6 +255,7 @@
             return mdata.hasProperty(prop_name)
         return 0
 
+
     def canWriteProperty(self, prop_name):
         """True iff the member/group property named in 'prop_name'
         can be changed.
@@ -263,6 +279,7 @@
                     break  # shadowed by read-only
         return 0
 
+
     def canAddToGroup(self, group_id):
         """True iff member can be added to group."""
         # IGroupManagement provides IGroupCapability
@@ -297,6 +314,8 @@
                     return manager.allowRoleAssign(self.getId(), role_id)
         return 0
 
+
+
     ## plugin getters
 
     security.declarePrivate('_getPlugins')

Modified: zope-plonepas/trunk/tools/membership.py
===================================================================
--- zope-plonepas/trunk/tools/membership.py	2007-02-09 14:47:50 UTC (rev 661)
+++ zope-plonepas/trunk/tools/membership.py	2007-02-09 14:48:30 UTC (rev 662)
@@ -13,12 +13,13 @@
 #
 ##############################################################################
 """
-$Id: membership.py 30156 2006-09-09 01:37:59Z hannosch $
+$Id: membership.py 32816 2006-11-06 15:37:46Z wichert $
 """
 
 import logging
 from DateTime import DateTime
 from sets import Set
+from types import StringTypes
 
 from Globals import InitializeClass
 
@@ -27,10 +28,18 @@
 from Products.CMFCore.utils import getToolByName
 from Products.CMFPlone.MembershipTool import MembershipTool as BaseMembershipTool
 
-from Products.CMFPlone.utils import _createObjectByType
+logger = logging.getLogger('Plone')
+
+try:
+    # Plone 2.1
+    from Products.CMFPlone.utils import utranslate as translate
+    from Products.CMFPlone.utils import _createObjectByType
+except ImportError:
+    # Plone 2.0
+    from Products.CMFPlone.PloneUtilities import translate
+    from Products.CMFPlone.PloneUtilities import _createObjectByType
 from Products.PlonePAS.utils import cleanId
 
-logger = logging.getLogger('Plone')
 
 class MembershipTool(BaseMembershipTool):
     """PAS-based customization of MembershipTool.
@@ -65,6 +74,7 @@
             member = self.getMemberById(id)
             member.setMemberProperties(properties)
 
+
     security.declarePublic('searchForMembers')
     def searchForMembers(self, REQUEST=None, **kw):
         """Hacked up version of Plone searchForMembers.
@@ -217,7 +227,7 @@
             if last_login_time:
                 last_login = member.getProperty('last_login_time', '')
 
-                if isinstance(last_login, basestring):
+                if type(last_login) in StringTypes:
                     # value is a string when mem hasn't yet logged in
                     mem_last_login_time = DateTime(last_login or '2000/01/01')
                 else:
@@ -262,12 +272,15 @@
 
         if members is None:
             # no members area
+            # XXX exception?
             logger.debug('createMemberarea: members area does not exist.')
             return
 
+
         safe_member_id = cleanId(member_id)
         if hasattr(members, safe_member_id):
             # has already this member
+            # XXX exception?
             logger.debug(
                 'createMemberarea: member area '
                 'for %r already exists.' % safe_member_id)
@@ -287,6 +300,7 @@
 
         # Get the user object from acl_users
         acl_users = self.__getPUS()
+        # SdS: According to Leo, our MOTUId, we should use getUserById here.
         user = acl_users.getUserById(member_id)
         if user is not None:
             user = user.__of__(acl_users)
@@ -297,8 +311,41 @@
                 raise NotImplementedError, \
                     'cannot get user for member area creation'
 
-        member_object = self.getMemberById(member_id)
+        ## translate the default content
 
+        # get some translation interfaces
+
+        translation_service = getToolByName(self, 'translation_service', None)
+        if translation_service is None:
+            # test environ, some other aberent sitch
+            return
+
+        utranslate = translation_service.utranslate
+        encode = translation_service.encode
+
+        # convert the member_id to unicode type
+        umember_id = translation_service.asunicodetype(member_id, errors='replace')
+
+        member_folder_title = utranslate(
+            'plone', 'title_member_folder',
+            {'member': umember_id}, self,
+            default = "%s" % umember_id)
+
+        member_folder_description = utranslate(
+            'plone', 'description_member_folder',
+            {'member': umember_id}, self,
+            default = '')
+
+        member_folder_index_html_title = utranslate(
+            'plone', 'title_member_folder_index_html',
+            {'member': umember_id}, self,
+            default = "Home page for %s" % umember_id)
+
+        # encode strings to site encoding as we dont like to store type unicode atm
+        member_folder_title = encode(member_folder_title, errors='replace')
+        member_folder_description = encode(member_folder_description, errors='replace')
+        member_folder_index_html_title = encode(member_folder_index_html_title, errors='replace')
+
         ## Modify member folder
         member_folder = self.getHomeFolder(member_id)
         # Grant Ownership and Owner role to Member
@@ -306,8 +353,8 @@
         member_folder.__ac_local_roles__ = None
         member_folder.manage_setLocalRoles(member_id, ['Owner'])
         # We use ATCT now use the mutators
-        fullname = member_object.getProperty('fullname')
-        member_folder.setTitle(fullname or member_id)
+        member_folder.setTitle(member_folder_title)
+        member_folder.setDescription(member_folder_description)
         member_folder.reindexObject()
 
         if not minimal:
@@ -315,14 +362,17 @@
             # get the text from portal_skins automagically
             homepageText = getattr(self, 'homePageText', None)
             if homepageText:
+                member_object = self.getMemberById(member_id)
                 portal = getToolByName(self, 'portal_url')
                 # call the page template
                 content = homepageText(member=member_object, portal=portal).strip()
                 _createObjectByType('Document', member_folder, id='index_html')
                 hpt = getattr(member_folder, 'index_html')
                 # edit title, text and format
-                hpt.setTitle(fullname or member_id)
+                # XXX
+                hpt.setTitle(member_folder_index_html_title)
                 if hpt.meta_type == 'Document':
+                    # CMFDefault Document
                     hpt.edit(text_format='structured-text', text=content)
                 else:
                     hpt.update(text=content)
@@ -356,6 +406,7 @@
 
         return cleanId(id)
 
+
     security.declarePublic('getHomeFolder')
     def getHomeFolder(self, id=None, verifyPermission=0):
         """ Return a member's home folder object, or None.
@@ -393,5 +444,6 @@
         safe_id = self._getSafeMemberId(id)
         return BaseMembershipTool.changeMemberPortrait(self, portrait, safe_id)
 
+
 InitializeClass(MembershipTool)
 

Modified: zope-plonepas/trunk/tools/plonetool.py
===================================================================
--- zope-plonepas/trunk/tools/plonetool.py	2007-02-09 14:47:50 UTC (rev 661)
+++ zope-plonepas/trunk/tools/plonetool.py	2007-02-09 14:48:30 UTC (rev 662)
@@ -13,7 +13,7 @@
 #
 ##############################################################################
 """
-$Id: plonetool.py 30156 2006-09-09 01:37:59Z hannosch $
+$Id: plonetool.py 13648 2005-11-02 23:34:27Z jccooper $
 """
 from Globals import InitializeClass
 
@@ -44,6 +44,7 @@
             if getattr(obj, '__ac_local_roles_block__', None):
                 obj.__ac_local_roles_block__ = None
 
+
         # Reindex the whole stuff.
         obj.reindexObjectSecurity()
 

Modified: zope-plonepas/trunk/utils.py
===================================================================
--- zope-plonepas/trunk/utils.py	2007-02-09 14:47:50 UTC (rev 661)
+++ zope-plonepas/trunk/utils.py	2007-02-09 14:48:30 UTC (rev 662)
@@ -13,7 +13,7 @@
 #
 ##############################################################################
 """
-$Id: utils.py 18805 2006-02-01 01:06:02Z jccooper $
+$Id: utils.py 35196 2006-12-29 21:50:54Z wichert $
 """
 
 from Products.CMFCore.utils import getToolByName

Modified: zope-plonepas/trunk/version.txt
===================================================================
--- zope-plonepas/trunk/version.txt	2007-02-09 14:47:50 UTC (rev 661)
+++ zope-plonepas/trunk/version.txt	2007-02-09 14:48:30 UTC (rev 662)
@@ -1 +1 @@
-2.1
+2.2




More information about the pkg-zope-commits mailing list