Skip to content

Add Restrict group access by Domain to API

Neil McDonald requested to merge 351494-restrict-group-access-by-domain-2 into master

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 or write 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

  1. Ensure you have sufficient permissions on a Premium/Ultimate instance
  2. 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"
  1. 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

Merge request reports

Loading