Commit ad775741 authored by Jérome Perrin's avatar Jérome Perrin

workaround so that managers only see their USER priority preferences.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6197 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 64bfe34e
......@@ -38,6 +38,7 @@ from Products.ERP5Type.Utils import convertToUpperCase
from Products.ERP5Type.Accessor.TypeDefinition import list_types
from Products.ERP5Form.Document.Preference import Preference
from Products.ERP5Form import _dtmldir
from Products.ERP5Form.Document.Preference import Priority
from MethodObject import Method
......@@ -169,10 +170,18 @@ class PreferenceTool(BaseTool):
# XXX will also cause problems with Manager (too long)
# XXX For manager, create a manager specific preference
# or better solution
user = getToolByName(self, 'portal_membership').getAuthenticatedMember()
user_is_manager = 'Manager' in user.getRolesInContext(self)
for pref in self.searchFolder(spec=('ERP5 Preference', )) :
pref = pref.getObject()
if pref.getPreferenceState() == 'enabled' :
prefs.append(pref)
if pref is not None and pref.getPreferenceState() == 'enabled' :
# XXX quick workaround so that manager only see user preference
# they actually own.
if user_is_manager and pref.getPriority() == Priority.USER :
if user.allowed(pref, ('Owner',)):
prefs.append(pref)
else :
prefs.append(pref)
prefs.sort(lambda b, a: cmp(a.getPriority(), b.getPriority()))
return prefs
......
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