diff --git a/packages/types/src/api/web/global/scim/users.ts b/packages/types/src/api/web/global/scim/users.ts index 8748b4e8e6..72b7078bb4 100644 --- a/packages/types/src/api/web/global/scim/users.ts +++ b/packages/types/src/api/web/global/scim/users.ts @@ -1,5 +1,7 @@ import { ScimResource, ScimMeta, ScimPatchOperation } from "scim-patch" +type BooleanString = boolean | "True" | "False" + export interface ScimUserResponse extends ScimResource { schemas: ["urn:ietf:params:scim:schemas:core:2.0:User"] id: string @@ -13,7 +15,7 @@ export interface ScimUserResponse extends ScimResource { familyName: string givenName: string } - active: boolean + active: BooleanString emails: [ { value: string @@ -30,7 +32,7 @@ export interface ScimCreateUserRequest { ] externalId: string userName: string - active: boolean + active: BooleanString emails: [ { primary: true diff --git a/packages/worker/src/api/routes/global/tests/scim/users.spec.ts b/packages/worker/src/api/routes/global/tests/scim/users.spec.ts index eff82ab766..d0c15ca532 100644 --- a/packages/worker/src/api/routes/global/tests/scim/users.spec.ts +++ b/packages/worker/src/api/routes/global/tests/scim/users.spec.ts @@ -395,6 +395,24 @@ describe("/api/global/scim/v2/users", () => { const persistedUser = await config.api.scimUsersAPI.find(user.id) expect(persistedUser).toEqual(expectedScimUser) }) + + it("can deactive an active user", async () => { + const body: ScimUpdateRequest = { + schemas: ["urn:ietf:params:scim:api:messages:2.0:PatchOp"], + Operations: [{ op: "Replace", path: "active", value: "False" }], + } + + const response = await patchScimUser({ id: user.id, body }) + + const expectedScimUser: ScimUserResponse = { + ...user, + active: false, + } + expect(response).toEqual(expectedScimUser) + + const persistedUser = await config.api.scimUsersAPI.find(user.id) + expect(persistedUser).toEqual(expectedScimUser) + }) }) describe("DELETE /api/global/scim/v2/users/:id", () => {