Endpoint to update service accounts as a group owner
What does this MR do and why?
This merge request adds functionality to update service account users in top-level groups. It introduces a new API endpoint to modify service account details like name and username. The changes include updates to the API documentation, implementation of the update service, and corresponding policy adjustments to control who can perform these updates. Additionally, the code includes new tests to ensure the proper functioning of this feature and handles various edge cases and error scenarios. The update capability is restricted to group owners with appropriate checks for feature licensing and user permissions.
References
Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.
- Fixes #514528 (closed)
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
Numbered steps to set up and validate the change are strongly suggested.
- Setup SaaS simulation in gdk
- Create a group with ultimate license
- create group service account
curl --request POST \
--url https://gdk.test:3000/api/v4/groups/<group_id>/service_accounts \
--header 'PRIVATE-TOKEN: <PAT>' \
--header 'content-type: application/json' \
--data '{
"name": "name",
"username": "my username",
"email": "email@example.com"
}
- Use List endpoint to make sure that service account is created
curl --request GET \
--url https://gdk.test:3000/api/v4/groups/<group_id>/service_accounts
- Update service account from API
curl --request PUT \
--url https://gdk.test:3000/api/v4/groups/<group_id>/service_accounts/<service_account_id> \
--header 'PRIVATE-TOKEN: <PAT>' \
--header 'content-type: application/json' \
--data '{
"name": "new name"
}