Reduced amount of config settings for public interface calls.
This commit is contained in:
parent
af6e665ea7
commit
bf8c670b8f
3 changed files with 59 additions and 9 deletions
|
@ -380,8 +380,11 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
# config
|
||||
config = {}
|
||||
Setting.select('name').where(frontend: true).each { |setting|
|
||||
config[setting.name] = Setting.get(setting.name)
|
||||
Setting.select('name, preferences').where(frontend: true).each { |setting|
|
||||
next if setting.preferences[:authentication] == true && !current_user
|
||||
value = Setting.get(setting.name)
|
||||
next if !current_user && (value == false || value.nil?)
|
||||
config[setting.name] = value
|
||||
}
|
||||
|
||||
# remember if we can to swich back to user
|
||||
|
@ -390,7 +393,9 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
|
||||
# remember session_id for websocket logon
|
||||
if current_user
|
||||
config['session_id'] = session.id
|
||||
end
|
||||
|
||||
config
|
||||
end
|
||||
|
|
14
db/migrate/20160817000002_update_setting_cti.rb
Normal file
14
db/migrate/20160817000002_update_setting_cti.rb
Normal file
|
@ -0,0 +1,14 @@
|
|||
class UpdateSettingCti < ActiveRecord::Migration
|
||||
def up
|
||||
setting = Setting.find_by(name: 'sipgate_integration')
|
||||
setting.frontend = true
|
||||
setting.preferences[:authentication] = true
|
||||
setting.save!
|
||||
|
||||
%w(system_id ticket_hook customer_ticket_create customer_ticket_create_group_ids customer_ticket_view models_searchable tag_new defaults_calendar_subscriptions_tickets).each { |name|
|
||||
setting = Setting.find_by(name: name)
|
||||
setting.preferences[:authentication] = true
|
||||
setting.save!
|
||||
}
|
||||
end
|
||||
end
|
43
db/seeds.rb
43
db/seeds.rb
|
@ -158,7 +158,11 @@ Setting.create_if_not_exists(
|
|||
],
|
||||
},
|
||||
state: system_id,
|
||||
preferences: { online_service_disable: true, placeholder: true },
|
||||
preferences: {
|
||||
online_service_disable: true,
|
||||
placeholder: true,
|
||||
authentication: true,
|
||||
},
|
||||
frontend: true
|
||||
)
|
||||
Setting.create_if_not_exists(
|
||||
|
@ -1001,7 +1005,11 @@ Setting.create_if_not_exists(
|
|||
},
|
||||
],
|
||||
},
|
||||
preferences: { render: true, placeholder: true },
|
||||
preferences: {
|
||||
render: true,
|
||||
placeholder: true,
|
||||
authentication: true,
|
||||
},
|
||||
state: 'Ticket#',
|
||||
frontend: true
|
||||
)
|
||||
|
@ -1173,6 +1181,9 @@ Setting.create_if_not_exists(
|
|||
],
|
||||
},
|
||||
state: true,
|
||||
preferences: {
|
||||
authentication: true,
|
||||
},
|
||||
frontend: true
|
||||
)
|
||||
|
||||
|
@ -1195,6 +1206,9 @@ Setting.create_if_not_exists(
|
|||
],
|
||||
},
|
||||
state: '',
|
||||
preferences: {
|
||||
authentication: true,
|
||||
},
|
||||
frontend: true
|
||||
)
|
||||
|
||||
|
@ -1218,6 +1232,9 @@ Setting.create_if_not_exists(
|
|||
],
|
||||
},
|
||||
state: true,
|
||||
preferences: {
|
||||
authentication: true,
|
||||
},
|
||||
frontend: true
|
||||
)
|
||||
|
||||
|
@ -1498,7 +1515,9 @@ Setting.create_if_not_exists(
|
|||
},
|
||||
],
|
||||
},
|
||||
preferences: { trigger: ['menu:render', 'chat:rerender'] },
|
||||
preferences: {
|
||||
trigger: ['menu:render', 'chat:rerender']
|
||||
},
|
||||
state: false,
|
||||
frontend: true
|
||||
)
|
||||
|
@ -1518,7 +1537,6 @@ Setting.create_if_not_exists(
|
|||
},
|
||||
],
|
||||
},
|
||||
preferences: {},
|
||||
state: '120',
|
||||
frontend: true
|
||||
)
|
||||
|
@ -1530,6 +1548,9 @@ Setting.create_if_not_exists(
|
|||
description: 'Define the models which can be searched for.',
|
||||
options: {},
|
||||
state: [],
|
||||
preferences: {
|
||||
authentication: true,
|
||||
},
|
||||
frontend: true,
|
||||
)
|
||||
|
||||
|
@ -1802,6 +1823,9 @@ Setting.create_if_not_exists(
|
|||
},
|
||||
],
|
||||
},
|
||||
preferences: {
|
||||
authentication: true,
|
||||
},
|
||||
state: true,
|
||||
frontend: true
|
||||
)
|
||||
|
@ -1826,6 +1850,9 @@ Setting.create_if_not_exists(
|
|||
not_assigned: false,
|
||||
}
|
||||
},
|
||||
preferences: {
|
||||
authentication: true,
|
||||
},
|
||||
frontend: true
|
||||
)
|
||||
|
||||
|
@ -2183,8 +2210,12 @@ Setting.create_if_not_exists(
|
|||
],
|
||||
},
|
||||
state: false,
|
||||
preferences: { prio: 1, trigger: ['menu:render', 'cti:reload'] },
|
||||
frontend: false
|
||||
preferences: {
|
||||
prio: 1,
|
||||
trigger: ['menu:render', 'cti:reload'],
|
||||
authentication: true,
|
||||
},
|
||||
frontend: true
|
||||
)
|
||||
Setting.create_if_not_exists(
|
||||
title: 'sipgate.io config',
|
||||
|
|
Loading…
Reference in a new issue