Handle string boolean requests
This commit is contained in:
parent
43c25436c8
commit
d452f5cf0d
|
@ -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
|
||||
|
|
|
@ -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", () => {
|
||||
|
|
Loading…
Reference in New Issue