Skip to content

Api for deleting service account user for group owner

What does this MR do and why?

Solves #416729 (closed) partly

Api for deleting service account user for group owner

With this MR we introduce a new API for group owners to delete users of type service account.

Changelog: added EE: true

Api for delete service account user group owner added

shots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

  1. Create some service account users for a group using API https://docs.gitlab.com/ee/api/groups.html#create-service-account-user as group owner

  2. Make sure you are running gitlab in saas mode - https://docs.gitlab.com/ee/development/ee_features.html . Try and delete user using curl request -

    curl --request DELETE --header "PRIVATE-TOKEN: <group_owner_pat>" "https://gdk.test:3443/api/v4/groups/<group_id>/service_accounts/<service_account_user_id>"
  3. Check in gdk rails console , user should have been marked as blocked immediately. After sometime check again, user might have been deleted altogether ( delay is due to UserGhostMigrationWorker that is responsible for deleting user )

  4. Run gitlab in self-managed mode and try the same curl request again. This time it should throw an error

    {"message":"400 Bad request - User does not have permission to delete a service account."}**% **

  5. Now create access token for instance admin and run the same curl command as step 2. The curl command should be working fine in both saas and self-managed setup

Edited by Smriti Garg

Merge request reports