Show ticket edit form as disable if agent has read only permission.

This commit is contained in:
Martin Edenhofer 2017-12-12 12:18:17 +01:00
parent 09af88a578
commit d0a0dc7d37
5 changed files with 18 additions and 3 deletions

View file

@ -342,6 +342,7 @@ test:integration:zendesk_mysql:
- rake db:migrate
- ruby -I test/ test/integration/zendesk_import_test.rb
- rake db:drop
allow_failure: true
test:integration:zendesk_postgresql:
stage: test
@ -354,6 +355,7 @@ test:integration:zendesk_postgresql:
- rake db:migrate
- ruby -I test/ test/integration/zendesk_import_test.rb
- rake db:drop
allow_failure: true
test:integration:otrs_5_mysql:
stage: test

View file

@ -86,6 +86,9 @@ class App.ControllerForm extends App.Controller
for attribute in @attributes
attribute_count = attribute_count + 1
if @isDisabled == true
attribute.disabled = true
# add item
item = @formGenItem(attribute, className, fieldset, attribute_count)
item.appendTo(fieldset)

View file

@ -20,8 +20,9 @@ class Edit extends App.ObserverController
handlers: [
@ticketFormChanges
]
filter: @formMeta.filter
params: defaults
filter: @formMeta.filter
params: defaults
isDisabled: !ticket.editable()
#bookmarkable: true
)

View file

@ -244,3 +244,12 @@ class App.Ticket extends App.Model
throw "Unknown operator: #{condition.operator}"
result
editable: ->
group_ids = App.Session.get('group_ids')
if _.isEmpty(group_ids[@group_id])
return false
else if group_ids[@group_id] && !_.include(group_ids[@group_id], 'edit') && !_.include(group_ids[@group_id], 'full')
return false
true

View file

@ -90,7 +90,7 @@ returns
filter[:group_id] = []
groups = if params[:current_user].permissions?('ticket.agent')
params[:current_user].groups_access('create')
params[:current_user].groups_access(%w[create edit])
else
Group.where(active: true)
end