fix: show user-auth provisioners for all organizations (#16350)

This commit is contained in:
ケイラ
2025-01-30 14:08:27 -07:00
committed by GitHub
parent b256b204d0
commit 6ea5c6f0ef
7 changed files with 36 additions and 12 deletions

View File

@ -137,6 +137,20 @@ func (api *API) provisionerKeyDaemons(rw http.ResponseWriter, r *http.Request) {
}
sdkKeys := convertProvisionerKeys(pks)
// For the default organization, we insert three rows for the special
// provisioner key types (built-in, user-auth, and psk). We _don't_ insert
// those into the database for any other org, but we still need to include the
// user-auth key in this list, so we just insert it manually.
if !slices.ContainsFunc(sdkKeys, func(key codersdk.ProvisionerKey) bool {
return key.ID == codersdk.ProvisionerKeyUUIDUserAuth
}) {
sdkKeys = append(sdkKeys, codersdk.ProvisionerKey{
ID: codersdk.ProvisionerKeyUUIDUserAuth,
Name: codersdk.ProvisionerKeyNameUserAuth,
Tags: map[string]string{},
})
}
daemons, err := api.Database.GetProvisionerDaemonsByOrganization(ctx, database.GetProvisionerDaemonsByOrganizationParams{OrganizationID: organization.ID})
if err != nil {
httpapi.InternalServerError(rw, err)