From 789afc592a51bc427993d0fc4fee13e4c8b83a5b Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Wed, 31 Jan 2018 10:26:41 +0100 Subject: [PATCH] Extended editable() method to parse requested permission type as argument. --- app/assets/javascripts/app/models/ticket.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/app/models/ticket.coffee b/app/assets/javascripts/app/models/ticket.coffee index 2897f6800..87865f956 100644 --- a/app/assets/javascripts/app/models/ticket.coffee +++ b/app/assets/javascripts/app/models/ticket.coffee @@ -245,18 +245,18 @@ class App.Ticket extends App.Model result - editable: -> + editable: (permission = 'change') -> user_id = App.Session.get('id') return true if user_id is @customer_id group_ids = App.Session.get('group_ids') if group_ids - return true if group_ids[@group_id] && (_.include(group_ids[@group_id], 'change') || _.include(group_ids[@group_id], 'full')) + return true if group_ids[@group_id] && (_.include(group_ids[@group_id], permission) || _.include(group_ids[@group_id], 'full')) role_ids = App.Session.get('role_ids') if role_ids for role_id in role_ids if App.Role.exists(role_id) role = App.Role.find(role_id) if role.group_ids - return true if role.group_ids[@group_id] && (_.include(role.group_ids[@group_id], 'change') || _.include(role.group_ids[@group_id], 'full')) + return true if role.group_ids[@group_id] && (_.include(role.group_ids[@group_id], permission) || _.include(role.group_ids[@group_id], 'full')) false