fixes #4780 Quitar verificación de rol salesPerson del código #1156

Merged
alexandre merged 1 commits from 4780-quitar-verificacion into dev 2022-11-17 10:30:04 +00:00
2 changed files with 0 additions and 21 deletions

View File

@ -23,12 +23,6 @@ module.exports = Self => {
Self.setPassword = async function(ctx, id, newPassword) { Self.setPassword = async function(ctx, id, newPassword) {
const models = Self.app.models; const models = Self.app.models;
const userId = ctx.req.accessToken.userId;
const isSalesPerson = await models.Account.hasRole(userId, 'salesPerson');
if (!isSalesPerson)
throw new UserError(`Not enough privileges to edit a client`);
const isClient = await models.Client.findById(id, null); const isClient = await models.Client.findById(id, null);
const isUserAccount = await models.UserAccount.findById(id, null); const isUserAccount = await models.UserAccount.findById(id, null);

View File

@ -6,21 +6,6 @@ describe('Client setPassword', () => {
req: {accessToken: {userId: salesPersonId}} req: {accessToken: {userId: salesPersonId}}
}; };
it(`should throw an error if you don't have enough permissions`, async() => {
let error;
const employeeId = 1;
const ctx = {
req: {accessToken: {userId: employeeId}}
};
try {
await models.Client.setPassword(ctx, 1, 't0pl3v3l.p455w0rd!');
} catch (e) {
error = e;
}
expect(error.message).toEqual(`Not enough privileges to edit a client`);
});
it('should throw an error the setPassword target is not just a client but a worker', async() => { it('should throw an error the setPassword target is not just a client but a worker', async() => {
let error; let error;