Allows email to be updated for service accounts
What does this MR do and why?
This MR updates the PATCH /groups/:group_id/service_accounts/:id API to allow editing the email address and return the unconfirmed_email attribute when email confirmation is required. When email confirmation can be skipped, it directly updates the email attribute and returns it.
It also adds a new PATCH /service_accounts/:id to allow instance-level service accounts to be updated. This endpoint also allows the service account user's name, username and email to be updated. Editing the email address updates the unconfirmed_email attribute when email confirmation is required and returns it. When email confirmation can be skipped, it directly updates the email attribute and returns it.
References
NA
Screenshots or screen recordings
NA
How to set up and validate locally
- Invoke the
PATCH http://gdk.test:3000/api/v4/groups/:group_id/service_accounts/:user_idendpoint from Postman or curl and pass theemailattribute in the body. - Verify that the response contains the
unconfirmed_emailattribute with the email that you passed in the request. - Invoke the
GET http://gdk.test:3000/api/v4/groups/:group_id/service_accountsendpoint and confirm that theunconfirmed_emailattribute is returned. - Navigate to http://gdk.test:3000/rails/letter_opener/ and click on the
Confirm your accountlink in the confirmation email. - Invoke the
GET http://gdk.test:3000/api/v4/groups/:group_id/service_accountsendpoint again and confirm that theemailattribute is set to the value you provided in the request and theunconfirmed_emailattribute is not returned. - Repeat the steps above with the
PATCH http://gdk.test:3000/api/v4/service_accounts/:user_idandGET http://gdk.test:3000/api/v4/service_accountsendpoints.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #550983 (closed)