Project

General

Profile

Actions

Bug #5489

open

grant_user_permission_to_repo_group API call fails to set permissions on child repos

Added by Peter Colledge over 6 years ago. Updated over 6 years ago.

Status:
Resolved
Priority:
High
Assignee:
-
Category:
-
Target version:
Start date:
10.07.2018
Due date:
% Done:

0%

Estimated time:
Sorting:
Commit Number:
Affected Version:

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

repo_group.py.diff (1.46 KB) repo_group.py.diff Peter Colledge, 10.07.2018 17:06
Actions

Also available in: Atom PDF