Skip to content

Use permissions (project and group) for RemoteRepository.admin on GitLab #7479

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 16, 2020

Conversation

humitos
Copy link
Member

@humitos humitos commented Sep 14, 2020

When syncing RemoteRepository in GitLab we were only checking if the user was
the owner of the project, but we weren't checking for permissions given by
belonging to a group.

This commit makes usage of 40 (maintainer) and 50 (owner) permission levels to
check these permissions granted by being part of a group.

Closes #7475

When syncing `RemoteRepository` in GitLab we were only checking if the user was
the owner of the project, but we weren't checking for permissions given by
belonging to a group.

This commit makes usage of 40 (maintainer) and 50 (owner) permission levels to
check these permissions granted by being part of a group.
@humitos humitos requested a review from a team September 14, 2020 11:26
# https://docs.gitlab.com/ee/api/access_requests.html
# https://gitlab.com/help/user/permissions
project_access = fields.get('permissions', {}).get('project_access', {})
project_access_level = project_access.get('access_level', 0) if project_access else 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like project access already defaults to an empty dict, this makes sense gitlab can set this to None. Same for group_access_level

Suggested change
project_access_level = project_access.get('access_level', 0) if project_access else 0
project_access_level = project_access.get('access_level', 0)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was bitten by this already, where project_access can be None. The if is to avoid bypass that case

@humitos humitos merged commit 1b54393 into master Sep 16, 2020
@humitos humitos deleted the humitos/gitlab-remoterepository-admin branch September 16, 2020 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RemoteRepository.admin is not set properly on GitLab
2 participants