From 7a0479d900d3c9ea324fa113a7343a8e603f75e8 Mon Sep 17 00:00:00 2001 From: Chris Brame Date: Sun, 17 Feb 2019 20:41:16 -0500 Subject: [PATCH] fix(test): updates for role permissions --- src/controllers/api/v1/users.js | 2 +- test/source/permissions.js | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/controllers/api/v1/users.js b/src/controllers/api/v1/users.js index 74c66b736..9763aba67 100644 --- a/src/controllers/api/v1/users.js +++ b/src/controllers/api/v1/users.js @@ -549,7 +549,7 @@ apiUsers.deleteUser = function (req, res) { return cb({ message: 'Cannot remove yourself!' }) } - if (!permissions.canThis(req.user.role, 'account:delete')) return cb({ message: 'Access Denied' }) + if (!permissions.canThis(req.user.role, 'accounts:delete')) return cb({ message: 'Access Denied' }) // TODO: FIX THIS FOR HIERARCHY!! // if (req.user.role.toLowerCase() === 'support' || req.user.role.toLowerCase() === 'user') { diff --git a/test/source/permissions.js b/test/source/permissions.js index 511301e64..ddd542317 100644 --- a/test/source/permissions.js +++ b/test/source/permissions.js @@ -13,16 +13,16 @@ describe('premissions.js', function () { done() }) - it('should allow comment creation', function(done) { - var result = permissions.canThis(global.supportRoleId, 'comment:create'); + it('should allow comment creation', function (done) { + var result = permissions.canThis(global.supportRoleId, 'comments:create') expect(result).to.be.true done() }) - it('show allow note creation', function(done) { - var result = permissions.canThis(global.supportRoleId, 'note:create'); + it('show allow note creation', function (done) { + var result = permissions.canThis(global.supportRoleId, 'tickets:notes') expect(result).to.be.true @@ -30,9 +30,9 @@ describe('premissions.js', function () { }) it('should get roles with action', function (done) { - var results = permissions.getRoles('ticket:create') + var results = permissions.getRoles('tickets:create') - expect(results).to.have.length(3); + expect(results).to.have.length(3) done() })