[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/RoleService - Role.py:1.1.2.1 RoleService.py:1.1.2.1 __init__.py:1.1.2.1 role-service.zcml:1.1.2.1
Jim Fulton
jim@zope.com
Mon, 4 Mar 2002 17:19:29 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/RoleService
In directory cvs.zope.org:/tmp/cvs-serv32696/RoleService
Added Files:
Tag: Zope-3x-branch
Role.py RoleService.py __init__.py role-service.zcml
Log Message:
Added first-cut role service
=== Added File Zope3/lib/python/Zope/App/OFS/RoleService/Role.py ===
##############################################################################
#
# 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: Role.py,v 1.1.2.1 2002/03/04 22:19:28 jim Exp $
"""
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
=== Added File Zope3/lib/python/Zope/App/OFS/RoleService/RoleService.py ===
##############################################################################
#
# 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: RoleService.py,v 1.1.2.1 2002/03/04 22:19:28 jim Exp $
"""
from Persistence import Persistent
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
class IRoleService(IRoleService, IContainer):
"""TTW manageable role service"""
class RoleService(BTreeContainer):
__implements__ = IRoleService
############################################################
# Implementation methods for interface
# Zope.App.Security.IRoleService.
def getRole(self, rid):
'''See interface IRoleService'''
try: return self.getObject(rid)
except KeyError:
# We failed locally, delegate tyo a higher-level service.
# XXX We really needs context binding to make this work right.
# For now, we'll just delagate to the global registry.
return roleRegistry.getRole(rid)
def getRoles(self):
'''See interface IRoleService'''
# XXX We really needs context binding to make this work right.
# For now, we'll just delagate to the global registry.
roles = list(roleRegistry.getRoles())
roles.extend(self.objectValues())
return roles
#
############################################################
=== Added File Zope3/lib/python/Zope/App/OFS/RoleService/__init__.py ===
=== Added File Zope3/lib/python/Zope/App/OFS/RoleService/role-service.zcml ===
<zopeConfigure
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'
>
<security:protectClass name="Zope.App.OFS.RoleService.">
<security:instances permission_id="Zope.Public" />
<security:protect interface="Zope.App.Security.IRoleService."
permission_id="Zope.Security" />
<security:protect interface="Zope.App.OFS.Container.IContainer."
permission_id="Zope.ManageServices" />
</security:protectClass>
<security:protectClass name="Zope.App.OFS.RoleService.Role.">
<security:instances permission_id="Zope.Public" />
<security:protect interface="Zope.App.Security.IRole."
permission_id="Zope.Security" />
</security:protectClass>
<service:provideClass
name="Zope.App.OFS.RoleService."
permission_id="Zope.ManageServices"
title="Role Service"
/>
<factory component="Zope.App.OFS.RoleService.Role." />
<include package="Zope.App.OFS.RoleService.Views" file="views.zcml" />
</zopeConfigure>