From 4b8b7a9d822592b3ec88f40f996ab48c1c031135 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 27 Jun 2023 15:30:54 +0200 Subject: [PATCH] refs #5475 fix accessScope --- back/methods/vn-user/specs/sign-in.spec.js | 2 -- back/methods/vn-user/specs/validate-auth.spec.js | 2 +- front/salix/components/change-password/index.html | 2 +- front/salix/components/change-password/index.js | 4 ++++ .../back/methods/account/specs/change-password.spec.js | 2 +- modules/account/back/models/account.json | 7 +++++++ 6 files changed, 14 insertions(+), 5 deletions(-) diff --git a/back/methods/vn-user/specs/sign-in.spec.js b/back/methods/vn-user/specs/sign-in.spec.js index a6e89d528..c3ff2d7db 100644 --- a/back/methods/vn-user/specs/sign-in.spec.js +++ b/back/methods/vn-user/specs/sign-in.spec.js @@ -71,8 +71,6 @@ fdescribe('VnUser Sign-in()', () => { expect(error).toBeDefined(); expect(error.statusCode).toBe(403); expect(error.message).toBe('REQUIRES_2FA'); - - await employee.updateAttribute('twoFactor', null); }); }); diff --git a/back/methods/vn-user/specs/validate-auth.spec.js b/back/methods/vn-user/specs/validate-auth.spec.js index a58837e7b..8018bd3e1 100644 --- a/back/methods/vn-user/specs/validate-auth.spec.js +++ b/back/methods/vn-user/specs/validate-auth.spec.js @@ -1,6 +1,6 @@ const {models} = require('vn-loopback/server/server'); -fdescribe('VnUser validate-auth()', () => { +describe('VnUser validate-auth()', () => { describe('validateAuth', () => { it('should signin if data is correct', async() => { await models.AuthCode.create({ diff --git a/front/salix/components/change-password/index.html b/front/salix/components/change-password/index.html index c22c261f5..04f66976e 100644 --- a/front/salix/components/change-password/index.html +++ b/front/salix/components/change-password/index.html @@ -22,7 +22,7 @@ autocomplete="false"> { +describe('account changePassword()', () => { const ctx = {req: {accessToken: {userId: 70}}}; const unauthCtx = { req: { diff --git a/modules/account/back/models/account.json b/modules/account/back/models/account.json index 8fe3e88f9..3c22521cb 100644 --- a/modules/account/back/models/account.json +++ b/modules/account/back/models/account.json @@ -37,6 +37,13 @@ "principalType": "ROLE", "principalId": "$authenticated", "permission": "ALLOW" + }, + { + "property": "changePassword", + "accessType": "EXECUTE", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" } ] }