@Summary Get workspace sharing settings for organization @ID get-workspace-sharing-settings-for-organization @Security CoderSessionToken @Produce json @Tags Enterprise @Param organization path string true "Organization ID" format(uuid) @Success 200 {object} codersdk.WorkspaceSharingSettings @Router
(rw http.ResponseWriter, r *http.Request)
| 29 | // @Success 200 {object} codersdk.WorkspaceSharingSettings |
| 30 | // @Router /api/v2/organizations/{organization}/settings/workspace-sharing [get] |
| 31 | func (api *API) workspaceSharingSettings(rw http.ResponseWriter, r *http.Request) { |
| 32 | ctx := r.Context() |
| 33 | org := httpmw.OrganizationParam(r) |
| 34 | |
| 35 | if !api.Authorize(r, policy.ActionRead, org) { |
| 36 | httpapi.Forbidden(rw) |
| 37 | return |
| 38 | } |
| 39 | |
| 40 | disabled := org.ShareableWorkspaceOwners == database.ShareableWorkspaceOwnersNone |
| 41 | globallyDisabled := bool(api.DeploymentValues.DisableWorkspaceSharing) |
| 42 | owners := codersdk.ShareableWorkspaceOwners(org.ShareableWorkspaceOwners) |
| 43 | if globallyDisabled { |
| 44 | owners = codersdk.ShareableWorkspaceOwnersNone |
| 45 | } |
| 46 | httpapi.Write(ctx, rw, http.StatusOK, codersdk.WorkspaceSharingSettings{ |
| 47 | SharingGloballyDisabled: globallyDisabled, |
| 48 | SharingDisabled: disabled || globallyDisabled, |
| 49 | ShareableWorkspaceOwners: owners, |
| 50 | }) |
| 51 | } |
| 52 | |
| 53 | // @Summary Update workspace sharing settings for organization |
| 54 | // @ID update-workspace-sharing-settings-for-organization |
nothing calls this directly
no test coverage detected