Skip to content
Snippets Groups Projects

Add Restrict group access by Domain to API

Merged 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
Loading
  • 1 Warning
    :warning: fc672f84: The commit subject and body must be separated by a blank line. For more information, take a look at our Commit message guidelines.
    2 Messages
    :book: CHANGELOG missing:

    If this merge request needs a changelog entry, add the Changelog trailer to the commit message you want to add to the changelog.

    If this merge request doesn't need a CHANGELOG entry, feel free to ignore this message.

    :book: This merge request adds or changes documentation files. A review from the Technical Writing team before you merge is recommended. Reviews can happen after you merge.

    Documentation review

    The following files require a review from a technical writer:

    The review does not need to block merging this merge request. See the:

    Reviewer roulette

    Category Reviewer Maintainer
    backend @ghavenga profile link current availability (UTC+2) @j_lar profile link current availability (UTC+2)

    Please refer to documentation page for guidance on how you can benefit from the Reviewer Roulette, or use the GitLab Review Workload Dashboard to find other available reviewers.

    If needed, you can retry the :repeat: danger-review job that generated this comment.

    Generated by :no_entry_sign: Danger

  • Neil McDonald changed the description

    changed the description

  • Neil McDonald added 3 commits

    added 3 commits

    • dacfeb07 - Update api doc for allowed_email_domains variable
    • d98d8036 - Revert allowed_email_domains to allowed_email_domains_list param
    • 40e6904f - Return allowed_email_domains_list a comma separated str in API

    Compare with previous version

  • Neil McDonald changed the description

    changed the description

  • Neil McDonald added 3 commits

    added 3 commits

    • 8573d1ee - Add allowed_email_domains_list to Helpers
    • 972d1171 - Fix typo in allowed_email_domains row
    • 03cb5c3f - Remove extra whitespace

    Compare with previous version

  • Neil McDonald added 2 commits

    added 2 commits

    • 32fc1789 - Update typo on allowed_email_domains_list row
    • b69667c4 - Add an allowed_email_domains_list spec test

    Compare with previous version

  • Neil McDonald added 1 commit

    added 1 commit

    • 0d127477 - Fix end typo on allowed_email_domains_list Spec

    Compare with previous version

  • Neil McDonald changed the description

    changed the description

  • Neil McDonald added 1 commit

    added 1 commit

    • ac3ed21d - Fix spec test to exclude extra included context

    Compare with previous version

  • Neil McDonald added 1 commit

    added 1 commit

    • 91126922 - Fix - Correct whitespace linting errors

    Compare with previous version

  • Neil McDonald added 1 commit

    added 1 commit

    • 202975ad - Spec fix allow the user to be owner & admin

    Compare with previous version

  • Neil McDonald marked this merge request as ready

    marked this merge request as ready

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading