Commit 7e102a69 authored by Jérome Perrin's avatar Jérome Perrin

sometimes the class defined permission is None, sometimes it's a proper

permissionRole (when security.declareProtected has been used). The later was
not supported by 38378. It was the cause of cryptic "TypeError: iterable
argument required" that occured in some tests.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@38412 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7778f0f5
......@@ -36,6 +36,7 @@ from zLOG import LOG
from Products.ERP5Type.Cache import CachingMethod
from Products.ERP5Type.PsycoWrapper import psyco
from AccessControl.ImplPython import rolesForPermissionOn
from AccessControl.PermissionRole import PermissionRole
# Creation of default constructor
class func_code: pass
......@@ -117,6 +118,8 @@ class Setter(Method):
# security on the class for generated methods.
class_role = getattr(im_self.__class__, name, im_self)
if class_role is not im_self:
if isinstance(class_role, PermissionRole):
return class_role.__of__(im_self)
return class_role
return rolesForPermissionOn(None, im_self, ('Manager',),
'_Modify_portal_content_Permission')
......@@ -199,6 +202,8 @@ class Getter(Method):
if roles is None:
class_role = getattr(im_self.__class__, name, im_self)
if class_role is not im_self:
if isinstance(class_role, PermissionRole):
return class_role.__of__(im_self)
return class_role
return rolesForPermissionOn(None, im_self, ('Manager',),
'_Access_contents_information_Permission')
......
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