From e3aa537898371c56bd8132719fa9f01831108b42 Mon Sep 17 00:00:00 2001 From: Hugo Renard Date: Thu, 17 Mar 2022 11:27:43 +0100 Subject: [PATCH] protect admin account from disabling --- src/endpoints/UserEndpoint.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/endpoints/UserEndpoint.ts b/src/endpoints/UserEndpoint.ts index 2d8b2df..a5096e5 100644 --- a/src/endpoints/UserEndpoint.ts +++ b/src/endpoints/UserEndpoint.ts @@ -20,6 +20,9 @@ export class UserEndpoint extends ScimEndpoint implements IScimEndpoint { public async _put(ctx: Context): Promise { const u = SCIMUser.fromPlain(ctx.content()); + if (ctx.id() === (await ctx.rc.getUserId())) { + u.active = true; + } const o = await ctx.rc.user.update({ userId: ctx.id(), data: {