mirror of
https://github.com/coder/coder.git
synced 2025-07-15 22:20:27 +00:00
fix: don't require organization_id
in body when updating a custom role (#14102)
This commit is contained in:
committed by
GitHub
parent
e2cec454bc
commit
166467caf0
@ -21,7 +21,7 @@ type enterpriseCustomRoleHandler struct {
|
||||
Enabled bool
|
||||
}
|
||||
|
||||
func (h enterpriseCustomRoleHandler) PatchOrganizationRole(ctx context.Context, rw http.ResponseWriter, r *http.Request, orgID uuid.UUID, role codersdk.Role) (codersdk.Role, bool) {
|
||||
func (h enterpriseCustomRoleHandler) PatchOrganizationRole(ctx context.Context, rw http.ResponseWriter, r *http.Request, orgID uuid.UUID, role codersdk.PatchRoleRequest) (codersdk.Role, bool) {
|
||||
if !h.Enabled {
|
||||
httpapi.Write(ctx, rw, http.StatusForbidden, codersdk.Response{
|
||||
Message: "Custom roles are not enabled",
|
||||
@ -77,14 +77,6 @@ func (h enterpriseCustomRoleHandler) PatchOrganizationRole(ctx context.Context,
|
||||
return codersdk.Role{}, false
|
||||
}
|
||||
|
||||
if role.OrganizationID != orgID.String() {
|
||||
httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{
|
||||
Message: "Invalid request, organization in role and url must match",
|
||||
Detail: fmt.Sprintf("role organization=%q does not match URL=%q", role.OrganizationID, orgID.String()),
|
||||
})
|
||||
return codersdk.Role{}, false
|
||||
}
|
||||
|
||||
originalRoles, err := db.CustomRoles(ctx, database.CustomRolesParams{
|
||||
LookupRoles: []database.NameOrganizationPair{
|
||||
{
|
||||
|
Reference in New Issue
Block a user