Reduced amount of config settings for public interface calls.

This commit is contained in:
Martin Edenhofer 2016-08-18 00:37:06 +02:00
parent af6e665ea7
commit bf8c670b8f
3 changed files with 59 additions and 9 deletions

View file

@ -380,8 +380,11 @@ class ApplicationController < ActionController::Base
# config # config
config = {} config = {}
Setting.select('name').where(frontend: true).each { |setting| Setting.select('name, preferences').where(frontend: true).each { |setting|
config[setting.name] = Setting.get(setting.name) 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 # remember if we can to swich back to user
@ -390,7 +393,9 @@ class ApplicationController < ActionController::Base
end end
# remember session_id for websocket logon # remember session_id for websocket logon
config['session_id'] = session.id if current_user
config['session_id'] = session.id
end
config config
end end

View 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

View file

@ -158,7 +158,11 @@ Setting.create_if_not_exists(
], ],
}, },
state: system_id, state: system_id,
preferences: { online_service_disable: true, placeholder: true }, preferences: {
online_service_disable: true,
placeholder: true,
authentication: true,
},
frontend: true frontend: true
) )
Setting.create_if_not_exists( 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#', state: 'Ticket#',
frontend: true frontend: true
) )
@ -1173,6 +1181,9 @@ Setting.create_if_not_exists(
], ],
}, },
state: true, state: true,
preferences: {
authentication: true,
},
frontend: true frontend: true
) )
@ -1195,6 +1206,9 @@ Setting.create_if_not_exists(
], ],
}, },
state: '', state: '',
preferences: {
authentication: true,
},
frontend: true frontend: true
) )
@ -1218,6 +1232,9 @@ Setting.create_if_not_exists(
], ],
}, },
state: true, state: true,
preferences: {
authentication: true,
},
frontend: 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, state: false,
frontend: true frontend: true
) )
@ -1518,7 +1537,6 @@ Setting.create_if_not_exists(
}, },
], ],
}, },
preferences: {},
state: '120', state: '120',
frontend: true frontend: true
) )
@ -1530,6 +1548,9 @@ Setting.create_if_not_exists(
description: 'Define the models which can be searched for.', description: 'Define the models which can be searched for.',
options: {}, options: {},
state: [], state: [],
preferences: {
authentication: true,
},
frontend: true, frontend: true,
) )
@ -1802,6 +1823,9 @@ Setting.create_if_not_exists(
}, },
], ],
}, },
preferences: {
authentication: true,
},
state: true, state: true,
frontend: true frontend: true
) )
@ -1826,6 +1850,9 @@ Setting.create_if_not_exists(
not_assigned: false, not_assigned: false,
} }
}, },
preferences: {
authentication: true,
},
frontend: true frontend: true
) )
@ -2183,8 +2210,12 @@ Setting.create_if_not_exists(
], ],
}, },
state: false, state: false,
preferences: { prio: 1, trigger: ['menu:render', 'cti:reload'] }, preferences: {
frontend: false prio: 1,
trigger: ['menu:render', 'cti:reload'],
authentication: true,
},
frontend: true
) )
Setting.create_if_not_exists( Setting.create_if_not_exists(
title: 'sipgate.io config', title: 'sipgate.io config',