jdamata / terraform-provider-sonarqube

Terraform provider for managing Sonarqube configuration
GNU General Public License v3.0
64 stars 58 forks source link

Add feature to assign custom "quality gate" manage permission to specific user or group #109

Closed noor409 closed 1 year ago

noor409 commented 1 year ago

Hi ,

Am able to assign custom quality gates manage permission to specific user/ group via UI,

image
EvertonSA commented 1 year ago

let me clarify on this one because this description is not very clean,

I as a Sonarqube administrator would like to create a custom quality gate per team I'm managing and assign key users of that team to manage the quality gate.

On the UI, we can assign a Quality Gate to a person, and that person is capable of administer the quality gate rules by then selfs. On this terraform provider, it seems not possible.

Can we have this implemented?

jdamata commented 1 year ago

Is this possible with the sonarqube api?

You can assign users the 'gateadmin' role via sonarqube_permissions but i believe this is a global permission not project scoped.

IE: https://github.com/jdamata/terraform-provider-sonarqube/blob/668f89406ac98f3fba565c92e14335f897dd83bf/docs/resources/sonarqube_permissions.md#example-set-codeviewer--user-permissions-on-project-level-for-a-user-called-johndoe

EvertonSA commented 1 year ago

@jdamata it seems to be: image

image

but it does not show on the docs on http://localhost:8000/web_api/api/qualitygates

from my understanding, it's a POST on /api/qualitygates/add_user with --data-raw 'gateName=&login='

EvertonSA commented 1 year ago

I also tested for groups and the API is the same:

it's a POST on /api/qualitygates/add_user with --data-raw 'gateName=&login='

image

EvertonSA commented 1 year ago

perhaps we should have a sonarqube_qualitygate_usergroup_association resource?

jdamata commented 1 year ago

Thanks for the investigation @EvertonSA. I was able to find this in the web_api docs. This api is marked as an 'internal' api.

Use at your own risk; internal services are subject to change or removal without notice.

Screen Shot 2022-12-29 at 11 42 08 AM

EvertonSA commented 1 year ago

@jdamata I would like to work on this, do you consider a sonarqube_qualitygate_usergroup_association a good approach or would you do something different?

jdamata commented 1 year ago

Yah that resource sounds good. I'm a little concerned that this API might change significantly. Please be sure to add acceptance tests with the new resource

EvertonSA commented 1 year ago

this issue can be closed