Commit fddb39e7 authored by Julien Muchembled's avatar Julien Muchembled

Interfaces for roles

git-svn-id: https://svn.erp5.org/repos/public/erp5/sandbox/portal_types@29254 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 86f086de
......@@ -33,6 +33,10 @@ import unittest
# this list can be generated automatically using introspection or can be set
# manually and treated as reference to what implements what
implements_tuple_list = [
## ERP5Type
('ERP5Type.ERP5Type.ERP5TypeInformation', 'ILocalRoleAssignor'),
('RoleInformation', 'ILocalRoleGenerator'),
## ERP5
('BusinessPath', 'IArrowBase'),
('BusinessPath', 'IBusinessPath'),
('BusinessPath', 'ICategoryAccessProvider'),
......@@ -67,13 +71,14 @@ class TestERP5Interfaces(ERP5TypeTestCase):
from Products.ERP5.interfaces.transformation import IAggregatedAmountList
from Products.ERP5.AggregatedAmountList import AggregatedAmountList
verifyClass(IAggregatedAmountList, AggregatedAmountList)
def makeTestMethod(document, interface):
"""Common method which checks if documents implements interface"""
def testMethod(self):
_temp = __import__('Products.ERP5Type.Document.%s' % document, globals(),
locals(), ['%s' % document])
Document = getattr(_temp, document)
parts = document.rsplit('.', 1)
module = len(parts) > 1 and parts[0] or 'ERP5Type.Document.' + parts[-1]
_temp = __import__('Products.' + module, globals(), locals(), parts[-1:])
Document = getattr(_temp, parts[-1])
_temp = __import__('Products.ERP5Type.interfaces', globals(), locals(),
['%s' % interface])
Interface = getattr(_temp, interface)
......
......@@ -13,6 +13,7 @@
""" Information about customizable roles.
"""
import zope.interface
from AccessControl import ClassSecurityInfo
from Acquisition import aq_base
from Globals import InitializeClass
......@@ -21,7 +22,7 @@ from OFS.SimpleItem import SimpleItem
from Products.CMFCore.utils import getToolByName
from Products.CMFCore.Expression import Expression
from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5Type import interfaces, Permissions, PropertySheet
from Products.ERP5Type.ERP5Type \
import ERP5TYPE_SECURITY_GROUP_ID_GENERATION_SCRIPT
from Products.ERP5Type.Permissions import AccessContentsInformation
......@@ -34,8 +35,6 @@ class RoleInformation(XMLObject):
Roles definitions defines local roles on ERP5Type documents. They are
applied by the updateLocalRolesOnDocument method.
"""
# ILocalRoleGenerator
meta_type = 'ERP5 Role Information'
portal_type = 'Role Information'
add_permission = Permissions.AddPortalContent
......@@ -45,6 +44,8 @@ class RoleInformation(XMLObject):
security = ClassSecurityInfo()
security.declareObjectProtected(AccessContentsInformation)
zope.interface.implements(interfaces.ILocalRoleGenerator)
# Declarative properties
property_sheets = ( PropertySheet.CategoryCore
, PropertySheet.DublinCore
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment