Ticket #8295 (closed Bug: fixed)
loosing local roles in @@sharing when searching users / groups
| Reported by: | awello | Owned by: | wichert |
|---|---|---|---|
| Priority: | minor | Milestone: | 3.1.5 |
| Component: | Users/Groups | Keywords: | |
| Cc: |
Description
in plone.app.workflow.browser -> sharing.py (in role_setting)
153 roles = [r for r in roles if entry.get('role_%s' % r, False)] 154 settings[(entry['id'], entry['type'])] = roles
should be:
153 anothername = [r for r in roles if entry.get('role_%s' % r, False)] 154 settings[(entry['id'], entry['type'])] = anothername
reason:
original code overwrites the roles-variable (line 150) (and so the table is loosing all the informations/settings about local roles )
Change History
comment:1 in reply to: ↑ description Changed 4 years ago by awello
comment:2 follow-up: ↓ 3 Changed 4 years ago by wichert
I don't see the problem here. The code is using the role settings from the request on purpose since those reflect the currently selected settings. This is important since the user may have modified them from the original settings and a search show not loose those changes.
comment:3 in reply to: ↑ 2 Changed 4 years ago by awello
Replying to wichert:
I don't see the problem here. The code is using the role settings from the request on purpose since those reflect the currently selected settings. This is important since the user may have modified them from the original settings and a search show not loose those changes.
in my testcase:
current_setting (before merging with requested) (see the roles for user "test2")
...snip ...
{'disabled': False, 'type': 'user', 'id': 'test2', 'roles': {u'Contributor': True, u'Reviewer': True, u'Editor': True, u'Reader': True}, 'title': 'test2'},
... snap ...
requested:
... snip ...
{'id': 'test2', 'role_Contributor': 'True', 'role_Editor': 'True', 'role_Reader': 'True', 'role_Reviewer': 'True', 'type': 'user'}
... snap ...
but then current_settings (after merging):
... snip ...
{'disabled': False, 'type': 'user', 'id': 'test2', 'roles': {u'Contributor': False, u'Reviewer': False, u'Editor': False, u'Reader': False}, 'title': 'test2'}
... snap ...
imho there shouls be True and not False for the roles ... in line 150 roles is set as:
roles = [r['id'] for r in self.roles()]
... but these roles are overwritten after the first loop (for entry in requested) and just another name for var roles in line 153 / 154 should fix the problem
(in my testcase Authenticated Users can do nothing, so that after the first loop the roles-variable is empty -> so it can't match anything in the next loops )
example:
loop 1:
entry = id: AuthenticatedUsers, type: group
roles = [u'Contributor', u'Editor', u'Reader', u'Reviewer']
loop 2:
entry = id: test2, role_Contributor: True, role_Editor: True, role_Reader: True, role_Reviewer: True, type: user
roles = []

bug found in plone.app.workflow-1.1.3-py2.4.egg