Commit 39fc4307 authored by Jérome Perrin's avatar Jérome Perrin

Search catalog using portal_type argument.

use getProperty instead of getPreferenceState, because it's safer (if
this method fail, we cannot use view interface)



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@7467 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent bffa30cb
...@@ -155,9 +155,10 @@ class PreferenceTool(BaseTool): ...@@ -155,9 +155,10 @@ class PreferenceTool(BaseTool):
# or better solution # or better solution
user = getToolByName(self, 'portal_membership').getAuthenticatedMember() user = getToolByName(self, 'portal_membership').getAuthenticatedMember()
user_is_manager = 'Manager' in user.getRolesInContext(self) user_is_manager = 'Manager' in user.getRolesInContext(self)
for pref in self.searchFolder(spec=('ERP5 Preference', )) : for pref in self.searchFolder(portal_type='Preference') :
pref = pref.getObject() pref = pref.getObject()
if pref is not None and pref.getPreferenceState() == 'enabled' : if pref is not None and pref.getProperty('preference_state',
'broken') == 'enabled' :
# XXX quick workaround so that manager only see user preference # XXX quick workaround so that manager only see user preference
# they actually own. # they actually own.
if user_is_manager and pref.getPriority() == Priority.USER : if user_is_manager and pref.getPriority() == Priority.USER :
......
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