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() })