Bug #5489
opengrant_user_permission_to_repo_group API call fails to set permissions on child repos
0%
Description
Log:
2018-07-10 14:30:48.334 INFO [rhodecode.actions.security.repogroup] Logging action by <AuthUser('id:33[myuser] ip:10.1.1.1 auth:False')>: granted permission: <Permission('7:group.read')> to usergroup: <UserGroup('id:29:mygroup')> on repogroup: <RepoGroup('id:33:myrepogroup')>
2018-07-10 14:30:48.345 ERROR [rhodecode.api.views.repo_group_api] Exception occurred while trying to grant user group permissions to repo group
Traceback (most recent call last):
File "/opt/rhodecode/store/bbjmr1bwgmqsdkajzkmm5hk16al1b3ag-python2.7-rhodecode-enterprise-ce-4.12.2/lib/python2.7/site-packages/rhodecode/api/views/repo_group_api.py", line 617, in grant_user_group_permission_to_repo_group
cur_user=apiuser)
File "/opt/rhodecode/store/bbjmr1bwgmqsdkajzkmm5hk16al1b3ag-python2.7-rhodecode-enterprise-ce-4.12.2/lib/python2.7/site-packages/rhodecode/model/repo_group.py", line 449, in update_permissions
_set_perm_group(obj, users_group=member_id, perm=perm)
File "/opt/rhodecode/store/bbjmr1bwgmqsdkajzkmm5hk16al1b3ag-python2.7-rhodecode-enterprise-ce-4.12.2/lib/python2.7/site-packages/rhodecode/model/repo_group.py", line 375, in _set_perm_group
perm = perm.replace('group.', 'repository.')
AttributeError: 'Permission' object has no attribute 'replace'
Preliminary investigation suggested the web interface just passed a permission as string whereas the API passes the class instance. Initial attempt to pass just a string worked for traversing into repos, but later failed:
2018-07-10 15:01:24.039 ERROR [rhodecode.api.views.repo_group_api] Exception occurred while trying to grant user group permissions to repo group
Traceback (most recent call last):
File "/opt/rhodecode/store/bbjmr1bwgmqsdkajzkmm5hk16al1b3ag-python2.7-rhodecode-enterprise-ce-4.12.2/lib/python2.7/site-packages/rhodecode/api/views/repo_group_api.py", line 622, in grant_user_group_permission_to_repo_group
perm.permission_name, apply_to_children,
AttributeError: 'unicode' object has no attribute 'permission_name'
Hacky fix which works for both str and obj attached.
Files
Updated by Marcin Kuzminski [CTO] over 6 years ago
- Priority changed from Normal to High
- Target version set to v4.12
We should include this into 4.12.4 that currently is on the table.
Updated by Redmine Integration over 6 years ago
- Status changed from New to Resolved
Commit 2094102a6c3f by Marcin Kuzminski marcin@rhodecode.com on stable branch changed this issue. https://code.rhodecode.com/rhodecode-enterprise-ce/changeset/2094102a6c3faed8b84e531e12447404ce591f58
Updated by Redmine Integration over 6 years ago
Commit 4340ccf93de8 by Marcin Kuzminski marcin@rhodecode.com on default branch changed this issue. https://code.rhodecode.com/rhodecode-enterprise-ce/changeset/4340ccf93de8e87b712339e6e2f1998949f9f815