Skip to content

Commit

Permalink
fix(test): updates for role permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
polonel committed Feb 18, 2019
1 parent 2752ec3 commit 7a0479d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/controllers/api/v1/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down
12 changes: 6 additions & 6 deletions test/source/permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,26 @@ 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

done()
})

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

0 comments on commit 7a0479d

Please sign in to comment.