[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/Services/RoleService - Role.py:1.2 RoleService.py:1.2 __init__.py:1.2 role-service.zcml:1.2

Jim Fulton jim@zope.com
Mon, 10 Jun 2002 19:28:42 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Services/RoleService
In directory cvs.zope.org:/tmp/cvs-serv17445/lib/python/Zope/App/OFS/Services/RoleService

Added Files:
	Role.py RoleService.py __init__.py role-service.zcml 
Log Message:
Merged Zope-3x-branch into newly forked Zope3 CVS Tree.


=== Zope3/lib/python/Zope/App/OFS/Services/RoleService/Role.py 1.1 => 1.2 ===
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+# 
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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.
+# 
+##############################################################################
+"""
+
+Revision information:
+$Id$
+"""
+
+from Zope.App.Security.IRole import IRole
+from Zope.ComponentArchitecture.IFactory import IFactory
+from Zope.App.Security.RegisteredObject import RegisteredObject
+from Persistence import Persistent
+
+class Role(RegisteredObject, Persistent):
+    __implements__ = IRole
+    __class_implements__ = IFactory
+
+    def __init__(self):
+        super(Role, self).__init__('', '', '')
+    
+    def setId(self, id):
+        self._id = id
+        
+    def getInterfaces(self):
+        return self.__implements__
+
+


=== Zope3/lib/python/Zope/App/OFS/Services/RoleService/RoleService.py 1.1 => 1.2 ===
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+# 
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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.
+# 
+##############################################################################
+"""
+
+Revision information:
+$Id$
+"""
+from Zope.App.OFS.Container.BTreeContainer import BTreeContainer
+from Zope.App.Security.IRoleService import IRoleService
+from Zope.App.OFS.Container.IContainer import IContainer
+from Zope.App.Security.RoleRegistry import roleRegistry
+from Zope.ContextWrapper import ContextMethod
+from Zope.ComponentArchitecture import getNextService
+
+class ILocalRoleService(IRoleService, IContainer):
+    """TTW manageable role service"""
+
+class RoleService(BTreeContainer):
+
+    __implements__ =  ILocalRoleService
+
+    ############################################################
+    # Implementation methods for interface
+    # Zope.App.Security.IRoleService.
+
+    def getRole(wrapped_self, rid):
+        '''See interface IRoleService'''
+        try: return wrapped_self[rid]
+        except KeyError:
+            # We failed locally: delegate to a higher-level service.
+            sv= getNextService(wrapped_self, 'RoleService')
+            if sv: return sv.getRole(rid)
+            raise # will be original Key Error
+    
+    getRole=ContextMethod(getRole)
+
+    def getRoles(wrapped_self):
+        '''See interface IRoleService'''
+        roles = list(wrapped_self.values())
+        roleserv=getNextService(wrapped_self, 'RoleService')
+        if roleserv:
+            roles.extend(roleserv.getRoles())
+        return roles
+    
+    getRoles=ContextMethod(getRoles)
+
+    #
+    ############################################################


=== Zope3/lib/python/Zope/App/OFS/Services/RoleService/__init__.py 1.1 => 1.2 ===
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+# 
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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.
+# 
+##############################################################################
+


=== Zope3/lib/python/Zope/App/OFS/Services/RoleService/role-service.zcml 1.1 => 1.2 ===
+   xmlns='http://namespaces.zope.org/zope'
+   xmlns:security='http://namespaces.zope.org/security'
+   xmlns:zmi='http://namespaces.zope.org/zmi'
+   xmlns:browser='http://namespaces.zope.org/browser'
+
+   xmlns:service='http://namespaces.zope.org/service'
+>
+  <content class=".RoleService.">
+    <security:require
+        permission="Zope.Security"
+        interface="Zope.App.Security.IRoleService." />
+    <security:require
+        permission="Zope.ManageServices"
+        interface="Zope.App.OFS.Container.IContainer." />
+  </content>
+  
+  <content class=".Role.">
+    <security:require
+        permission="Zope.Security"
+        interface="Zope.App.Security.IRole." />
+  </content>
+
+  <service:factoryFromClass
+      id="RoleService"
+      class=".RoleService."
+      permission="Zope.ManageServices"
+      title="Role Service" />
+
+  <factory component=".Role." />
+
+  <include package=".Views" file="views.zcml" />
+
+</zopeConfigure>