(orgID uuid.UUID, rw http.ResponseWriter, r *http.Request)
| 760 | } |
| 761 | |
| 762 | func (api *API) idpSyncClaimFields(orgID uuid.UUID, rw http.ResponseWriter, r *http.Request) { |
| 763 | ctx := r.Context() |
| 764 | |
| 765 | fields, err := api.Database.OIDCClaimFields(ctx, orgID) |
| 766 | if httpapi.IsUnauthorizedError(err) { |
| 767 | // Give a helpful error. The user could read the org, so this does not |
| 768 | // leak anything. |
| 769 | httpapi.Write(ctx, rw, http.StatusForbidden, codersdk.Response{ |
| 770 | Message: "You do not have permission to view the available IDP fields", |
| 771 | Detail: fmt.Sprintf("%s.read permission is required", rbac.ResourceIdpsyncSettings.Type), |
| 772 | }) |
| 773 | return |
| 774 | } |
| 775 | if err != nil { |
| 776 | httpapi.InternalServerError(rw, err) |
| 777 | return |
| 778 | } |
| 779 | |
| 780 | httpapi.Write(ctx, rw, http.StatusOK, fields) |
| 781 | } |
| 782 | |
| 783 | // @Summary Get the organization idp sync claim field values |
| 784 | // @ID get-the-organization-idp-sync-claim-field-values |
no test coverage detected