Commit 370b098d authored by Jérome Perrin's avatar Jérome Perrin

add assignRoleToSecurityGroupOnParent method to call assignRoleToSecurityGroup...

add assignRoleToSecurityGroupOnParent method to call assignRoleToSecurityGroup on the parent object, from unrestricted code.
The permission is necessary on the role definition object, not the parent object.
As a bonus, this will no longuer fail if the acquisition parent is not the real parent.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9128 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9d0cfe96
......@@ -26,8 +26,11 @@
##############################################################################
from AccessControl import ClassSecurityInfo
from Acquisition import aq_parent
from Acquisition import aq_inner
from Products.CMFCore.utils import getToolByName
from Products.CMFCore.WorkflowCore import WorkflowMethod
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5Type.XMLObject import XMLObject
......@@ -48,4 +51,14 @@ class RoleDefinition(XMLObject):
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.RoleDefinition
)
\ No newline at end of file
)
security.declareProtected(Permissions.ModifyPortalContent,
'assignRoleToSecurityGroupOnParent')
def assignRoleToSecurityGroupOnParent(self, **kw):
"""Assign roles to security group on the parent.
We redefine this method here, because we want the security check to be
performed on the role definition object itself, and not the parent. """
aq_parent(aq_inner(self)).assignRoleToSecurityGroup(**kw)
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