Add Restrict group access by Domain to API
What does this MR do and why?
- This change allows a user to add/update (PUT) and read (GET) the restricted domains by email group setting in the Group API.
- This is currently described in the Restrict Group Access by Domain docs but is not exposed via the API to
read
orwrite
to. - Closes: #351494 (closed)
Example read (GET)
Request:curl -H "PRIVATE_TOKEN: $ADMIN_PAT" -s -X GET \
"http://gdk.test:3000/api/v4/groups/24" | jq '.allowed_email_domains_list'
Response:
"legit.com"
Example write (PUT)
Request:curl -H "PRIVATE_TOKEN: $ADMIN_PAT" -s -X PUT \
"http://gdk.test:3000/api/v4/groups/24?allowed_email_domains_list=domain.com" | jq '.allowed_email_domains_list'
Response:
"domain.com"
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
- Ensure you have sufficient permissions on a Premium/Ultimate instance
- Read the current allow listed domain names (if set):
curl -H "PRIVATE_TOKEN: $ADMIN_PAT" -s -X GET \
"http://gdk.test:3000/api/v4/groups/24" | jq '.allowed_email_domains_list'
"example.com"
- Then set them:
curl -H "PRIVATE_TOKEN: $ADMIN_PAT" -s -X PUT \
"http://gdk.test:3000/api/v4/groups/24?allowed_email_domains_list=domain.com" | jq '.allowed_email_domains_list'
"domain.com"
Related to #351494 (closed)
Edited by Neil McDonald