Fixed issue #1810: To high permissions required to move Ticket into Group (change) and receive notification about changes (full).

This commit is contained in:
Thorsten Eckel 2018-02-23 08:23:13 +01:00
parent 8005d3aee5
commit 196672c50e
3 changed files with 10 additions and 14 deletions

View file

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

View file

@ -49,7 +49,7 @@ class Transaction::Notification
recipients_reason = {} recipients_reason = {}
# loop through all users # loop through all users
possible_recipients = User.group_access(ticket.group_id, 'full').sort_by(&:login) possible_recipients = User.group_access(ticket.group_id, 'read').sort_by(&:login)
# apply owner # apply owner
if ticket.owner_id != 1 if ticket.owner_id != 1

View file

@ -140,10 +140,10 @@ class TicketScreenOptionsTest < ActiveSupport::TestCase
assert(result[:form_meta][:filter][:type_id]) assert(result[:form_meta][:filter][:type_id])
assert_equal([], result[:form_meta][:filter][:type_id].sort) assert_equal([], result[:form_meta][:filter][:type_id].sort)
assert(result[:form_meta][:filter][:group_id]) assert(result[:form_meta][:filter][:group_id])
assert_equal([group1.id, group3.id], result[:form_meta][:filter][:group_id].sort) assert_equal([group1.id, group2.id, group3.id], result[:form_meta][:filter][:group_id].sort)
assert(result[:form_meta][:dependencies]) assert(result[:form_meta][:dependencies])
assert(result[:form_meta][:dependencies][:group_id]) assert(result[:form_meta][:dependencies][:group_id])
assert_equal(3, result[:form_meta][:dependencies][:group_id].count) assert_equal(4, result[:form_meta][:dependencies][:group_id].count)
assert(result[:form_meta][:dependencies][:group_id]['']) assert(result[:form_meta][:dependencies][:group_id][''])
assert(result[:form_meta][:dependencies][:group_id][''][:owner_id]) assert(result[:form_meta][:dependencies][:group_id][''][:owner_id])
assert_equal([], result[:form_meta][:dependencies][:group_id][''][:owner_id]) assert_equal([], result[:form_meta][:dependencies][:group_id][''][:owner_id])
@ -182,10 +182,10 @@ class TicketScreenOptionsTest < ActiveSupport::TestCase
assert(result[:form_meta][:filter][:type_id]) assert(result[:form_meta][:filter][:type_id])
assert_equal([], result[:form_meta][:filter][:type_id].sort) assert_equal([], result[:form_meta][:filter][:type_id].sort)
assert(result[:form_meta][:filter][:group_id]) assert(result[:form_meta][:filter][:group_id])
assert_equal([group1.id, group3.id], result[:form_meta][:filter][:group_id].sort) assert_equal([group1.id, group2.id, group3.id], result[:form_meta][:filter][:group_id].sort)
assert(result[:form_meta][:dependencies]) assert(result[:form_meta][:dependencies])
assert(result[:form_meta][:dependencies][:group_id]) assert(result[:form_meta][:dependencies][:group_id])
assert_equal(3, result[:form_meta][:dependencies][:group_id].count) assert_equal(4, result[:form_meta][:dependencies][:group_id].count)
assert(result[:form_meta][:dependencies][:group_id]['']) assert(result[:form_meta][:dependencies][:group_id][''])
assert(result[:form_meta][:dependencies][:group_id][''][:owner_id]) assert(result[:form_meta][:dependencies][:group_id][''][:owner_id])
assert_equal([], result[:form_meta][:dependencies][:group_id][''][:owner_id]) assert_equal([], result[:form_meta][:dependencies][:group_id][''][:owner_id])
@ -467,10 +467,10 @@ class TicketScreenOptionsTest < ActiveSupport::TestCase
Ticket::Article::Type.lookup(name: 'note').id, Ticket::Article::Type.lookup(name: 'note').id,
], result[:form_meta][:filter][:type_id].sort) ], result[:form_meta][:filter][:type_id].sort)
assert(result[:form_meta][:filter][:group_id]) assert(result[:form_meta][:filter][:group_id])
assert_equal([group1.id, group2.id], result[:form_meta][:filter][:group_id].sort) assert_equal([group1.id, group2.id, group3.id], result[:form_meta][:filter][:group_id].sort)
assert(result[:form_meta][:dependencies]) assert(result[:form_meta][:dependencies])
assert(result[:form_meta][:dependencies][:group_id]) assert(result[:form_meta][:dependencies][:group_id])
assert_equal(3, result[:form_meta][:dependencies][:group_id].count) assert_equal(4, result[:form_meta][:dependencies][:group_id].count)
assert(result[:form_meta][:dependencies][:group_id]['']) assert(result[:form_meta][:dependencies][:group_id][''])
assert(result[:form_meta][:dependencies][:group_id][''][:owner_id]) assert(result[:form_meta][:dependencies][:group_id][''][:owner_id])
assert_equal([], result[:form_meta][:dependencies][:group_id][''][:owner_id]) assert_equal([], result[:form_meta][:dependencies][:group_id][''][:owner_id])
@ -513,10 +513,10 @@ class TicketScreenOptionsTest < ActiveSupport::TestCase
Ticket::Article::Type.lookup(name: 'note').id, Ticket::Article::Type.lookup(name: 'note').id,
], result[:form_meta][:filter][:type_id].sort) ], result[:form_meta][:filter][:type_id].sort)
assert(result[:form_meta][:filter][:group_id]) assert(result[:form_meta][:filter][:group_id])
assert_equal([group1.id, group2.id], result[:form_meta][:filter][:group_id].sort) assert_equal([group1.id, group2.id, group3.id], result[:form_meta][:filter][:group_id].sort)
assert(result[:form_meta][:dependencies]) assert(result[:form_meta][:dependencies])
assert(result[:form_meta][:dependencies][:group_id]) assert(result[:form_meta][:dependencies][:group_id])
assert_equal(3, result[:form_meta][:dependencies][:group_id].count) assert_equal(4, result[:form_meta][:dependencies][:group_id].count)
assert(result[:form_meta][:dependencies][:group_id]['']) assert(result[:form_meta][:dependencies][:group_id][''])
assert(result[:form_meta][:dependencies][:group_id][''][:owner_id]) assert(result[:form_meta][:dependencies][:group_id][''][:owner_id])
assert_equal([], result[:form_meta][:dependencies][:group_id][''][:owner_id]) assert_equal([], result[:form_meta][:dependencies][:group_id][''][:owner_id])