Skip to content

Fix inviting members with a custom role

Jarka Košanová requested to merge 466258-invitations-api-fix into master

What does this MR do and why?

It fixes Invitations API endpoints, specifically creation and update of new invitations and assignment of custom roles by including the correct EE module. More information inline.

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.

How to set up and validate locally

  1. Create a custom role (with guest as base access level if you want to use API requests examples below) in admin - settings - roles and permissions on self-managed (or group settings on SaaS)
  2. Use Invitations API endpoints (create and update) and check if custom roles are being assigned correctly:
# create group invitation
curl --request POST --header "Authorization: Bearer YOUR_ACCESS_TOKEN" --header "Content-Type: application/json" \
--data '{"email":"example_cr@example.com", "member_role_id": "14", "access_level": "10"}' \
"http://gdk.test:3000/api/v4/groups/GROUP_ID/invitations"

# create project invitation
curl --request POST --header "Authorization: Bearer YOUR_ACCESS_TOKEN --header "Content-Type: application/json" \
--data '{"email":"example_cr@example.com", "member_role_id": "14", "access_level": "10"}' \
"http://gdk.test:3000/api/v4/projects/PROJECT_ID/invitations"

# update group invitation
curl --request PUT --header "Authorization: Bearer YOUR_ACCESS_TOKEN --header "Content-Type: application/json" \
--data '{"member_role_id": "13"}' "http://gdk.test:3000/api/v4/groups/GROUP_ID/invitations/example_cr@example.com"

# update project invitation
curl --request PUT --header "Authorization: Bearer YOUR_ACCESS_TOKEN --header "Content-Type: application/json" \
--data '{"member_role_id": "13"}' "http://gdk.test:3000/api/v4/projects/PROJECT_ID/invitations/example_cr@example.com" 

Related to #466258 (closed)

Edited by Jarka Košanová

Merge request reports