Project

General

Profile

Bug #5489

grant_user_permission_to_repo_group API call fails to set permissions on child repos

Added by Peter Colledge over 1 year ago. Updated over 1 year 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.

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

History

#1 Updated by Marcin Kuzminski [staff] over 1 year ago

  • Target version set to v4.12
  • Priority changed from Normal to High

We should include this into 4.12.4 that currently is on the table.

#2 Updated by Redmine Integration over 1 year ago

  • Status changed from New to Resolved

Also available in: Atom PDF