Commit 3b31ee4a authored by Aurel's avatar Aurel

propage params

define permission setOwnPassword for all members on preference tool


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16047 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c6032064
...@@ -124,14 +124,14 @@ class PreferenceMethod(Method): ...@@ -124,14 +124,14 @@ class PreferenceMethod(Method):
self._null = (None, '', (), []) self._null = (None, '', (), [])
def __call__(self, instance, *args, **kw): def __call__(self, instance, *args, **kw):
def _getPreference(user_name=None): def _getPreference(user_name=None, *args, **kw):
value = None value = None
for pref in instance._getSortedPreferenceList(): for pref in instance._getSortedPreferenceList(*args, **kw):
value = getattr(pref, self._preference_name, _marker) value = getattr(pref, self._preference_name, _marker)
if value is not _marker: if value is not _marker:
# If callable, store the return value. # If callable, store the return value.
if callable(value): if callable(value):
value = value() value = value(*args, **kw)
if value not in self._null: if value not in self._null:
break break
return value return value
...@@ -139,7 +139,7 @@ class PreferenceMethod(Method): ...@@ -139,7 +139,7 @@ class PreferenceMethod(Method):
id=self._preference_cache_id, id=self._preference_cache_id,
cache_factory='erp5_ui_short') cache_factory='erp5_ui_short')
user_name = getSecurityManager().getUser().getId() user_name = getSecurityManager().getUser().getId()
value = _getPreference(user_name=user_name) value = _getPreference(user_name=user_name, *args, **kw)
# XXX Preference Tool has a strange assumption that, even if # XXX Preference Tool has a strange assumption that, even if
# all values are null values, one of them must be returned. # all values are null values, one of them must be returned.
# Therefore, return a default value, only if explicitly specified, # Therefore, return a default value, only if explicitly specified,
...@@ -178,6 +178,8 @@ class PreferenceTool(BaseTool): ...@@ -178,6 +178,8 @@ class PreferenceTool(BaseTool):
['Member', 'Author', 'Manager']) ['Member', 'Author', 'Manager'])
item.manage_permission(Permissions.View, item.manage_permission(Permissions.View,
['Member', 'Auditor', 'Manager']) ['Member', 'Auditor', 'Manager'])
item.manage_permission(Permissions.SetOwnPassword,
['Member', 'Author', 'Manager'])
BaseTool.inheritedAttribute('manage_afterAdd')(self, item, container) BaseTool.inheritedAttribute('manage_afterAdd')(self, item, container)
security.declarePublic('getPreference') security.declarePublic('getPreference')
......
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