protect admin account from disabling

This commit is contained in:
Hugo Renard 2022-03-17 11:27:43 +01:00
parent 90b338f7e4
commit e3aa537898
Signed by: hougo
GPG key ID: 3A285FD470209C59

View file

@ -20,6 +20,9 @@ export class UserEndpoint extends ScimEndpoint implements IScimEndpoint {
public async _put(ctx: Context): Promise<IApiResponse> {
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: {