How to give project access to a member in a group without adding manually?

Viewed 34

I want to add a group to a GitLab project and give all the group members developer access. When someone join the group, he/she will get the developer access automatically instead of adding him/her to the project as a developer manually.

Is there a way to do the above thing?

1 Answers

That does not seem natively supported, considering the official documentation specifies:

Members that are not automatically added are displayed on the Invited tab.
Users can be on this tab because they:

You might have to script that operation, using the "Add a member to a group or project API"

curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
     --data "user_id=1&access_level=30" "https://gitlab.example.com/api/v4/groups/:id/members"

You would coupled that with a script getting the list of recent new users (like users without projects in List Users for administrator API), run at regular interval, in order to batch such API calls.

As noted by Bastian in the comments, you can also setup a webhook which will answer to the Group member events (but only for GitLab Premium though)

Related