diff --git a/client/ticket/routes.json b/client/ticket/routes.json index 2b99027a9..2d481ba72 100644 --- a/client/ticket/routes.json +++ b/client/ticket/routes.json @@ -153,7 +153,8 @@ "menu": { "description": "Tracking", "icon": "remove_red_eye" - } + }, + "acl": ["production"] }, { "url": "/edit", diff --git a/services/ticket/common/models/ticket-tracking.js b/services/ticket/common/models/ticket-tracking.js index 464436daa..22db92406 100644 --- a/services/ticket/common/models/ticket-tracking.js +++ b/services/ticket/common/models/ticket-tracking.js @@ -8,14 +8,6 @@ module.exports = function(Self) { let token = ctx.options.accessToken; let userId = token && token.userId; - let isEmployee = await models.Account.hasRole(userId, 'employee'); - let isProduction = await models.Account.hasRole(userId, 'production'); - let isAlertLevelZero = await models.State.isAlertLevelZero(ctx.instance.stateFk); - let ticketAlertLevel = await models.TicketState.findOne({where: {id: ctx.instance.ticketFk}, fields: ["alertLevel"]}); - - if ((!isProduction && !isAlertLevelZero) || !isEmployee || (isEmployee && ticketAlertLevel != 0 && !isProduction)) - throw new Error("You don't have enough privileges to do that"); - let user = await models.Worker.findOne({where: {userFk: userId}}); ctx.instance.workerFk = user.id; });