Commit 278db66b authored by Jérome Perrin's avatar Jérome Perrin

Again, a change in getViewPermissionOwner: it no longuer uses the ownership,

put only the 'Owner' local role, as all security is managed with local roles.

Now it returns a user id with Owner local role, if Owner role as view
permission. (this is somehow undefined if you have more than one user with
Owner local role, but I doubt you want this)



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17159 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0dc5a1d1
......@@ -1697,14 +1697,15 @@ class Base( CopyContainer,
security.declareProtected( Permissions.AccessContentsInformation, 'getViewPermissionOwner' )
def getViewPermissionOwner(self):
"""Returns the user ID of the user with 'Owner' local role on this
document, if the Owner role has View permission.
If there is more than one Owner local role, the result is undefined.
"""
Returns the user ID of the owner if this user has View permission,
otherwise returns None.
"""
owner = self.getWrappedOwner()
if owner is not None and owner.has_permission(Permissions.View, self):
return str(owner)
return None
if 'Owner' in rolesForPermissionOn(Permissions.View, self):
owner_list = self.users_with_local_role('Owner')
if owner_list:
return owner_list[0]
# Private accessors for the implementation of relations based on
# categories
......
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