Skip to content

Commit

Permalink
yet another test
Browse files Browse the repository at this point in the history
  • Loading branch information
KevLehman committed Jun 22, 2022
1 parent d0c4fa0 commit a996183
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions apps/meteor/app/livechat/imports/server/rest/departments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ API.v1.addRoute(
{ authRequired: true },
{
async get() {
if (!hasAtLeastOnePermission(this.userId, ['view-livechat-departments', 'view-l-room'])) {
return API.v1.unauthorized();
}

check(this.urlParams, {
_id: String,
});
Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/tests/end-to-end/api/livechat/01-department.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('LIVECHAT - departments', function () {
.expect(403)
.expect((res) => {
expect(res.body).to.have.property('success', false);
expect(res.body.error).to.be.equal('error-not-authorized');
expect(res.body.error).to.be.equal('unauthorized');
})
.end(done);
});
Expand Down Expand Up @@ -90,7 +90,7 @@ describe('LIVECHAT - departments', function () {
.get(api(`livechat/department/${department._id}`))
.set(credentials)
.expect('Content-Type', 'application/json')
.expect(400)
.expect(403)
.expect((res) => {
expect(res.body).to.have.property('success', false);
expect(res.body.error).to.be.equal('error-not-authorized');
Expand Down

0 comments on commit a996183

Please sign in to comment.