Fixes #3194 - Granular admin permission for google channel is missing.
This commit is contained in:
parent
61406365f0
commit
ac5fcedc6a
5 changed files with 52 additions and 15 deletions
|
@ -1,5 +1,5 @@
|
||||||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
class Controllers::PostmasterFiltersControllerPolicy < Controllers::ApplicationControllerPolicy
|
class Controllers::PostmasterFiltersControllerPolicy < Controllers::ApplicationControllerPolicy
|
||||||
default_permit!('admin.channel_email')
|
default_permit!(['admin.channel_email', 'admin.channel_google', 'admin.channel_microsoft365'])
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
class Controllers::SignaturesControllerPolicy < Controllers::ApplicationControllerPolicy
|
class Controllers::SignaturesControllerPolicy < Controllers::ApplicationControllerPolicy
|
||||||
permit! %i[index show], to: ['ticket.agent', 'admin.channel_email']
|
permit! %i[index show], to: ['ticket.agent', 'admin.channel_email', 'admin.channel_google', 'admin.channel_microsoft365']
|
||||||
permit! %i[create update destroy], to: 'admin.channel_email'
|
permit! %i[create update destroy], to: ['admin.channel_email', 'admin.channel_google', 'admin.channel_microsoft365']
|
||||||
end
|
end
|
||||||
|
|
28
db/migrate/20210914153600_issue_3194_update_permissions.rb
Normal file
28
db/migrate/20210914153600_issue_3194_update_permissions.rb
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
|
class Issue3194UpdatePermissions < ActiveRecord::Migration[6.0]
|
||||||
|
def change
|
||||||
|
# return if it's a new setup
|
||||||
|
return if !Setting.exists?(name: 'system_init_done')
|
||||||
|
|
||||||
|
settings = %w[
|
||||||
|
ticket_subject_size
|
||||||
|
ticket_subject_re
|
||||||
|
ticket_subject_fwd
|
||||||
|
ticket_define_email_from
|
||||||
|
ticket_define_email_from_separator
|
||||||
|
postmaster_max_size
|
||||||
|
postmaster_follow_up_search_in
|
||||||
|
postmaster_sender_based_on_reply_to
|
||||||
|
postmaster_sender_is_agent_search_for_customer
|
||||||
|
postmaster_send_reject_if_mail_too_large
|
||||||
|
notification_sender
|
||||||
|
send_no_auto_response_reg_exp
|
||||||
|
]
|
||||||
|
|
||||||
|
Setting.where(name: settings).each do |setting|
|
||||||
|
setting.preferences[:permission] += ['admin.channel_google', 'admin.channel_microsoft365']
|
||||||
|
setting.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -2530,7 +2530,7 @@ Setting.create_if_not_exists(
|
||||||
},
|
},
|
||||||
state: '110',
|
state: '110',
|
||||||
preferences: {
|
preferences: {
|
||||||
permission: ['admin.channel_email'],
|
permission: ['admin.channel_email', 'admin.channel_google', 'admin.channel_microsoft365'],
|
||||||
},
|
},
|
||||||
frontend: false
|
frontend: false
|
||||||
)
|
)
|
||||||
|
@ -2551,7 +2551,7 @@ Setting.create_if_not_exists(
|
||||||
},
|
},
|
||||||
state: 'RE',
|
state: 'RE',
|
||||||
preferences: {
|
preferences: {
|
||||||
permission: ['admin.channel_email'],
|
permission: ['admin.channel_email', 'admin.channel_google', 'admin.channel_microsoft365'],
|
||||||
},
|
},
|
||||||
frontend: false
|
frontend: false
|
||||||
)
|
)
|
||||||
|
@ -2573,7 +2573,7 @@ Setting.create_if_not_exists(
|
||||||
},
|
},
|
||||||
state: 'FWD',
|
state: 'FWD',
|
||||||
preferences: {
|
preferences: {
|
||||||
permission: ['admin.channel_email'],
|
permission: ['admin.channel_email', 'admin.channel_google', 'admin.channel_microsoft365'],
|
||||||
},
|
},
|
||||||
frontend: false
|
frontend: false
|
||||||
)
|
)
|
||||||
|
@ -2600,7 +2600,7 @@ Setting.create_if_not_exists(
|
||||||
},
|
},
|
||||||
state: 'AgentNameSystemAddressName',
|
state: 'AgentNameSystemAddressName',
|
||||||
preferences: {
|
preferences: {
|
||||||
permission: ['admin.channel_email'],
|
permission: ['admin.channel_email', 'admin.channel_google', 'admin.channel_microsoft365'],
|
||||||
},
|
},
|
||||||
frontend: false
|
frontend: false
|
||||||
)
|
)
|
||||||
|
@ -2622,7 +2622,7 @@ Setting.create_if_not_exists(
|
||||||
},
|
},
|
||||||
state: 'via',
|
state: 'via',
|
||||||
preferences: {
|
preferences: {
|
||||||
permission: ['admin.channel_email'],
|
permission: ['admin.channel_email', 'admin.channel_google', 'admin.channel_microsoft365'],
|
||||||
},
|
},
|
||||||
frontend: false
|
frontend: false
|
||||||
)
|
)
|
||||||
|
@ -2672,7 +2672,7 @@ Setting.create_if_not_exists(
|
||||||
state: 10,
|
state: 10,
|
||||||
preferences: {
|
preferences: {
|
||||||
online_service_disable: true,
|
online_service_disable: true,
|
||||||
permission: ['admin.channel_email'],
|
permission: ['admin.channel_email', 'admin.channel_google', 'admin.channel_microsoft365'],
|
||||||
},
|
},
|
||||||
frontend: false
|
frontend: false
|
||||||
)
|
)
|
||||||
|
@ -2699,7 +2699,7 @@ Setting.create_if_not_exists(
|
||||||
},
|
},
|
||||||
state: [],
|
state: [],
|
||||||
preferences: {
|
preferences: {
|
||||||
permission: ['admin.channel_email'],
|
permission: ['admin.channel_email', 'admin.channel_google', 'admin.channel_microsoft365'],
|
||||||
},
|
},
|
||||||
frontend: false
|
frontend: false
|
||||||
)
|
)
|
||||||
|
@ -2726,7 +2726,7 @@ Setting.create_if_not_exists(
|
||||||
},
|
},
|
||||||
state: [],
|
state: [],
|
||||||
preferences: {
|
preferences: {
|
||||||
permission: ['admin.channel_email'],
|
permission: ['admin.channel_email', 'admin.channel_google', 'admin.channel_microsoft365'],
|
||||||
},
|
},
|
||||||
frontend: false
|
frontend: false
|
||||||
)
|
)
|
||||||
|
@ -2752,7 +2752,7 @@ Setting.create_if_not_exists(
|
||||||
},
|
},
|
||||||
state: true,
|
state: true,
|
||||||
preferences: {
|
preferences: {
|
||||||
permission: ['admin.channel_email'],
|
permission: ['admin.channel_email', 'admin.channel_google', 'admin.channel_microsoft365'],
|
||||||
},
|
},
|
||||||
frontend: false
|
frontend: false
|
||||||
)
|
)
|
||||||
|
@ -2779,7 +2779,7 @@ Setting.create_if_not_exists(
|
||||||
state: true,
|
state: true,
|
||||||
preferences: {
|
preferences: {
|
||||||
online_service_disable: true,
|
online_service_disable: true,
|
||||||
permission: ['admin.channel_email'],
|
permission: ['admin.channel_email', 'admin.channel_google', 'admin.channel_microsoft365'],
|
||||||
},
|
},
|
||||||
frontend: false
|
frontend: false
|
||||||
)
|
)
|
||||||
|
@ -2802,7 +2802,7 @@ Setting.create_if_not_exists(
|
||||||
state: '#{config.product_name} <noreply@#{config.fqdn}>', # rubocop:disable Lint/InterpolationCheck
|
state: '#{config.product_name} <noreply@#{config.fqdn}>', # rubocop:disable Lint/InterpolationCheck
|
||||||
preferences: {
|
preferences: {
|
||||||
online_service_disable: true,
|
online_service_disable: true,
|
||||||
permission: ['admin.channel_email'],
|
permission: ['admin.channel_email', 'admin.channel_google', 'admin.channel_microsoft365'],
|
||||||
},
|
},
|
||||||
frontend: false
|
frontend: false
|
||||||
)
|
)
|
||||||
|
@ -2825,7 +2825,7 @@ Setting.create_if_not_exists(
|
||||||
state: '(mailer-daemon|postmaster|abuse|root|noreply|noreply.+?|no-reply|no-reply.+?)@.+?',
|
state: '(mailer-daemon|postmaster|abuse|root|noreply|noreply.+?|no-reply|no-reply.+?)@.+?',
|
||||||
preferences: {
|
preferences: {
|
||||||
online_service_disable: true,
|
online_service_disable: true,
|
||||||
permission: ['admin.channel_email'],
|
permission: ['admin.channel_email', 'admin.channel_google', 'admin.channel_microsoft365'],
|
||||||
},
|
},
|
||||||
frontend: false
|
frontend: false
|
||||||
)
|
)
|
||||||
|
|
9
spec/db/migrate/issue_3194_update_permissions_spec.rb
Normal file
9
spec/db/migrate/issue_3194_update_permissions_spec.rb
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe Issue3194UpdatePermissions, type: :db_migration do
|
||||||
|
it 'does update settings with new permissions' do
|
||||||
|
expect { migrate }.to change { Setting.find_by(name: 'ticket_subject_size').preferences[:permission] }.to include('admin.channel_google', 'admin.channel_microsoft365')
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue