Skip to content

Commit

Permalink
Merge pull request #922 from Scille/gui-fix-manager-role
Browse files Browse the repository at this point in the history
[GUI] Prevent managers from inviting other users as managers
  • Loading branch information
Max-7 committed Jan 17, 2020
2 parents 43199e8 + 0b4f311 commit 27c46d0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions newsfragments/916.bugfix.rst
@@ -0,0 +1 @@
Prevent managers from inviting other users as managers
22 changes: 11 additions & 11 deletions parsec/core/gui/workspace_sharing_dialog.py
Expand Up @@ -186,17 +186,17 @@ def __init__(self, user_fs, workspace_fs, core, jobs_ctx, *args, **kwargs):

ws_entry = self.jobs_ctx.run_sync(self.workspace_fs.get_workspace_entry)
self.current_user_role = ws_entry.role
current_index = _ROLES_TO_INDEX[self.current_user_role]
for role, index in _ROLES_TO_INDEX.items():
if index <= current_index:
if role == WorkspaceRole.READER:
self.combo_role.insertItem(index, _("WORKSPACE_ROLE_READER"))
elif role == WorkspaceRole.CONTRIBUTOR:
self.combo_role.insertItem(index, _("WORKSPACE_ROLE_CONTRIBUTOR"))
elif role == WorkspaceRole.MANAGER:
self.combo_role.insertItem(index, _("WORKSPACE_ROLE_MANAGER"))
elif role == WorkspaceRole.OWNER:
self.combo_role.insertItem(index, _("WORKSPACE_ROLE_OWNER"))

if (
self.current_user_role == WorkspaceRole.MANAGER
or self.current_user_role == WorkspaceRole.OWNER
):
self.combo_role.insertItem(self.combo_role.count(), _("WORKSPACE_ROLE_READER"))
self.combo_role.insertItem(self.combo_role.count(), _("WORKSPACE_ROLE_CONTRIBUTOR"))
if self.current_user_role == WorkspaceRole.OWNER:
self.combo_role.insertItem(self.combo_role.count(), _("WORKSPACE_ROLE_MANAGER"))
self.combo_role.insertItem(self.combo_role.count(), _("WORKSPACE_ROLE_OWNER"))

if (
self.current_user_role == WorkspaceRole.READER
or self.current_user_role == WorkspaceRole.CONTRIBUTOR
Expand Down

0 comments on commit 27c46d0

Please sign in to comment.