Improved client ticket editable check.

This commit is contained in:
Martin Edenhofer 2018-01-29 04:04:00 +01:00
parent 724879c6c8
commit 5e3f854cca

View file

@ -249,9 +249,14 @@ class App.Ticket extends App.Model
user_id = App.Session.get('id') user_id = App.Session.get('id')
return true if user_id is @customer_id return true if user_id is @customer_id
group_ids = App.Session.get('group_ids') group_ids = App.Session.get('group_ids')
if _.isEmpty(group_ids[@group_id]) if group_ids
return false return true if group_ids[@group_id] && (_.include(group_ids[@group_id], 'change') || _.include(group_ids[@group_id], 'full'))
else if group_ids[@group_id] && !_.include(group_ids[@group_id], 'change') && !_.include(group_ids[@group_id], 'full') role_ids = App.Session.get('role_ids')
return false if role_ids
true 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'))
false