Skip to content
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

Branch protection on user basis #99

Closed
ejiektpobehuk opened this issue May 1, 2020 · 3 comments
Closed

Branch protection on user basis #99

ejiektpobehuk opened this issue May 1, 2020 · 3 comments

Comments

@ejiektpobehuk
Copy link

ejiektpobehuk commented May 1, 2020

In GitLab UI it's possible to set protected branch rules Allowed to merge and Allowed to push to a specific user or group. Related Docs.

Setting particular user to "allow to push" looks something like this (other settings were: push - no one, merge - developers and mainteiners):

[
  {
    "id": 1234,
    "name": "master",
    "push_access_levels": [
      {
        "access_level": 40,
        "access_level_description": "User shown name",
        "user_id": 123,
        "group_id": null
      },
      {
        "access_level": 0,
        "access_level_description": "No one",
        "user_id": null,
        "group_id": null
      }
    ],
    "merge_access_levels": [
      {
        "access_level": 30,
        "access_level_description": "Developers + Maintainers",
        "user_id": null,
        "group_id": null
      }
    ],
    "unprotect_access_levels": [],
    "code_owner_approval_required": false
  }
]

Users access_level seems to be taken from users repo access level and access_level_description is users name.

Is it not supported yet?
If not, is _protect_branch of gitlabform/gitlabform/core.py a good place to start with it?


I'm sorry for not providing the minimal config but I don't have my EE version to play with right now.

@gdubicki
Copy link
Member

gdubicki commented May 1, 2020

Hi @ejiek !

No, this is not supported yet.

To add such support, apart from extending GitLabFormCore. _protect_branch you would have to extend GitLabBranches first to add support for the API described (rather vaguely) here: https://docs.gitlab.com/ee/api/protected_branches.html#example-with-user--group-level-access-starter

We are open to PRs adding this feature but please remember to add tests!

@rbartuzel
Copy link

Hi @ejiek !

Branch protection on user basis sounds like useful feature and I would like to use it in my project.

@gdubicki
Copy link
Member

gdubicki commented Oct 7, 2021

This should be possible with >= v.2.3.0, @ejiek .

@gdubicki gdubicki closed this as completed Oct 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants