Skip to content

Commit

Permalink
fix(api): v1 for group changes
Browse files Browse the repository at this point in the history
  • Loading branch information
polonel committed Apr 30, 2019
1 parent 969d3f2 commit 3d12667
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/controllers/api/v1/tickets.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,20 @@ apiTickets.get = function (req, res) {

var ticketModel = require('../../../models/ticket')
var groupModel = require('../../../models/group')
var departmentModel = require('../../../models/department')

async.waterfall(
[
function (callback) {
groupModel.getAllGroupsOfUserNoPopulate(user._id, function (err, grps) {
callback(err, grps)
})
if (user.role.isAdmin || user.role.isAgent) {
departmentModel.getDepartmentGroupsOfUser(user._id, function (err, groups) {
callback(err, groups)
})
} else {
groupModel.getAllGroupsOfUserNoPopulate(user._id, function (err, grps) {
callback(err, grps)
})
}
},
function (grps, callback) {
if (permissions.canThis(user.role, 'tickets:public')) {
Expand Down

0 comments on commit 3d12667

Please sign in to comment.