[CMF-checkins] CVS: Products/CMFCore/tests/base - dummy.py:1.20.2.1 security.py:1.6.20.1

Yvo Schubbe y.2004_ at wcm-solutions.de
Tue Aug 24 15:14:17 EDT 2004


Update of /cvs-repository/Products/CMFCore/tests/base
In directory cvs.zope.org:/tmp/cvs-serv4333/CMFCore/tests/base

Modified Files:
      Tag: CMF-1_5-branch
	dummy.py security.py 
Log Message:
- added listDAVObjects
- refactored and added some PortalFolder tests


=== Products/CMFCore/tests/base/dummy.py 1.20 => 1.20.2.1 ===
--- Products/CMFCore/tests/base/dummy.py:1.20	Sun Aug  8 14:29:38 2004
+++ Products/CMFCore/tests/base/dummy.py	Tue Aug 24 15:13:47 2004
@@ -1,7 +1,25 @@
+##############################################################################
+#
+# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+""" Unit test dummies.
+
+$Id$
+"""
+
 from Acquisition import Implicit, aq_base, aq_inner, aq_parent
 from OFS.SimpleItem import Item
-from Products.CMFCore.PortalContent import PortalContent
+
 from Products.CMFCore.ActionProviderBase import ActionProviderBase
+from Products.CMFCore.PortalContent import PortalContent
 from security import OmnipotentUser
 
 
@@ -184,7 +202,13 @@
         return self
 
     def unrestrictedTraverse(self, path, default=None, restricted=0):
-        return self.acl_users
+        if path == ['acl_users']:
+            return self.acl_users
+        else:
+            obj = self
+            for id in path[3:]:
+                obj = getattr(obj, id)
+            return obj
 
     def userdefined_roles(self):
         return ('Member', 'Reviewer')


=== Products/CMFCore/tests/base/security.py 1.6 => 1.6.20.1 ===
--- Products/CMFCore/tests/base/security.py:1.6	Wed Nov 19 04:48:37 2003
+++ Products/CMFCore/tests/base/security.py	Tue Aug 24 15:13:47 2004
@@ -1,4 +1,19 @@
-from types import StringType, UnicodeType
+##############################################################################
+#
+# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+""" Unit test security.
+
+$Id$
+"""
 
 from AccessControl.PermissionRole import rolesForPermissionOn
 from Acquisition import Implicit
@@ -20,13 +35,16 @@
                 , roles=None
                 , *args
                 , **kw):
-        return 1
-    
+        if name and name.startswith('hidden'):
+            return False
+        else:
+            return True
+
     def checkPermission(self, permission, object, context):
         if permission == 'forbidden permission':
             return 0
         roles = rolesForPermissionOn(permission, object)
-        if type(roles) in (StringType, UnicodeType):
+        if isinstance(roles, basestring):
             roles=[roles]
         return context.user.allowed(object, roles)
 
@@ -37,7 +55,7 @@
     """
     def getId( self ):
         return 'all_powerful_Oz'
-    
+
     getUserName = getId
 
     def allowed( self, object, object_roles=None ):
@@ -57,7 +75,7 @@
 
     def getId( self ):
         return 'high_roller'
-    
+
     getUserName = getId
 
     def allowed( self, object, object_roles=None ):
@@ -74,7 +92,7 @@
     """
     def getId( self ):
         return 'Anonymous User'
-    
+
     getUserName = getId
 
     def has_permission(self, permission, obj):



More information about the CMF-checkins mailing list