Fixes #3226 - In the role settings a role can not be agent and customer at the same time.
This commit is contained in:
parent
93550ad494
commit
1a42d9ada3
2 changed files with 13 additions and 6 deletions
12
db/migrate/20201005084847_agent_customer_permission.rb
Normal file
12
db/migrate/20201005084847_agent_customer_permission.rb
Normal file
|
@ -0,0 +1,12 @@
|
|||
class AgentCustomerPermission < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
|
||||
# return if it's a new setup
|
||||
return if !Setting.exists?(name: 'system_init_done')
|
||||
|
||||
Permission.where(name: ['ticket.agent', 'ticket.customer', 'chat.agent', 'cti.agent']).each do |permission|
|
||||
permission.preferences.delete(:not)
|
||||
permission.save!
|
||||
end
|
||||
end
|
||||
end
|
|
@ -336,16 +336,13 @@ Permission.create_if_not_exists(
|
|||
name: 'ticket.agent',
|
||||
note: 'Access to Agent Tickets based on Group Access',
|
||||
preferences: {
|
||||
not: ['ticket.customer'],
|
||||
plugin: ['groups']
|
||||
},
|
||||
)
|
||||
Permission.create_if_not_exists(
|
||||
name: 'ticket.customer',
|
||||
note: 'Access to Customer Tickets based on current_user and organization',
|
||||
preferences: {
|
||||
not: ['ticket.agent'],
|
||||
},
|
||||
preferences: {},
|
||||
)
|
||||
Permission.create_if_not_exists(
|
||||
name: 'chat',
|
||||
|
@ -359,7 +356,6 @@ Permission.create_if_not_exists(
|
|||
note: 'Access to %s',
|
||||
preferences: {
|
||||
translations: ['Chat'],
|
||||
not: ['chat.customer'],
|
||||
},
|
||||
)
|
||||
Permission.create_if_not_exists(
|
||||
|
@ -374,7 +370,6 @@ Permission.create_if_not_exists(
|
|||
note: 'Access to %s',
|
||||
preferences: {
|
||||
translations: ['CTI'],
|
||||
not: ['cti.customer'],
|
||||
},
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue