Get behavior of gitlab_project_members to the one of gitlab_group_members (#3319)

* Initial change to get behaviour of gitlab_project_members like the new gitlab_group_members

* added changelog

* linter: removed trainling whitespaces

* Update plugins/modules/source_control/gitlab/gitlab_project_members.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/source_control/gitlab/gitlab_project_members.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/source_control/gitlab/gitlab_project_members.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/source_control/gitlab/gitlab_project_members.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/source_control/gitlab/gitlab_project_members.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* requested changes

* linter fixes

* undoing formatting changes to existing code

Co-authored-by: Max-Florian Bidlingmaier <Max.Bidlingmaier@konsolan.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Max Bidlingmaier <Max-Florian.Bidlingmaier@sap.com>
This commit is contained in:
Max Bidlingmaier 2021-09-16 22:26:31 +02:00 committed by GitHub
commit 7a2efb4775
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 312 additions and 76 deletions

View file

@ -3,3 +3,11 @@ gitlab_api_access_token: "token"
gitlab_project: some_project
username: some_user
gitlab_access_level: developer
userlist:
- username1
- username2
dedicated_access_users:
- name: username1
access_level: "developer"
- name: username2
access_level: "maintainer"

View file

@ -19,7 +19,7 @@
api_token: "{{ gitlab_api_access_token }}"
project: "{{ gitlab_project }}"
gitlab_user: "{{ username }}"
state: absent
state: absent
- name: Add a User to A GitLab Project
community.general.gitlab_project_members:
@ -78,3 +78,46 @@
assert:
that:
- remove_gitlab_project_members_state_again is not changed
- name: Add a list of Users to A GitLab Project
community.general.gitlab_project_members:
api_url: "{{ gitlab_server_url }}"
api_token: "{{ gitlab_api_access_token }}"
project: "{{ gitlab_project }}"
gitlab_user: "{{ userlist }}"
access_level: "{{ gitlab_access_level }}"
state: present
- name: Remove a list of Users to A GitLab Project
community.general.gitlab_project_members::
api_url: "{{ gitlab_server_url }}"
api_token: "{{ gitlab_api_access_token }}"
project: "{{ gitlab_project }}"
gitlab_user: "{{ userlist }}"
state: absent
- name: Add a list of Users with Dedicated Access Levels to A GitLab Project
community.general.gitlab_project_members::
api_url: "{{ gitlab_server_url }}"
api_token: "{{ gitlab_api_access_token }}"
project: "{{ gitlab_project }}"
gitlab_users_access: "{{ dedicated_access_users }}"
state: present
- name: Remove a list of Users with Dedicated Access Levels to A GitLab Project
community.general.gitlab_project_members::
api_url: "{{ gitlab_server_url }}"
api_token: "{{ gitlab_api_access_token }}"
project: "{{ gitlab_project }}"
gitlab_users_access: "{{ dedicated_access_users }}"
state: absent
- name: Add a user, remove all others which might be on this access level
community.general.gitlab_project_members::
api_url: "{{ gitlab_server_url }}"
api_token: "{{ gitlab_api_access_token }}"
project: "{{ gitlab_project }}"
gitlab_user: "{{ username }}"
access_level: "{{ gitlab_access_level }}"
pruge_users: "{{ gitlab_access_level }}"
state: present