[Erp5-report] r17159 - /erp5/trunk/products/ERP5Type/Base.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Oct 24 10:21:35 CEST 2007


Author: jerome
Date: Wed Oct 24 10:21:35 2007
New Revision: 17159

URL: http://svn.erp5.org?rev=17159&view=rev
Log:
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)


Modified:
    erp5/trunk/products/ERP5Type/Base.py

Modified: erp5/trunk/products/ERP5Type/Base.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Base.py?rev=17159&r1=17158&r2=17159&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Base.py (original)
+++ erp5/trunk/products/ERP5Type/Base.py Wed Oct 24 10:21:35 2007
@@ -1697,14 +1697,15 @@
 
   security.declareProtected( Permissions.AccessContentsInformation, 'getViewPermissionOwner' )
   def getViewPermissionOwner(self):
-    """
-      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
+    """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.
+    """
+    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




More information about the Erp5-report mailing list