summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/api/rows_controller.rb2
-rw-r--r--app/controllers/application_controller.rb4
-rw-r--r--app/controllers/call_forwards_controller.rb4
-rw-r--r--app/controllers/call_histories_controller.rb2
-rw-r--r--app/controllers/conferences_controller.rb2
-rw-r--r--app/controllers/config_siemens_controller.rb26
-rw-r--r--app/controllers/config_snom_controller.rb22
-rw-r--r--app/controllers/fax_accounts_controller.rb4
-rw-r--r--app/controllers/gemeinschaft_setups_controller.rb2
-rw-r--r--app/controllers/gs_nodes_controller.rb2
-rw-r--r--app/controllers/gs_parameters_controller.rb41
-rw-r--r--app/controllers/phone_book_entries_controller.rb2
-rw-r--r--app/controllers/phone_books_controller.rb4
-rw-r--r--app/controllers/sessions_controller.rb2
-rw-r--r--app/controllers/sip_accounts_controller.rb16
-rw-r--r--app/controllers/voicemail_messages_controller.rb6
-rw-r--r--app/helpers/gs_parameters_helper.rb2
-rw-r--r--app/mailers/notifications.rb8
-rw-r--r--app/models/ability.rb2
-rw-r--r--app/models/access_authorization.rb4
-rw-r--r--app/models/api/row.rb2
-rw-r--r--app/models/call_forward.rb2
-rw-r--r--app/models/conference.rb4
-rw-r--r--app/models/conference_invitee.rb2
-rw-r--r--app/models/fax_document.rb4
-rw-r--r--app/models/gs_cluster_sync_log_entry.rb4
-rw-r--r--app/models/gs_parameter.rb37
-rw-r--r--app/models/hunt_group.rb8
-rw-r--r--app/models/phone_number.rb16
-rw-r--r--app/models/phone_number_range.rb2
-rw-r--r--app/models/sip_account.rb4
-rw-r--r--app/models/tenant.rb22
-rw-r--r--app/models/user.rb3
-rw-r--r--app/views/call_forwards/_form_core.html.haml2
-rw-r--r--app/views/callthroughs/_form_core.html.haml2
-rw-r--r--app/views/callthroughs/_index_core.html.haml4
-rw-r--r--app/views/callthroughs/show.html.haml2
-rw-r--r--app/views/conferences/_form_core.html.haml2
-rw-r--r--app/views/config_snom/show.xml.haml4
-rw-r--r--app/views/config_snom/state_settings.xml.haml2
-rw-r--r--app/views/gemeinschaft_setups/new.de.html.haml2
-rw-r--r--app/views/gemeinschaft_setups/new.html.haml2
-rw-r--r--app/views/gs_parameters/_form.html.haml7
-rw-r--r--app/views/gs_parameters/_form_core.html.haml6
-rw-r--r--app/views/gs_parameters/_index_core.html.haml17
-rw-r--r--app/views/gs_parameters/edit.html.haml3
-rw-r--r--app/views/gs_parameters/index.html.haml6
-rw-r--r--app/views/gs_parameters/new.html.haml3
-rw-r--r--app/views/gs_parameters/show.html.haml19
-rw-r--r--app/views/hunt_groups/_form_core.html.haml4
-rw-r--r--app/views/layouts/application.html.haml2
-rw-r--r--app/views/page/beginners_intro.de.html.haml4
-rw-r--r--app/views/page/beginners_intro.html.haml4
-rw-r--r--app/views/page/index.de.html.haml2
-rw-r--r--app/views/page/index.html.haml2
-rw-r--r--app/views/phones/_form_core.html.haml2
-rw-r--r--app/views/phones/show.html.haml2
-rw-r--r--app/views/tenants/_admin_area.de.html.haml6
-rw-r--r--app/views/tenants/_admin_area.html.haml6
-rw-r--r--app/views/tenants/_form.html.haml6
-rw-r--r--config/initializers/gemeinschaft_parameters.rb81
-rw-r--r--config/locales/views/gs_parameters/de.yml60
-rw-r--r--config/locales/views/gs_parameters/en.yml60
-rw-r--r--config/routes.rb8
-rw-r--r--db/migrate/20130105120126_create_gs_parameters.rb16
-rw-r--r--db/migrate/20130105120353_populate_gs_parameter_with_defaults.rb103
-rw-r--r--db/schema.rb12
-rw-r--r--db/to-dos/20120119160732_emergency_numbers_germany.rb4
-rw-r--r--do-it.sh47
-rw-r--r--lib/activerecord_extensions.rb6
-rw-r--r--lib/tasks/cvs_user_import.rake26
-rw-r--r--lib/tasks/fax.rake2
-rw-r--r--lib/tasks/gs_cluster.rake8
-rw-r--r--lib/tasks/send_fax_notifications.rake2
-rw-r--r--misc/freeswitch/scripts/dialplan/sip_call.lua4
-rwxr-xr-xscript/fax_new2
-rw-r--r--test/factories/phone_number_ranges.rb2
-rw-r--r--test/functional/gs_parameters_controller_test.rb49
-rw-r--r--test/unit/callthrough_test.rb10
-rw-r--r--test/unit/conference_test.rb6
-rw-r--r--test/unit/gs_parameter_test.rb7
-rw-r--r--test/unit/phone_number_test.rb2
82 files changed, 662 insertions, 245 deletions
diff --git a/app/controllers/api/rows_controller.rb b/app/controllers/api/rows_controller.rb
index 6e815eb..543aebe 100644
--- a/app/controllers/api/rows_controller.rb
+++ b/app/controllers/api/rows_controller.rb
@@ -84,7 +84,7 @@ class Api::RowsController < ApplicationController
private
def check_remote_ip_address_whitelist
- if !(REMOTE_IP_ADDRESS_WHITELIST.empty? or REMOTE_IP_ADDRESS_WHITELIST.include?(ENV['REMOTE_ADDR']))
+ if !(GsParameter.get('REMOTE_IP_ADDRESS_WHITELIST').empty? or GsParameter.get('REMOTE_IP_ADDRESS_WHITELIST').include?(ENV['REMOTE_ADDR']))
redirect_to root_url
end
end
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index c675f5c..e4165f3 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -54,8 +54,8 @@ class ApplicationController < ActionController::Base
# Generate a new random PIN
#
def random_pin
- if MINIMUM_PIN_LENGTH > 0
- (1..MINIMUM_PIN_LENGTH).map{|i| (0 .. 9).to_a.sample}.join
+ if GsParameter.get('MINIMUM_PIN_LENGTH') > 0
+ (1..GsParameter.get('MINIMUM_PIN_LENGTH')).map{|i| (0 .. 9).to_a.sample}.join
end
end
diff --git a/app/controllers/call_forwards_controller.rb b/app/controllers/call_forwards_controller.rb
index 5321b35..001ed60 100644
--- a/app/controllers/call_forwards_controller.rb
+++ b/app/controllers/call_forwards_controller.rb
@@ -21,10 +21,10 @@ class CallForwardsController < ApplicationController
def new
@call_forward = @phone_number.call_forwards.build
- @call_forward.depth = DEFAULT_CALL_FORWARD_DEPTH
+ @call_forward.depth = GsParameter.get('DEFAULT_CALL_FORWARD_DEPTH')
@call_forward.active = true
@call_forwarding_destinations = call_forwarding_destination_types()
- @call_forward.destination = CALLFORWARD_DESTINATION_DEFAULT.to_s if defined?(CALLFORWARD_DESTINATION_DEFAULT)
+ @call_forward.destination = GsParameter.get('CALLFORWARD_DESTINATION_DEFAULT').to_s if defined?(GsParameter.get('CALLFORWARD_DESTINATION_DEFAULT'))
@available_call_forward_cases = []
CallForwardCase.all.each do |available_call_forward_case|
diff --git a/app/controllers/call_histories_controller.rb b/app/controllers/call_histories_controller.rb
index f956f88..f711f34 100644
--- a/app/controllers/call_histories_controller.rb
+++ b/app/controllers/call_histories_controller.rb
@@ -22,7 +22,7 @@ class CallHistoriesController < ApplicationController
@call_histories = calls.paginate(
:page => @pagination_page_number,
- :per_page => DEFAULT_PAGINATION_ENTRIES_PER_PAGE
+ :per_page => GsParameter.get('DEFAULT_PAGINATION_ENTRIES_PER_PAGE')
)
@calls_count = calls.count
diff --git a/app/controllers/conferences_controller.rb b/app/controllers/conferences_controller.rb
index 302a23b..6091b46 100644
--- a/app/controllers/conferences_controller.rb
+++ b/app/controllers/conferences_controller.rb
@@ -19,7 +19,7 @@ class ConferencesController < ApplicationController
@conference.start = nil
@conference.end = nil
@conference.open_for_anybody = true
- @conference.max_members = DEFAULT_MAX_CONFERENCE_MEMBERS
+ @conference.max_members = GsParameter.get('DEFAULT_MAX_CONFERENCE_MEMBERS')
@conference.pin = random_pin
@conference.open_for_anybody = true
diff --git a/app/controllers/config_siemens_controller.rb b/app/controllers/config_siemens_controller.rb
index c09dfcf..b7fa107 100644
--- a/app/controllers/config_siemens_controller.rb
+++ b/app/controllers/config_siemens_controller.rb
@@ -64,8 +64,8 @@ class ConfigSiemensController < ApplicationController
if mac_address
@phone = Phone.find_by_mac_address(mac_address.gsub(':','').upcase)
- if ! @phone && PROVISIONING_AUTO_ADD_PHONE
- tenant = Tenant.where(:id => PROVISIONING_AUTO_TENANT_ID).first
+ if ! @phone && GsParameter.get('PROVISIONING_AUTO_ADD_PHONE')
+ tenant = Tenant.where(:id => GsParameter.get('PROVISIONING_AUTO_TENANT_ID')).first
if ! tenant
render(
:status => 404,
@@ -91,12 +91,12 @@ class ConfigSiemensController < ApplicationController
return
end
- if ! PROVISIONING_AUTO_ADD_SIP_ACCOUNT
+ if ! GsParameter.get('PROVISIONING_AUTO_ADD_SIP_ACCOUNT')
return
end
caller_name_index = 0
- sip_account_last = tenant.sip_accounts.where('caller_name LIKE ?', "#{PROVISIONING_AUTO_SIP_ACCOUNT_CALLER_PREFIX}%").sort { |item1, item2|
+ sip_account_last = tenant.sip_accounts.where('caller_name LIKE ?', "#{GsParameter.get('PROVISIONING_AUTO_SIP_ACCOUNT_CALLER_PREFIX')}%").sort { |item1, item2|
item1.caller_name.gsub(/[^0-9]/, '').to_i <=> item2.caller_name.gsub(/[^0-9]/, '').to_i
}.last
@@ -106,18 +106,18 @@ class ConfigSiemensController < ApplicationController
caller_name_index = caller_name_index + 1
@sip_account = tenant.sip_accounts.build
- @sip_account.caller_name = "#{PROVISIONING_AUTO_SIP_ACCOUNT_CALLER_PREFIX}#{caller_name_index}"
- @sip_account.call_waiting = CALL_WAITING
- @sip_account.clir = DEFAULT_CLIR_SETTING
- @sip_account.clip = DEFAULT_CLIP_SETTING
+ @sip_account.caller_name = "#{GsParameter.get('PROVISIONING_AUTO_SIP_ACCOUNT_CALLER_PREFIX')}#{caller_name_index}"
+ @sip_account.call_waiting = GsParameter.get('CALL_WAITING')
+ @sip_account.clir = GsParameter.get('DEFAULT_CLIR_SETTING')
+ @sip_account.clip = GsParameter.get('DEFAULT_CLIP_SETTING')
@sip_account.voicemail_pin = random_pin
- @sip_account.callforward_rules_act_per_sip_account = CALLFORWARD_RULES_ACT_PER_SIP_ACCOUNT_DEFAULT
+ @sip_account.callforward_rules_act_per_sip_account = GsParameter.get('CALLFORWARD_RULES_ACT_PER_SIP_ACCOUNT_DEFAULT')
@sip_account.hotdeskable = false
loop do
- @sip_account.auth_name = SecureRandom.hex(DEFAULT_LENGTH_SIP_AUTH_NAME)
+ @sip_account.auth_name = SecureRandom.hex(GsParameter.get('DEFAULT_LENGTH_SIP_AUTH_NAME'))
break unless SipAccount.exists?(:auth_name => @sip_account.auth_name)
end
- @sip_account.password = SecureRandom.hex(DEFAULT_LENGTH_SIP_PASSWORD)
+ @sip_account.password = SecureRandom.hex(GsParameter.get('DEFAULT_LENGTH_SIP_PASSWORD'))
if ! @sip_account.save
render(
@@ -439,7 +439,7 @@ class ConfigSiemensController < ApplicationController
@new_settings << ['XML-app-debug-prog-name', 2, '']
@new_settings << ['XML-app-num-tabs', 2, '3']
@new_settings << ['XML-app-restart', 2, 'true']
- @new_settings << ['XML-app-tab1-display-name', 2, "Gemeinschaft #{GEMEINSCHAFT_VERSION}"]
+ @new_settings << ['XML-app-tab1-display-name', 2, "Gemeinschaft #{GsParameter.get('GEMEINSCHAFT_VERSION')}"]
@new_settings << ['XML-app-tab1-name', 2, 'menu']
@new_settings << ['XML-app-tab2-display-name', 2, 'Status']
@new_settings << ['XML-app-tab2-name', 2, 'menu_status']
@@ -816,7 +816,7 @@ class ConfigSiemensController < ApplicationController
auto_reload_time = 60
- SIEMENS_HISTORY_RELOAD_TIMES.each_pair do |time_range, reload_value|
+ GsParameter.get('SIEMENS_HISTORY_RELOAD_TIMES').each_pair do |time_range, reload_value|
if time_range === Time.now.localtime.hour
auto_reload_time = reload_value
end
diff --git a/app/controllers/config_snom_controller.rb b/app/controllers/config_snom_controller.rb
index 9a06a99..123f2cd 100644
--- a/app/controllers/config_snom_controller.rb
+++ b/app/controllers/config_snom_controller.rb
@@ -34,8 +34,8 @@ class ConfigSnomController < ApplicationController
@phone = Phone.where({ :mac_address => @mac_address }).first
end
- if ! @phone && PROVISIONING_AUTO_ADD_PHONE
- tenant = Tenant.where(:id => PROVISIONING_AUTO_TENANT_ID).first
+ if ! @phone && GsParameter.get('PROVISIONING_AUTO_ADD_PHONE')
+ tenant = Tenant.where(:id => GsParameter.get('PROVISIONING_AUTO_TENANT_ID')).first
if ! tenant
render(
:status => 404,
@@ -94,12 +94,12 @@ class ConfigSnomController < ApplicationController
return
end
- if ! PROVISIONING_AUTO_ADD_SIP_ACCOUNT
+ if ! GsParameter.get('PROVISIONING_AUTO_ADD_SIP_ACCOUNT')
return
end
caller_name_index = 0
- sip_account_last = tenant.sip_accounts.where('caller_name LIKE ?', "#{PROVISIONING_AUTO_SIP_ACCOUNT_CALLER_PREFIX}%").sort { |item1, item2|
+ sip_account_last = tenant.sip_accounts.where('caller_name LIKE ?', "#{GsParameter.get('PROVISIONING_AUTO_SIP_ACCOUNT_CALLER_PREFIX')}%").sort { |item1, item2|
item1.caller_name.gsub(/[^0-9]/, '').to_i <=> item2.caller_name.gsub(/[^0-9]/, '').to_i
}.last
@@ -109,18 +109,18 @@ class ConfigSnomController < ApplicationController
caller_name_index = caller_name_index + 1
@sip_account = tenant.sip_accounts.build
- @sip_account.caller_name = "#{PROVISIONING_AUTO_SIP_ACCOUNT_CALLER_PREFIX}#{caller_name_index}"
- @sip_account.call_waiting = CALL_WAITING
- @sip_account.clir = DEFAULT_CLIR_SETTING
- @sip_account.clip = DEFAULT_CLIP_SETTING
+ @sip_account.caller_name = "#{GsParameter.get('PROVISIONING_AUTO_SIP_ACCOUNT_CALLER_PREFIX')}#{caller_name_index}"
+ @sip_account.call_waiting = GsParameter.get('CALL_WAITING')
+ @sip_account.clir = GsParameter.get('DEFAULT_CLIR_SETTING')
+ @sip_account.clip = GsParameter.get('DEFAULT_CLIP_SETTING')
@sip_account.voicemail_pin = random_pin
- @sip_account.callforward_rules_act_per_sip_account = CALLFORWARD_RULES_ACT_PER_SIP_ACCOUNT_DEFAULT
+ @sip_account.callforward_rules_act_per_sip_account = GsParameter.get('CALLFORWARD_RULES_ACT_PER_SIP_ACCOUNT_DEFAULT')
@sip_account.hotdeskable = false
loop do
- @sip_account.auth_name = SecureRandom.hex(DEFAULT_LENGTH_SIP_AUTH_NAME)
+ @sip_account.auth_name = SecureRandom.hex(GsParameter.get('DEFAULT_LENGTH_SIP_AUTH_NAME'))
break unless SipAccount.exists?(:auth_name => @sip_account.auth_name)
end
- @sip_account.password = SecureRandom.hex(DEFAULT_LENGTH_SIP_PASSWORD)
+ @sip_account.password = SecureRandom.hex(GsParameter.get('DEFAULT_LENGTH_SIP_PASSWORD'))
if ! @sip_account.save
render(
diff --git a/app/controllers/fax_accounts_controller.rb b/app/controllers/fax_accounts_controller.rb
index ce03bc5..031080e 100644
--- a/app/controllers/fax_accounts_controller.rb
+++ b/app/controllers/fax_accounts_controller.rb
@@ -15,8 +15,8 @@ class FaxAccountsController < ApplicationController
def new
@fax_account = @parent.fax_accounts.build
@fax_account.name = generate_a_new_name(@parent, @fax_account)
- @fax_account.days_till_auto_delete = DAYS_TILL_AUTO_DELETE
- @fax_account.retries = DEFAULT_NUMBER_OF_RETRIES
+ @fax_account.days_till_auto_delete = GsParameter.get('DAYS_TILL_AUTO_DELETE')
+ @fax_account.retries = GsParameter.get('DEFAULT_NUMBER_OF_RETRIES')
@fax_account.station_id = @parent.to_s
@fax_account.phone_numbers.build
if @parent.class == User && !@parent.email.blank?
diff --git a/app/controllers/gemeinschaft_setups_controller.rb b/app/controllers/gemeinschaft_setups_controller.rb
index e871862..73a748c 100644
--- a/app/controllers/gemeinschaft_setups_controller.rb
+++ b/app/controllers/gemeinschaft_setups_controller.rb
@@ -21,7 +21,7 @@ class GemeinschaftSetupsController < ApplicationController
def create
if @gemeinschaft_setup.save
super_tenant = Tenant.create(
- :name => SUPER_TENANT_NAME,
+ :name => GsParameter.get('SUPER_TENANT_NAME'),
:country_id => @gemeinschaft_setup.country.id,
:language_id => @gemeinschaft_setup.language_id,
:description => t('gemeinschaft_setups.initial_setup.super_tenant_description'),
diff --git a/app/controllers/gs_nodes_controller.rb b/app/controllers/gs_nodes_controller.rb
index 3667775..17c9e8b 100644
--- a/app/controllers/gs_nodes_controller.rb
+++ b/app/controllers/gs_nodes_controller.rb
@@ -70,7 +70,7 @@ class GsNodesController < ApplicationController
@request_class = '';
end
- @node = GsNode.where(:ip_address => HOMEBASE_IP_ADDRESS).first
+ @node = GsNode.where(:ip_address => GsParameter.get('HOMEBASE_IP_ADDRESS')).first
if @request_class.blank? || @request_class == "tenants"
@tenants = Tenant.where('updated_at > ?', @newer_as)
diff --git a/app/controllers/gs_parameters_controller.rb b/app/controllers/gs_parameters_controller.rb
new file mode 100644
index 0000000..be3378e
--- /dev/null
+++ b/app/controllers/gs_parameters_controller.rb
@@ -0,0 +1,41 @@
+class GsParametersController < ApplicationController
+ def index
+ @gs_parameters = GsParameter.all
+ end
+
+ def show
+ @gs_parameter = GsParameter.find(params[:id])
+ end
+
+ def new
+ @gs_parameter = GsParameter.new
+ end
+
+ def create
+ @gs_parameter = GsParameter.new(params[:gs_parameter])
+ if @gs_parameter.save
+ redirect_to @gs_parameter, :notice => t('gs_parameters.controller.successfuly_created')
+ else
+ render :new
+ end
+ end
+
+ def edit
+ @gs_parameter = GsParameter.find(params[:id])
+ end
+
+ def update
+ @gs_parameter = GsParameter.find(params[:id])
+ if @gs_parameter.update_attributes(params[:gs_parameter])
+ redirect_to @gs_parameter, :notice => t('gs_parameters.controller.successfuly_updated')
+ else
+ render :edit
+ end
+ end
+
+ def destroy
+ @gs_parameter = GsParameter.find(params[:id])
+ @gs_parameter.destroy
+ redirect_to gs_parameters_url, :notice => t('gs_parameters.controller.successfuly_destroyed')
+ end
+end
diff --git a/app/controllers/phone_book_entries_controller.rb b/app/controllers/phone_book_entries_controller.rb
index 823d50e..9cc9f18 100644
--- a/app/controllers/phone_book_entries_controller.rb
+++ b/app/controllers/phone_book_entries_controller.rb
@@ -71,7 +71,7 @@ class PhoneBookEntriesController < ApplicationController
order([ :last_name, :first_name, :organization ]).
paginate(
:page => @pagination_page_number,
- :per_page => DEFAULT_PAGINATION_ENTRIES_PER_PAGE
+ :per_page => GsParameter.get('DEFAULT_PAGINATION_ENTRIES_PER_PAGE')
)
end
diff --git a/app/controllers/phone_books_controller.rb b/app/controllers/phone_books_controller.rb
index 54e7889..5f2d61f 100644
--- a/app/controllers/phone_books_controller.rb
+++ b/app/controllers/phone_books_controller.rb
@@ -22,7 +22,7 @@ class PhoneBooksController < ApplicationController
order([ :last_name, :first_name ]).
paginate(
:page => @pagination_page_number,
- :per_page => DEFAULT_PAGINATION_ENTRIES_PER_PAGE
+ :per_page => GsParameter.get('DEFAULT_PAGINATION_ENTRIES_PER_PAGE')
)
else
# search by name
@@ -39,7 +39,7 @@ class PhoneBooksController < ApplicationController
order([ :last_name, :first_name ]).
paginate(
:page => @pagination_page_number,
- :per_page => DEFAULT_PAGINATION_ENTRIES_PER_PAGE
+ :per_page => GsParameter.get('DEFAULT_PAGINATION_ENTRIES_PER_PAGE')
)
end
end
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb
index f92ae1c..81b04e0 100644
--- a/app/controllers/sessions_controller.rb
+++ b/app/controllers/sessions_controller.rb
@@ -36,7 +36,7 @@ class SessionsController < ApplicationController
private
def redirect_to_https
- if GUI_REDIRECT_HTTPS and ! request.ssl?
+ if GsParameter.get('GUI_REDIRECT_HTTPS') and ! request.ssl?
redirect_to :protocol => "https://"
end
end
diff --git a/app/controllers/sip_accounts_controller.rb b/app/controllers/sip_accounts_controller.rb
index 8292a74..4d042b3 100644
--- a/app/controllers/sip_accounts_controller.rb
+++ b/app/controllers/sip_accounts_controller.rb
@@ -15,11 +15,11 @@ class SipAccountsController < ApplicationController
def new
@sip_account = @parent.sip_accounts.build
@sip_account.caller_name = @parent
- @sip_account.call_waiting = CALL_WAITING
- @sip_account.clir = DEFAULT_CLIR_SETTING
- @sip_account.clip = DEFAULT_CLIP_SETTING
+ @sip_account.call_waiting = GsParameter.get('CALL_WAITING')
+ @sip_account.clir = GsParameter.get('DEFAULT_CLIR_SETTING')
+ @sip_account.clip = GsParameter.get('DEFAULT_CLIP_SETTING')
@sip_account.voicemail_pin = random_pin
- @sip_account.callforward_rules_act_per_sip_account = CALLFORWARD_RULES_ACT_PER_SIP_ACCOUNT_DEFAULT
+ @sip_account.callforward_rules_act_per_sip_account = GsParameter.get('CALLFORWARD_RULES_ACT_PER_SIP_ACCOUNT_DEFAULT')
if @parent.class == User
@sip_account.hotdeskable = true
end
@@ -27,11 +27,11 @@ class SipAccountsController < ApplicationController
# Make sure that we don't use an already taken auth_name
#
loop do
- @sip_account.auth_name = SecureRandom.hex(DEFAULT_LENGTH_SIP_AUTH_NAME)
+ @sip_account.auth_name = SecureRandom.hex(GsParameter.get('DEFAULT_LENGTH_SIP_AUTH_NAME'))
break unless SipAccount.exists?(:auth_name => @sip_account.auth_name)
end
- @sip_account.password = SecureRandom.hex(DEFAULT_LENGTH_SIP_PASSWORD)
+ @sip_account.password = SecureRandom.hex(GsParameter.get('DEFAULT_LENGTH_SIP_PASSWORD'))
end
def create
@@ -39,13 +39,13 @@ class SipAccountsController < ApplicationController
if @sip_account.auth_name.blank?
loop do
- @sip_account.auth_name = SecureRandom.hex(DEFAULT_LENGTH_SIP_AUTH_NAME)
+ @sip_account.auth_name = SecureRandom.hex(GsParameter.get('DEFAULT_LENGTH_SIP_AUTH_NAME'))
break unless SipAccount.exists?(:auth_name => @sip_account.auth_name)
end
end
if @sip_account.password.blank?
- @sip_account.password = SecureRandom.hex(DEFAULT_LENGTH_SIP_PASSWORD)
+ @sip_account.password = SecureRandom.hex(GsParameter.get('DEFAULT_LENGTH_SIP_PASSWORD'))
end
if @sip_account.save
diff --git a/app/controllers/voicemail_messages_controller.rb b/app/controllers/voicemail_messages_controller.rb
index 58f5265..dfe0ae4 100644
--- a/app/controllers/voicemail_messages_controller.rb
+++ b/app/controllers/voicemail_messages_controller.rb
@@ -24,17 +24,17 @@ class VoicemailMessagesController < ApplicationController
if @type == 'read'
@voicemail_messages = @sip_account.voicemail_messages.where('read_epoch > 0').order('created_epoch DESC').paginate(
:page => @pagination_page_number,
- :per_page => DEFAULT_PAGINATION_ENTRIES_PER_PAGE
+ :per_page => GsParameter.get('DEFAULT_PAGINATION_ENTRIES_PER_PAGE')
)
elsif @type == 'unread'
@voicemail_messages = @sip_account.voicemail_messages.where(:read_epoch => 0).order('created_epoch DESC').paginate(
:page => @pagination_page_number,
- :per_page => DEFAULT_PAGINATION_ENTRIES_PER_PAGE
+ :per_page => GsParameter.get('DEFAULT_PAGINATION_ENTRIES_PER_PAGE')
)
else
@voicemail_messages = @sip_account.voicemail_messages.order('created_epoch DESC').paginate(
:page => @pagination_page_number,
- :per_page => DEFAULT_PAGINATION_ENTRIES_PER_PAGE
+ :per_page => GsParameter.get('DEFAULT_PAGINATION_ENTRIES_PER_PAGE')
)
end
end
diff --git a/app/helpers/gs_parameters_helper.rb b/app/helpers/gs_parameters_helper.rb
new file mode 100644
index 0000000..ec339ea
--- /dev/null
+++ b/app/helpers/gs_parameters_helper.rb
@@ -0,0 +1,2 @@
+module GsParametersHelper
+end
diff --git a/app/mailers/notifications.rb b/app/mailers/notifications.rb
index 2c7f2ce..5b46f23 100644
--- a/app/mailers/notifications.rb
+++ b/app/mailers/notifications.rb
@@ -26,7 +26,7 @@ class Notifications < ActionMailer::Base
@pin[:pin] = conference.pin
@pin[:phone_numbers] = conference.phone_numbers.join(', ')
- mail(from: Tenant.find(DEFAULT_API_TENANT_ID).from_field_pin_change_email,to: "#{conference.conferenceable.email}", :subject => "Conference PIN changed: #{@pin[:conference]}")
+ mail(from: Tenant.find(GsParameter.get('DEFAULT_API_TENANT_ID')).from_field_pin_change_email,to: "#{conference.conferenceable.email}", :subject => "Conference PIN changed: #{@pin[:conference]}")
end
def new_password(user, password)
@@ -39,7 +39,7 @@ class Notifications < ActionMailer::Base
@message[:greeting] = user.user_name
end
- mail(from: Tenant.find(DEFAULT_API_TENANT_ID).from_field_pin_change_email, to: "#{user.email}", :subject => "Password recovery")
+ mail(from: Tenant.find(GsParameter.get('DEFAULT_API_TENANT_ID')).from_field_pin_change_email, to: "#{user.email}", :subject => "Password recovery")
end
def new_voicemail(freeswitch_voicemail_msg, attach_file = false)
@@ -67,7 +67,7 @@ class Notifications < ActionMailer::Base
attachments["#{Time.at(freeswitch_voicemail_msg.created_epoch).getlocal.strftime('%Y%m%d-%H%M%S')}-#{caller_number}.wav"] = File.read(freeswitch_voicemail_msg.file_path)
end
- mail(from: Tenant.find(DEFAULT_API_TENANT_ID).from_field_voicemail_email, to: "#{user.email}", :subject => "New Voicemail from #{@voicemail[:from]}, received #{Time.at(freeswitch_voicemail_msg.created_epoch).getlocal.to_s}")
+ mail(from: Tenant.find(GsParameter.get('DEFAULT_API_TENANT_ID')).from_field_voicemail_email, to: "#{user.email}", :subject => "New Voicemail from #{@voicemail[:from]}, received #{Time.at(freeswitch_voicemail_msg.created_epoch).getlocal.to_s}")
end
def new_fax(fax_document)
@@ -104,7 +104,7 @@ class Notifications < ActionMailer::Base
end
end
attachments["#{fax_document.created_at.strftime('%Y%m%d-%H%M%S')}-#{caller_number}.pdf"] = File.read(fax_document.document.path)
- mail(from: Tenant.find(DEFAULT_API_TENANT_ID).from_field_voicemail_email, to: "#{fax_account.email}", :subject => "New Fax Document from #{@fax[:from]}, received #{fax_document.created_at}")
+ mail(from: Tenant.find(GsParameter.get('DEFAULT_API_TENANT_ID')).from_field_voicemail_email, to: "#{fax_account.email}", :subject => "New Fax Document from #{@fax[:from]}, received #{fax_document.created_at}")
end
end
diff --git a/app/models/ability.rb b/app/models/ability.rb
index d9ec74a..f4068ca 100644
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -70,7 +70,7 @@ class Ability
# Dirty hack to disable PhoneNumberRange in the GUI
#
- if STRICT_INTERNAL_EXTENSION_HANDLING == false
+ if GsParameter.get('STRICT_INTERNAL_EXTENSION_HANDLING') == false
cannot :manage, PhoneNumberRange
end
else
diff --git a/app/models/access_authorization.rb b/app/models/access_authorization.rb
index ef33115..878799a 100644
--- a/app/models/access_authorization.rb
+++ b/app/models/access_authorization.rb
@@ -18,7 +18,9 @@ class AccessAuthorization < ActiveRecord::Base
:allow_nil => true, :allow_blank => true,
:message => "must be numeric."
- validates_length_of :pin, :minimum => MINIMUM_PIN_LENGTH, :maximum => MAXIMUM_PIN_LENGTH,
+ validates_length_of :pin,
+ :minimum => (GsParameter.get('MINIMUM_PIN_LENGTH').nil? ? 4 : GsParameter.get('MINIMUM_PIN_LENGTH')),
+ :maximum => (GsParameter.get('MAXIMUM_PIN_LENGTH').nil? ? 10 : GsParameter.get('MAXIMUM_PIN_LENGTH')),
:allow_nil => true, :allow_blank => true
has_many :phone_numbers, :as => :phone_numberable, :dependent => :destroy
diff --git a/app/models/api/row.rb b/app/models/api/row.rb
index ac35516..e82a3e2 100644
--- a/app/models/api/row.rb
+++ b/app/models/api/row.rb
@@ -28,7 +28,7 @@ class Api::Row < ActiveRecord::Base
end
def create_a_new_gemeinschaft_user
- tenant = Tenant.find(DEFAULT_API_TENANT_ID)
+ tenant = Tenant.find(GsParameter.get('DEFAULT_API_TENANT_ID'))
# Find or create the user
#
diff --git a/app/models/call_forward.rb b/app/models/call_forward.rb
index 0018cfb..8a8d1df 100644
--- a/app/models/call_forward.rb
+++ b/app/models/call_forward.rb
@@ -28,7 +28,7 @@ class CallForward < ActiveRecord::Base
validates_numericality_of :depth,
:only_integer => true,
:greater_than_or_equal_to => 1,
- :less_than_or_equal_to => MAX_CALL_FORWARD_DEPTH
+ :less_than_or_equal_to => (GsParameter.get('MAX_CALL_FORWARD_DEPTH').nil? ? 0 : GsParameter.get('MAX_CALL_FORWARD_DEPTH'))
before_validation {
self.timeout = nil if self.call_forward_case_id != 3
diff --git a/app/models/conference.rb b/app/models/conference.rb
index 8be9f21..16b646c 100644
--- a/app/models/conference.rb
+++ b/app/models/conference.rb
@@ -15,7 +15,7 @@ class Conference < ActiveRecord::Base
validates_presence_of :max_members
validates_numericality_of :max_members, :only_integer => true,
:greater_than => 0,
- :less_than => (MAXIMUM_NUMBER_OF_PEOPLE_IN_A_CONFERENCE + 1),
+ :less_than => ((GsParameter.get('MAXIMUM_NUMBER_OF_PEOPLE_IN_A_CONFERENCE').nil? ? 10 : GsParameter.get('MAXIMUM_NUMBER_OF_PEOPLE_IN_A_CONFERENCE')) + 1),
:allow_nil => false,
:allow_blank => false
@@ -25,7 +25,7 @@ class Conference < ActiveRecord::Base
:greater_than => 0,
:allow_nil => true,
:allow_blank => true
- validates_length_of :pin, :minimum => MINIMUM_PIN_LENGTH,
+ validates_length_of :pin, :minimum => (GsParameter.get('MINIMUM_PIN_LENGTH').nil? ? 4 : GsParameter.get('MINIMUM_PIN_LENGTH')),
:allow_nil => true,
:allow_blank => true
diff --git a/app/models/conference_invitee.rb b/app/models/conference_invitee.rb
index 7de20de..d6e3bac 100644
--- a/app/models/conference_invitee.rb
+++ b/app/models/conference_invitee.rb
@@ -13,7 +13,7 @@ class ConferenceInvitee < ActiveRecord::Base
:greater_than => 0,
:allow_nil => true,
:allow_blank => true
- validates_length_of :pin, :minimum => MINIMUM_PIN_LENGTH,
+ validates_length_of :pin, :minimum => (GsParameter.get('MINIMUM_PIN_LENGTH').nil? ? 4 : GsParameter.get('MINIMUM_PIN_LENGTH')),
:allow_nil => true,
:allow_blank => true
diff --git a/app/models/fax_document.rb b/app/models/fax_document.rb
index 67bdea9..080bdaa 100644
--- a/app/models/fax_document.rb
+++ b/app/models/fax_document.rb
@@ -54,7 +54,7 @@ class FaxDocument < ActiveRecord::Base
private
def render_thumbnails
- directory = "/tmp/GS-#{GEMEINSCHAFT_VERSION}/fax_thumbnails/#{self.id}"
+ directory = "/tmp/GS-#{GsParameter.get('GEMEINSCHAFT_VERSION')}/fax_thumbnails/#{self.id}"
system('mkdir -p ' + directory)
system("cd #{directory} && convert #{Rails.root.to_s}/public#{self.document.to_s}[0-100] -colorspace Gray PNG:'fax_page.png'")
number_of_thumbnails = Dir["#{directory}/fax_page-*.png"].count
@@ -70,7 +70,7 @@ class FaxDocument < ActiveRecord::Base
def convert_pdf_to_tiff
page_size_a4 = '595 842'
page_size_command = "<< /Policies << /PageSize 3 >> /InputAttributes currentpagedevice /InputAttributes get dup { pop 1 index exch undef } forall dup 0 << /PageSize [ #{page_size_a4} ] >> put >> setpagedevice"
- directory = "/tmp/GS-#{GEMEINSCHAFT_VERSION}/faxes/#{self.id}"
+ directory = "/tmp/GS-#{GsParameter.get('GEMEINSCHAFT_VERSION')}/faxes/#{self.id}"
system('mkdir -p ' + directory)
tiff_file_name = File.basename(self.document.to_s.downcase, ".pdf") + '.tiff'
system "cd #{directory} && gs -q -r#{self.fax_resolution.resolution_value} -dNOPAUSE -dBATCH -dSAFER -sDEVICE=tiffg3 -sOutputFile=\"#{tiff_file_name}\" -c \"#{page_size_command}\" -- \"#{Rails.root.to_s}/public#{self.document.to_s}\""
diff --git a/app/models/gs_cluster_sync_log_entry.rb b/app/models/gs_cluster_sync_log_entry.rb
index 063ff23..51e3b05 100644
--- a/app/models/gs_cluster_sync_log_entry.rb
+++ b/app/models/gs_cluster_sync_log_entry.rb
@@ -15,7 +15,7 @@ class GsClusterSyncLogEntry < ActiveRecord::Base
after_create :apply_to_local_database
def apply_to_local_database
- if self.homebase_ip_address != HOMEBASE_IP_ADDRESS
+ if self.homebase_ip_address != GsParameter.get('HOMEBASE_IP_ADDRESS')
if self.class_name.constantize.new.attribute_names.include?('is_native')
case self.action
when 'create'
@@ -84,7 +84,7 @@ class GsClusterSyncLogEntry < ActiveRecord::Base
end
def populate_other_cluster_nodes
- if self.homebase_ip_address == HOMEBASE_IP_ADDRESS && self.waiting_to_be_synced == true
+ if self.homebase_ip_address == GsParameter.get('HOMEBASE_IP_ADDRESS') && self.waiting_to_be_synced == true
if GsNode.where(:push_updates_to => true).count > 0
GsNode.where(:push_updates_to => true).each do |gs_node|
RemoteGsNode::GsClusterSyncLogEntry.site = gs_node.site
diff --git a/app/models/gs_parameter.rb b/app/models/gs_parameter.rb
new file mode 100644
index 0000000..9d9e996
--- /dev/null
+++ b/app/models/gs_parameter.rb
@@ -0,0 +1,37 @@
+class GsParameter < ActiveRecord::Base
+ attr_accessible :name, :section, :value, :class_type, :description
+
+ validates :name,
+ :presence => true,
+ :uniqueness => true
+
+ validates :value,
+ :presence => true
+
+ validates :class_type,
+ :presence => true,
+ :inclusion => { :in => ['String', 'Integer', 'Boolean', 'YAML'] }
+
+ def self.get(wanted_variable)
+ if GsParameter.table_exists?
+ item = GsParameter.where(:name => wanted_variable).first
+ if item.nil?
+ return nil
+ else
+ return item.value.to_i if item.class_type == 'Integer'
+ return item.value.to_s if item.class_type == 'String'
+ if item.class_type == 'Boolean'
+ return true if item.value == 'true'
+ return false if item.value == 'false'
+ end
+ return YAML.load(item.value) if item.class_type == 'YAML'
+ end
+ else
+ nil
+ end
+ end
+
+ def to_s
+ name
+ end
+end
diff --git a/app/models/hunt_group.rb b/app/models/hunt_group.rb
index 276ae53..184297c 100644
--- a/app/models/hunt_group.rb
+++ b/app/models/hunt_group.rb
@@ -8,17 +8,17 @@ class HuntGroup < ActiveRecord::Base
:allow_nil => true, :allow_blank => true
validates_presence_of :strategy
- validates_inclusion_of :strategy, :in => HUNT_GROUP_STRATEGIES
+ validates_inclusion_of :strategy, :in => (GsParameter.get('HUNT_GROUP_STRATEGIES').nil? ? [] : GsParameter.get('HUNT_GROUP_STRATEGIES'))
validates_presence_of :seconds_between_jumps,
:if => Proc.new{ |hunt_group| hunt_group.strategy != 'ring_all' }
validates_numericality_of :seconds_between_jumps,
:only_integer => true,
- :greater_than_or_equal_to => VALID_SECONDS_BETWEEN_JUMPS_VALUES.min,
- :less_than_or_equal_to => VALID_SECONDS_BETWEEN_JUMPS_VALUES.max,
+ :greater_than_or_equal_to => (GsParameter.get('VALID_SECONDS_BETWEEN_JUMPS_VALUES').nil? ? 2 : GsParameter.get('VALID_SECONDS_BETWEEN_JUMPS_VALUES').min),
+ :less_than_or_equal_to => (GsParameter.get('VALID_SECONDS_BETWEEN_JUMPS_VALUES').nil? ? 120 : GsParameter.get('VALID_SECONDS_BETWEEN_JUMPS_VALUES').max),
:if => Proc.new{ |hunt_group| hunt_group.strategy != 'ring_all' }
validates_inclusion_of :seconds_between_jumps,
- :in => VALID_SECONDS_BETWEEN_JUMPS_VALUES,
+ :in => (GsParameter.get('VALID_SECONDS_BETWEEN_JUMPS_VALUES').nil? ? [] : GsParameter.get('VALID_SECONDS_BETWEEN_JUMPS_VALUES')),
:if => Proc.new{ |hunt_group| hunt_group.strategy != 'ring_all' }
validates_inclusion_of :seconds_between_jumps,
:in => [nil],
diff --git a/app/models/phone_number.rb b/app/models/phone_number.rb
index 4c0cf46..d1e950f 100644
--- a/app/models/phone_number.rb
+++ b/app/models/phone_number.rb
@@ -18,8 +18,8 @@ class PhoneNumber < ActiveRecord::Base
before_save :save_value_of_to_s
after_create :copy_existing_call_forwards_if_necessary
before_validation :'parse_and_split_number!'
- validate :validate_number, :if => Proc.new { |phone_number| STRICT_INTERNAL_EXTENSION_HANDLING && STRICT_DID_HANDLING }
- validate :check_if_number_is_available, :if => Proc.new { |phone_number| STRICT_INTERNAL_EXTENSION_HANDLING && STRICT_DID_HANDLING }
+ validate :validate_number, :if => Proc.new { |phone_number| GsParameter.get('STRICT_INTERNAL_EXTENSION_HANDLING') && GsParameter.get('STRICT_DID_HANDLING') }
+ validate :check_if_number_is_available, :if => Proc.new { |phone_number| GsParameter.get('STRICT_INTERNAL_EXTENSION_HANDLING') && GsParameter.get('STRICT_DID_HANDLING') }
acts_as_list :scope => [:phone_numberable_id, :phone_numberable_type]
@@ -95,7 +95,7 @@ class PhoneNumber < ActiveRecord::Base
else
# Check if the number is an internal extension.
if tenant
- internal_extension_range = tenant.phone_number_ranges.where(:name => INTERNAL_EXTENSIONS).first
+ internal_extension_range = tenant.phone_number_ranges.where(:name => GsParameter.get('INTERNAL_EXTENSIONS')).first
if internal_extension_range
if internal_extension_range.phone_numbers.where(:number => number).length > 0
parts[:extension] = number
@@ -192,8 +192,8 @@ class PhoneNumber < ActiveRecord::Base
end
def parse_and_split_number!
- if self.phone_numberable_type == 'PhoneNumberRange' && self.phone_numberable.name == INTERNAL_EXTENSIONS
- # The parent is the PhoneNumberRange INTERNAL_EXTENSIONS. Therefor it must be an extensions.
+ if self.phone_numberable_type == 'PhoneNumberRange' && self.phone_numberable.name == GsParameter.get('INTERNAL_EXTENSIONS')
+ # The parent is the PhoneNumberRange GsParameter.get('INTERNAL_EXTENSIONS'). Therefor it must be an extensions.
#
self.country_code = nil
self.area_code = nil
@@ -202,8 +202,8 @@ class PhoneNumber < ActiveRecord::Base
self.extension = self.number.to_s.strip
else
if self.tenant &&
- self.tenant.phone_number_ranges.exists?(:name => INTERNAL_EXTENSIONS) &&
- self.tenant.phone_number_ranges.where(:name => INTERNAL_EXTENSIONS).first.phone_numbers.exists?(:number => self.number)
+ self.tenant.phone_number_ranges.exists?(:name => GsParameter.get('INTERNAL_EXTENSIONS')) &&
+ self.tenant.phone_number_ranges.where(:name => GsParameter.get('INTERNAL_EXTENSIONS')).first.phone_numbers.exists?(:number => self.number)
self.country_code = nil
self.area_code = nil
self.subscriber_number = nil
@@ -263,7 +263,7 @@ class PhoneNumber < ActiveRecord::Base
if self.phone_numberable_type != 'PhoneBookEntry' && self.tenant
phone_number_ranges = self.tenant.phone_number_ranges.where(
- :name => [INTERNAL_EXTENSIONS, DIRECT_INWARD_DIALING_NUMBERS]
+ :name => [GsParameter.get('INTERNAL_EXTENSIONS'), GsParameter.get('DIRECT_INWARD_DIALING_NUMBERS')]
)
if !phone_number_ranges.empty?
if !PhoneNumber.where(:phone_numberable_type => 'PhoneNumberRange').
diff --git a/app/models/phone_number_range.rb b/app/models/phone_number_range.rb
index 2fdd9b6..b666487 100644
--- a/app/models/phone_number_range.rb
+++ b/app/models/phone_number_range.rb
@@ -6,7 +6,7 @@ class PhoneNumberRange < ActiveRecord::Base
validates_presence_of :name
validates_uniqueness_of :name, :scope => [:phone_number_rangeable_id, :phone_number_rangeable_type]
- validates_inclusion_of :name, :in => [INTERNAL_EXTENSIONS, DIRECT_INWARD_DIALING_NUMBERS, SERVICE_NUMBERS]
+ validates_inclusion_of :name, :in => [GsParameter.get('INTERNAL_EXTENSIONS'), GsParameter.get('DIRECT_INWARD_DIALING_NUMBERS'), GsParameter.get('SERVICE_NUMBERS')]
validates_presence_of :phone_number_rangeable_id
validates_presence_of :phone_number_rangeable
diff --git a/app/models/sip_account.rb b/app/models/sip_account.rb
index 8459265..5388395 100644
--- a/app/models/sip_account.rb
+++ b/app/models/sip_account.rb
@@ -71,7 +71,7 @@ class SipAccount < ActiveRecord::Base
after_update :log_out_phone_if_not_local
def to_s
- truncate((self.caller_name || "SipAccount ID #{self.id}"), :length => TO_S_MAX_CALLER_NAME_LENGTH) + " (#{truncate(self.auth_name, :length => TO_S_MAX_LENGTH_OF_AUTH_NAME)}@...#{self.host.split(/\./)[2,3].to_a.join('.') if self.host })"
+ truncate((self.caller_name || "SipAccount ID #{self.id}"), :length => GsParameter.get('TO_S_MAX_CALLER_NAME_LENGTH')) + " (#{truncate(self.auth_name, :length => GsParameter.get('TO_S_MAX_LENGTH_OF_AUTH_NAME'))}@...#{self.host.split(/\./)[2,3].to_a.join('.') if self.host })"
end
def call_forwarding_toggle( call_forwarding_service, to_voicemail = nil )
@@ -200,7 +200,7 @@ class SipAccount < ActiveRecord::Base
# log out phone if sip_account is not on this node
def log_out_phone_if_not_local
- if self.gs_node_id && ! GsNode.where(:ip_address => HOMEBASE_IP_ADDRESS, :id => self.gs_node_id).first
+ if self.gs_node_id && ! GsNode.where(:ip_address => GsParameter.get('HOMEBASE_IP_ADDRESS'), :id => self.gs_node_id).first
self.phones.each do |phone|
phone.user_logout;
end
diff --git a/app/models/tenant.rb b/app/models/tenant.rb
index d9351b7..c3e2926 100644
--- a/app/models/tenant.rb
+++ b/app/models/tenant.rb
@@ -3,11 +3,11 @@
class Tenant < ActiveRecord::Base
attr_accessible :name, :description, :sip_domain_id, :country_id, :language_id, :from_field_pin_change_email, :from_field_voicemail_email
- if STRICT_INTERNAL_EXTENSION_HANDLING == true
+ if GsParameter.get('STRICT_INTERNAL_EXTENSION_HANDLING') == true
attr_accessible :internal_extension_ranges
end
- if STRICT_DID_HANDLING == true
+ if GsParameter.get('STRICT_DID_HANDLING') == true
attr_accessible :did_list
end
@@ -93,7 +93,7 @@ class Tenant < ActiveRecord::Base
name
end
- if STRICT_INTERNAL_EXTENSION_HANDLING == true
+ if GsParameter.get('STRICT_INTERNAL_EXTENSION_HANDLING') == true
def array_of_internal_extension_numbers
ranges = self.internal_extension_ranges.gsub(/[^0-9\-,]/,'').gsub(/[\-]+/,'-').gsub(/[,]+/,',').split(/,/)
output = []
@@ -112,7 +112,7 @@ class Tenant < ActiveRecord::Base
# Generate the internal_extensions
#
def generate_internal_extensions
- internal_extensions = self.phone_number_ranges.find_or_create_by_name(INTERNAL_EXTENSIONS, :description => 'A list of all available internal extensions.')
+ internal_extensions = self.phone_number_ranges.find_or_create_by_name(GsParameter.get('INTERNAL_EXTENSIONS'), :description => 'A list of all available internal extensions.')
phone_number_list = Array.new
@@ -122,7 +122,7 @@ class Tenant < ActiveRecord::Base
elsif
# Don't create extensions like 911, 110 or 112 (at least by default)
#
- phone_number_list = (self.array_of_internal_extension_numbers - self.country.phone_number_ranges.where(:name => SERVICE_NUMBERS).first.phone_numbers.map{|entry| entry.number})
+ phone_number_list = (self.array_of_internal_extension_numbers - self.country.phone_number_ranges.where(:name => GsParameter.get('SERVICE_NUMBERS')).first.phone_numbers.map{|entry| entry.number})
end
end
@@ -133,7 +133,7 @@ class Tenant < ActiveRecord::Base
end
- if STRICT_DID_HANDLING == true
+ if GsParameter.get('STRICT_DID_HANDLING') == true
def array_of_dids_generated_from_did_list
numbers = self.did_list.downcase.gsub(/[^0-9,x\+]/,'').gsub(/[,]+/,',').split(/,/)
array_of_all_external_numbers = []
@@ -152,7 +152,7 @@ class Tenant < ActiveRecord::Base
# Generate the external numbers (DIDs)
#
def generate_dids
- dids = self.phone_number_ranges.find_or_create_by_name(DIRECT_INWARD_DIALING_NUMBERS, :description => 'A list of all available DIDs.')
+ dids = self.phone_number_ranges.find_or_create_by_name(GsParameter.get('DIRECT_INWARD_DIALING_NUMBERS'), :description => 'A list of all available DIDs.')
self.array_of_dids_generated_from_did_list.each do |number|
dids.phone_numbers.find_or_create_by_name_and_number('DID', number)
end
@@ -167,7 +167,7 @@ class Tenant < ActiveRecord::Base
@internal_extensions_and_dids ||= self.phone_number_ranges_phone_numbers.
where(:phone_numberable_type => 'PhoneNumberRange').
where(:phone_numberable_id => self.phone_number_ranges.
- where(:name => [INTERNAL_EXTENSIONS, DIRECT_INWARD_DIALING_NUMBERS]).
+ where(:name => [GsParameter.get('INTERNAL_EXTENSIONS'), GsParameter.get('DIRECT_INWARD_DIALING_NUMBERS')]).
map{|pnr| pnr.id })
end
@@ -175,7 +175,7 @@ class Tenant < ActiveRecord::Base
@array_of_internal_extensions ||= self.phone_number_ranges_phone_numbers.
where(:phone_numberable_type => 'PhoneNumberRange').
where(:phone_numberable_id => self.phone_number_ranges.
- where(:name => INTERNAL_EXTENSIONS).
+ where(:name => GsParameter.get('INTERNAL_EXTENSIONS')).
map{|pnr| pnr.id }).
map{|phone_number| phone_number.number }.
sort.uniq
@@ -184,7 +184,7 @@ class Tenant < ActiveRecord::Base
def array_of_dids
@array_of_dids ||= self.phone_number_ranges_phone_numbers.
where(:phone_numberable_type => 'PhoneNumberRange').
- where(:phone_numberable_id => self.phone_number_ranges.where(:name => DIRECT_INWARD_DIALING_NUMBERS).map{|pnr| pnr.id }).
+ where(:phone_numberable_id => self.phone_number_ranges.where(:name => GsParameter.get('DIRECT_INWARD_DIALING_NUMBERS')).map{|pnr| pnr.id }).
map{|phone_number| phone_number.to_s }.
sort.uniq
end
@@ -215,7 +215,7 @@ class Tenant < ActiveRecord::Base
# Create a public phone book for this tenant
def create_a_default_phone_book
- if self.name != SUPER_TENANT_NAME
+ if self.name != GsParameter.get('SUPER_TENANT_NAME')
general_phone_book = self.phone_books.find_or_create_by_name_and_description(
I18n.t('phone_books.general_phone_book.name'),
I18n.t('phone_books.general_phone_book.description', :resource => self.to_s)
diff --git a/app/models/user.rb b/app/models/user.rb
index 2d0256f..9b29dc5 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -27,7 +27,8 @@ class User < ActiveRecord::Base
}
validates_length_of [:new_pin, :new_pin_confirmation],
- :minimum => MINIMUM_PIN_LENGTH, :maximum => MAXIMUM_PIN_LENGTH,
+ :minimum => (GsParameter.get('MINIMUM_PIN_LENGTH').nil? ? 4 : GsParameter.get('MINIMUM_PIN_LENGTH')),
+ :maximum => (GsParameter.get('MAXIMUM_PIN_LENGTH').nil? ? 10 : GsParameter.get('MAXIMUM_PIN_LENGTH')),
:allow_blank => true, :allow_nil => true
validates_format_of [:new_pin, :new_pin_confirmation],
:with => /^[0-9]+$/,
diff --git a/app/views/call_forwards/_form_core.html.haml b/app/views/call_forwards/_form_core.html.haml
index f75181f..b751fb3 100644
--- a/app/views/call_forwards/_form_core.html.haml
+++ b/app/views/call_forwards/_form_core.html.haml
@@ -9,7 +9,7 @@
= f.input :source, :label => t('call_forwards.form.source.label'), :hint => conditional_hint('call_forwards.form.source.hint')
- if GuiFunction.display?('depth_field_in_call_forward_form', current_user)
- = f.input :depth, :collection => 1..MAX_CALL_FORWARD_DEPTH, :label => t('call_forwards.form.depth.label'), :hint => conditional_hint('call_forwards.form.depth.hint')
+ = f.input :depth, :collection => 1..GsParameter.get('MAX_CALL_FORWARD_DEPTH'), :label => t('call_forwards.form.depth.label'), :hint => conditional_hint('call_forwards.form.depth.hint')
- else
= f.hidden_field :depth
= f.input :active, :label => t('call_forwards.form.active.label'), :hint => conditional_hint('call_forwards.form.active.hint')
diff --git a/app/views/callthroughs/_form_core.html.haml b/app/views/callthroughs/_form_core.html.haml
index 1f137d9..cf05e06 100644
--- a/app/views/callthroughs/_form_core.html.haml
+++ b/app/views/callthroughs/_form_core.html.haml
@@ -15,7 +15,7 @@
= f.simple_fields_for :access_authorizations do |access_authorization|
= render "access_authorizations/form_core", :f => access_authorization
- - if CALLTHROUGH_HAS_WHITELISTS == true
+ - if GsParameter.get('CALLTHROUGH_HAS_WHITELISTS') == true
- if @callthrough && @callthrough.whitelists.size > 0
%h2= t('callthroughs.form.whitelists.label')
- if !t('callthroughs.form.whitelists.hint').blank?
diff --git a/app/views/callthroughs/_index_core.html.haml b/app/views/callthroughs/_index_core.html.haml
index f1802d4..2071145 100644
--- a/app/views/callthroughs/_index_core.html.haml
+++ b/app/views/callthroughs/_index_core.html.haml
@@ -3,7 +3,7 @@
%th= t('callthroughs.index.name')
%th= t('callthroughs.index.phone_numbers')
%th= t('callthroughs.index.access_authorized_phone_numbers')
- - if CALLTHROUGH_HAS_WHITELISTS == true
+ - if GsParameter.get('CALLTHROUGH_HAS_WHITELISTS') == true
%th= t('callthroughs.index.whitelist_phone_numbers')
- reset_cycle
@@ -12,6 +12,6 @@
%td= callthrough.name
%td=render 'phone_numbers/listing', :phone_numbers => callthrough.phone_numbers
%td=render 'phone_numbers/listing', :phone_numbers => callthrough.access_authorization_phone_numbers
- - if CALLTHROUGH_HAS_WHITELISTS == true
+ - if GsParameter.get('CALLTHROUGH_HAS_WHITELISTS') == true
%td=render 'phone_numbers/listing', :phone_numbers => callthrough.whitelisted_phone_numbers
=render :partial => 'shared/index_view_edit_destroy_part', :locals => {:parent => callthrough.tenant, :child => callthrough} \ No newline at end of file
diff --git a/app/views/callthroughs/show.html.haml b/app/views/callthroughs/show.html.haml
index 55bd6eb..b9abca9 100644
--- a/app/views/callthroughs/show.html.haml
+++ b/app/views/callthroughs/show.html.haml
@@ -19,7 +19,7 @@
%br
= render :partial => 'shared/create_link', :locals => {:parent => @callthrough, :child_class => AccessAuthorization}
-- if CALLTHROUGH_HAS_WHITELISTS == true
+- if GsParameter.get('CALLTHROUGH_HAS_WHITELISTS') == true
%h2= t('callthroughs.form.whitelists.label')
- if @callthrough.whitelisted_phone_numbers.count > 0
= render 'whitelists/index_core', :whitelists => @callthrough.whitelists
diff --git a/app/views/conferences/_form_core.html.haml b/app/views/conferences/_form_core.html.haml
index 04754de..f8d6c8e 100644
--- a/app/views/conferences/_form_core.html.haml
+++ b/app/views/conferences/_form_core.html.haml
@@ -5,7 +5,7 @@
= f.input :end, :label => t('conferences.form.end.label'), :hint => conditional_hint('conferences.form.end.hint'), :include_blank => true, :start_year => Time.now.year, :end_year => Time.now.year + 2
= f.input :description, :label => t('conferences.form.description.label'), :hint => conditional_hint('conferences.form.description.hint')
= f.input :pin, :label => t('conferences.form.pin.label'), :hint => conditional_hint('conferences.form.pin.hint')
- = f.input :max_members, :collection => 1..MAXIMUM_NUMBER_OF_PEOPLE_IN_A_CONFERENCE, :include_blank => false, :label => t('conferences.form.max_members.label'), :hint => conditional_hint('conferences.form.max_members.hint')
+ = f.input :max_members, :collection => 1..GsParameter.get('MAXIMUM_NUMBER_OF_PEOPLE_IN_A_CONFERENCE'), :include_blank => false, :label => t('conferences.form.max_members.label'), :hint => conditional_hint('conferences.form.max_members.hint')
= f.input :open_for_anybody, :label => t('conferences.form.open_for_anybody.label'), :hint => conditional_hint('conferences.form.open_for_anybody.hint')
= f.input :announce_new_member_by_name, :label => t('conferences.form.announce_new_member_by_name.label'), :hint => conditional_hint('conferences.form.announce_new_member_by_name.hint')
= f.input :announce_left_member_by_name, :label => t('conferences.form.announce_left_member_by_name.label'), :hint => conditional_hint('conferences.form.announce_left_member_by_name.hint') \ No newline at end of file
diff --git a/app/views/config_snom/show.xml.haml b/app/views/config_snom/show.xml.haml
index a11715d..5f53802 100644
--- a/app/views/config_snom/show.xml.haml
+++ b/app/views/config_snom/show.xml.haml
@@ -48,8 +48,8 @@
%use_proxy_number_guessing{:perm => 'RW'}= 'off'
%guess_number{:perm => 'RW'}= 'off'
%guess_start_length{:perm => 'RW'}= '3'
- %ieee8021x_eap_md5_username{:perm => 'RW'}= PROVISIONING_IEEE8021X_EAP_USERNAME
- %ieee8021x_eap_md5_password{:perm => 'RW'}= PROVISIONING_IEEE8021X_EAP_PASSWORD
+ %ieee8021x_eap_md5_username{:perm => 'RW'}= GsParameter.get('PROVISIONING_IEEE8021X_EAP_USERNAME')
+ %ieee8021x_eap_md5_password{:perm => 'RW'}= GsParameter.get('PROVISIONING_IEEE8021X_EAP_PASSWORD')
- 0.upto(9) do |ringer_idx|
%internal_ringer_text{:idx => ringer_idx, :perm => 'RW'}= "Ringer#{(ringer_idx+1)}"
diff --git a/app/views/config_snom/state_settings.xml.haml b/app/views/config_snom/state_settings.xml.haml
index ac0e872..6be1efc 100644
--- a/app/views/config_snom/state_settings.xml.haml
+++ b/app/views/config_snom/state_settings.xml.haml
@@ -1,5 +1,5 @@
!!! XML
-%SnomIPPhoneMenu{:state => 'relevant', :title => "Gemeinschaft #{GEMEINSCHAFT_VERSION}"}
+%SnomIPPhoneMenu{:state => 'relevant', :title => "Gemeinschaft #{GsParameter.get('GEMEINSCHAFT_VERSION')}"}
%MenuItem{:name => '$(lang:menu100_phone_book)'}
%URL= "#{@base_url}/#{@sip_account_ids.first}/phone_book.xml"
%Menu{:name => '$(lang:menu100_call_lists)'}
diff --git a/app/views/gemeinschaft_setups/new.de.html.haml b/app/views/gemeinschaft_setups/new.de.html.haml
index 5e79115..2e148f3 100644
--- a/app/views/gemeinschaft_setups/new.de.html.haml
+++ b/app/views/gemeinschaft_setups/new.de.html.haml
@@ -1,4 +1,4 @@
-- title "Konfiguration einer Gemeinschaft #{GEMEINSCHAFT_VERSION} Installation"
+- title "Konfiguration einer Gemeinschaft #{GsParameter.get('GEMEINSCHAFT_VERSION')} Installation"
= simple_form_for(@gemeinschaft_setup) do |f|
= f.error_notification
diff --git a/app/views/gemeinschaft_setups/new.html.haml b/app/views/gemeinschaft_setups/new.html.haml
index f5f0e81..ab5a70f 100644
--- a/app/views/gemeinschaft_setups/new.html.haml
+++ b/app/views/gemeinschaft_setups/new.html.haml
@@ -1,4 +1,4 @@
-- title "Configure a new Gemeinschaft #{GEMEINSCHAFT_VERSION} server"
+- title "Configure a new Gemeinschaft #{GsParameter.get('GEMEINSCHAFT_VERSION')} server"
= simple_form_for(@gemeinschaft_setup) do |f|
= f.error_notification
diff --git a/app/views/gs_parameters/_form.html.haml b/app/views/gs_parameters/_form.html.haml
new file mode 100644
index 0000000..ea69e95
--- /dev/null
+++ b/app/views/gs_parameters/_form.html.haml
@@ -0,0 +1,7 @@
+= simple_form_for(@gs_parameter) do |f|
+ = f.error_notification
+
+ = render "form_core", :f => f
+
+ .actions
+ = f.button :submit, conditional_t('gs_parameters.form.submit') \ No newline at end of file
diff --git a/app/views/gs_parameters/_form_core.html.haml b/app/views/gs_parameters/_form_core.html.haml
new file mode 100644
index 0000000..ebb5f2d
--- /dev/null
+++ b/app/views/gs_parameters/_form_core.html.haml
@@ -0,0 +1,6 @@
+.inputs
+ = f.input :name, :label => t('gs_parameters.form.name.label'), :hint => conditional_hint('gs_parameters.form.name.hint')
+ = f.input :section, :label => t('gs_parameters.form.section.label'), :hint => conditional_hint('gs_parameters.form.section.hint')
+ = f.input :value, :label => t('gs_parameters.form.value.label'), :hint => conditional_hint('gs_parameters.form.value.hint')
+ = f.input :class_type, :label => t('gs_parameters.form.class_type.label'), :hint => conditional_hint('gs_parameters.form.class_type.hint')
+ = f.input :description, :label => t('gs_parameters.form.description.label'), :hint => conditional_hint('gs_parameters.form.description.hint')
diff --git a/app/views/gs_parameters/_index_core.html.haml b/app/views/gs_parameters/_index_core.html.haml
new file mode 100644
index 0000000..cc6fdd9
--- /dev/null
+++ b/app/views/gs_parameters/_index_core.html.haml
@@ -0,0 +1,17 @@
+%table
+ %tr
+ %th= t('gs_parameters.index.name')
+ %th= t('gs_parameters.index.section')
+ %th= t('gs_parameters.index.value')
+ %th= t('gs_parameters.index.class_type')
+ %th= t('gs_parameters.index.description')
+
+ - reset_cycle
+ - for gs_parameter in gs_parameters
+ %tr{:class => cycle('odd', 'even')}
+ %td= gs_parameter.name
+ %td= gs_parameter.section
+ %td= gs_parameter.value
+ %td= gs_parameter.class_type
+ %td= gs_parameter.description
+ =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:child => gs_parameter} \ No newline at end of file
diff --git a/app/views/gs_parameters/edit.html.haml b/app/views/gs_parameters/edit.html.haml
new file mode 100644
index 0000000..7c24234
--- /dev/null
+++ b/app/views/gs_parameters/edit.html.haml
@@ -0,0 +1,3 @@
+- title t("gs_parameters.edit.page_title")
+
+= render "form" \ No newline at end of file
diff --git a/app/views/gs_parameters/index.html.haml b/app/views/gs_parameters/index.html.haml
new file mode 100644
index 0000000..4c9ac84
--- /dev/null
+++ b/app/views/gs_parameters/index.html.haml
@@ -0,0 +1,6 @@
+- title t("gs_parameters.index.page_title")
+
+- if @gs_parameters && @gs_parameters.count > 0
+ = render "index_core", :gs_parameters => @gs_parameters
+
+= render :partial => 'shared/create_link', :locals => {:child_class => GsParameter} \ No newline at end of file
diff --git a/app/views/gs_parameters/new.html.haml b/app/views/gs_parameters/new.html.haml
new file mode 100644
index 0000000..845acc2
--- /dev/null
+++ b/app/views/gs_parameters/new.html.haml
@@ -0,0 +1,3 @@
+- title t("gs_parameters.new.page_title")
+
+= render "form" \ No newline at end of file
diff --git a/app/views/gs_parameters/show.html.haml b/app/views/gs_parameters/show.html.haml
new file mode 100644
index 0000000..185641d
--- /dev/null
+++ b/app/views/gs_parameters/show.html.haml
@@ -0,0 +1,19 @@
+- title t("gs_parameters.show.page_title")
+
+%p
+ %strong= t('gs_parameters.show.name') + ":"
+ = @gs_parameter.name
+%p
+ %strong= t('gs_parameters.show.section') + ":"
+ = @gs_parameter.section
+%p
+ %strong= t('gs_parameters.show.value') + ":"
+ = @gs_parameter.value
+%p
+ %strong= t('gs_parameters.show.class_type') + ":"
+ = @gs_parameter.class_type
+%p
+ %strong= t('gs_parameters.show.description') + ":"
+ = @gs_parameter.description
+
+= render :partial => 'shared/show_edit_destroy_part', :locals => { :child => @gs_parameter } \ No newline at end of file
diff --git a/app/views/hunt_groups/_form_core.html.haml b/app/views/hunt_groups/_form_core.html.haml
index 10a0111..53d44d1 100644
--- a/app/views/hunt_groups/_form_core.html.haml
+++ b/app/views/hunt_groups/_form_core.html.haml
@@ -1,4 +1,4 @@
.inputs
= f.input :name, :label => t('hunt_groups.form.name.label'), :hint => conditional_hint('hunt_groups.form.name.hint')
- = f.input :strategy, :as => :select, :label => t('hunt_groups.form.strategy.label'), :hint => conditional_hint('hunt_groups.form.strategy.hint'), :include_blank => false, :collection => HUNT_GROUP_STRATEGIES.map {|x| [I18n.t('hunt_groups.strategies.' + x), x] }
- = f.input :seconds_between_jumps, :collection => VALID_SECONDS_BETWEEN_JUMPS_VALUES, :label => t('hunt_groups.form.seconds_between_jumps.label'), :hint => conditional_hint('hunt_groups.form.seconds_between_jumps.hint') \ No newline at end of file
+ = f.input :strategy, :as => :select, :label => t('hunt_groups.form.strategy.label'), :hint => conditional_hint('hunt_groups.form.strategy.hint'), :include_blank => false, :collection => GsParameter.get('HUNT_GROUP_STRATEGIES').map {|x| [I18n.t('hunt_groups.strategies.' + x), x] }
+ = f.input :seconds_between_jumps, :collection => GsParameter.get('VALID_SECONDS_BETWEEN_JUMPS_VALUES'), :label => t('hunt_groups.form.seconds_between_jumps.label'), :hint => conditional_hint('hunt_groups.form.seconds_between_jumps.hint') \ No newline at end of file
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index 2c7faec..c1a56f2 100644
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -33,7 +33,7 @@
%footer#main
%ul
%li
- %a{:href => "http://amooma.de/gemeinschaft/gs5"} Gemeinschaft #{GEMEINSCHAFT_VERSION}
+ %a{:href => "http://amooma.de/gemeinschaft/gs5"} Gemeinschaft #{GsParameter.get('GEMEINSCHAFT_VERSION')}
- if GuiFunction.display?('amooma_commercial_support_link_in_footer', current_user)
%li
%a{:href => "http://amooma.de"} Kommerzieller Support und Consulting
diff --git a/app/views/page/beginners_intro.de.html.haml b/app/views/page/beginners_intro.de.html.haml
index 8d129db..4bd5b11 100644
--- a/app/views/page/beginners_intro.de.html.haml
+++ b/app/views/page/beginners_intro.de.html.haml
@@ -1,4 +1,4 @@
-- title "Erste Schritte mit Gemeinschaft #{GEMEINSCHAFT_VERSION}!"
+- title "Erste Schritte mit Gemeinschaft #{GsParameter.get('GEMEINSCHAFT_VERSION')}!"
%p
Sie müssen als erstes mindestens zwei neue SIP-Accounts anlegen. Dabei haben Sie die Wahl zwischen folgenden Varianten:
@@ -29,5 +29,5 @@
%p
Komfortabler ist der Betrieb von im Provisioning unterstützen Telefone. Diese können Sie beim Anlegen direkt mit einem bestimmten SIP-Account verknüpfen. Danach müssen Sie nur noch die Provisioningdaten per Hand ins Telefon eintragen oder ein paar Einstellungen in Ihrem DHCP-Server vornehmen. Hilfe dazu finden Sie im #{link_to 'Wiki', 'https://github.com/amooma/GS5/wiki'} und der #{link_to 'Mailingliste', 'https://groups.google.com/group/gs5-users/'}.
%p
- Folgende Telefone werden in der Version #{GEMEINSCHAFT_VERSION} vom automatischen Provisioning unterstützt:
+ Folgende Telefone werden in der Version #{GsParameter.get('GEMEINSCHAFT_VERSION')} vom automatischen Provisioning unterstützt:
= nicely_joined_with_commata(PhoneModel.order(:name).map{|phone_model| "#{phone_model.to_s}"}) \ No newline at end of file
diff --git a/app/views/page/beginners_intro.html.haml b/app/views/page/beginners_intro.html.haml
index 6227142..08af174 100644
--- a/app/views/page/beginners_intro.html.haml
+++ b/app/views/page/beginners_intro.html.haml
@@ -1,4 +1,4 @@
-- title "First steps with Gemeinschaft #{GEMEINSCHAFT_VERSION}!"
+- title "First steps with Gemeinschaft #{GsParameter.get('GEMEINSCHAFT_VERSION')}!"
%p
You have to create at least two new SIP accounts. You have the choice of two different versions:
@@ -29,5 +29,5 @@
%p
More comfortable is the use of auto provisioned phones. They can be linked to SIP accounts. After creating them in the WebGUI you have to set the Provisioning URL in the phone or setup your DHCP server to give them this data. You'll find help in our #{link_to 'Wiki', 'https://github.com/amooma/GS5/wiki'} or in our #{link_to 'mailinglist', 'https://groups.google.com/group/gs5-users/'}.
%p
- In version #{GEMEINSCHAFT_VERSION} the following phones can be used for provisioning:
+ In version #{GsParameter.get('GEMEINSCHAFT_VERSION')} the following phones can be used for provisioning:
= nicely_joined_with_commata(PhoneModel.order(:name).map{|phone_model| "#{phone_model.to_s}"}) \ No newline at end of file
diff --git a/app/views/page/index.de.html.haml b/app/views/page/index.de.html.haml
index 2928319..d5dd096 100644
--- a/app/views/page/index.de.html.haml
+++ b/app/views/page/index.de.html.haml
@@ -1,4 +1,4 @@
-- title "Gemeinschaft #{GEMEINSCHAFT_VERSION}"
+- title "Gemeinschaft #{GsParameter.get('GEMEINSCHAFT_VERSION')}"
%div
%h3 Aktueller Mandant
diff --git a/app/views/page/index.html.haml b/app/views/page/index.html.haml
index 9621395..f55ab37 100644
--- a/app/views/page/index.html.haml
+++ b/app/views/page/index.html.haml
@@ -1,4 +1,4 @@
-- title "Gemeinschaft #{GEMEINSCHAFT_VERSION}"
+- title "Gemeinschaft #{GsParameter.get('GEMEINSCHAFT_VERSION')}"
%div
%h3 Current tenant
diff --git a/app/views/phones/_form_core.html.haml b/app/views/phones/_form_core.html.haml
index e0c664b..b09ee35 100644
--- a/app/views/phones/_form_core.html.haml
+++ b/app/views/phones/_form_core.html.haml
@@ -9,7 +9,7 @@
:javascript
$(".fallback_sip_account_dropdown").hide()
- - if defined? NIGHTLY_REBOOT_OF_PHONES && NIGHTLY_REBOOT_OF_PHONES == true
+ - if defined? GsParameter.get('NIGHTLY_REBOOT_OF_PHONES') && GsParameter.get('NIGHTLY_REBOOT_OF_PHONES') == true
= f.input :nightly_reboot, :label => t('phones.form.nightly_reboot.label'), :hint => conditional_hint('phones.form.nightly_reboot.hint')
- if defined? PROVISIONING_KEY_LENGTH && PROVISIONING_KEY_LENGTH > 0
= f.input :provisioning_key_active, :label => t('phones.form.provisioning_key_active.label'), :hint => conditional_hint('phones.form.provisioning_key_active.hint')
diff --git a/app/views/phones/show.html.haml b/app/views/phones/show.html.haml
index a7ee952..f20facd 100644
--- a/app/views/phones/show.html.haml
+++ b/app/views/phones/show.html.haml
@@ -16,7 +16,7 @@
%strong= t('phones.show.fallback_sip_account_id') + ":"
= @phone.fallback_sip_account
-- if defined? NIGHTLY_REBOOT_OF_PHONES && NIGHTLY_REBOOT_OF_PHONES == true
+- if defined? GsParameter.get('NIGHTLY_REBOOT_OF_PHONES') && GsParameter.get('NIGHTLY_REBOOT_OF_PHONES') == true
%p
%strong= t('phones.show.nightly_reboot') + ":"
= @phone.nightly_reboot
diff --git a/app/views/tenants/_admin_area.de.html.haml b/app/views/tenants/_admin_area.de.html.haml
index b9b47d5..d125e58 100644
--- a/app/views/tenants/_admin_area.de.html.haml
+++ b/app/views/tenants/_admin_area.de.html.haml
@@ -102,10 +102,10 @@
= render "phone_books/index_core", :phone_books => @tenant.phone_books
= render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => PhoneBook}
-- if STRICT_INTERNAL_EXTENSION_HANDLING == true
+- if GsParameter.get('STRICT_INTERNAL_EXTENSION_HANDLING') == true
%h3= t('phone_number_ranges.index.page_title')
- - if @tenant.created_at > (Time.now - 15.minutes) && Delayed::Job.count > 0 && @tenant.phone_number_ranges.find_by_name(INTERNAL_EXTENSIONS).try(:phone_numbers).try(:count).to_i == 0
+ - if @tenant.created_at > (Time.now - 15.minutes) && Delayed::Job.count > 0 && @tenant.phone_number_ranges.find_by_name(GsParameter.get('INTERNAL_EXTENSIONS')).try(:phone_numbers).try(:count).to_i == 0
Der Mandant
= "\"#{@tenant}\""
wurde erst vor
@@ -114,5 +114,5 @@
= pluralize(Delayed::Job.count, 'Hintergrundprozesse')
\. Bitte warten Sie noch ein paar Minuten und laden anschließend diese Seite erneut.
- else
- =render 'phone_number_ranges/index_core', :phone_number_ranges => (@tenant.phone_number_ranges + @tenant.country.phone_number_ranges.where(:name => SERVICE_NUMBERS))
+ =render 'phone_number_ranges/index_core', :phone_number_ranges => (@tenant.phone_number_ranges + @tenant.country.phone_number_ranges.where(:name => GsParameter.get('SERVICE_NUMBERS')))
=render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => PhoneNumberRange}
diff --git a/app/views/tenants/_admin_area.html.haml b/app/views/tenants/_admin_area.html.haml
index d648143..afd50b5 100644
--- a/app/views/tenants/_admin_area.html.haml
+++ b/app/views/tenants/_admin_area.html.haml
@@ -102,15 +102,15 @@
= render "phone_books/index_core", :phone_books => @tenant.phone_books
= render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => PhoneBook}
-- if STRICT_INTERNAL_EXTENSION_HANDLING == true
+- if GsParameter.get('STRICT_INTERNAL_EXTENSION_HANDLING') == true
%h3= t('phone_number_ranges.index.page_title')
- - if @tenant.created_at > (Time.now - 15.minutes) && Delayed::Job.count > 0 && @tenant.phone_number_ranges.find_by_name(INTERNAL_EXTENSIONS).try(:phone_numbers).try(:count).to_i == 0
+ - if @tenant.created_at > (Time.now - 15.minutes) && Delayed::Job.count > 0 && @tenant.phone_number_ranges.find_by_name(GsParameter.get('INTERNAL_EXTENSIONS')).try(:phone_numbers).try(:count).to_i == 0
This tenant was created
= distance_of_time_in_words_to_now(@tenant.created_at)
ago. There are still
= pluralize(Delayed::Job.count, 'background job')
not finished. This can take a couple of minutes. Please reload this page later.
- else
- =render 'phone_number_ranges/index_core', :phone_number_ranges => (@tenant.phone_number_ranges + @tenant.country.phone_number_ranges.where(:name => SERVICE_NUMBERS))
+ =render 'phone_number_ranges/index_core', :phone_number_ranges => (@tenant.phone_number_ranges + @tenant.country.phone_number_ranges.where(:name => GsParameter.get('SERVICE_NUMBERS')))
=render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => PhoneNumberRange}
diff --git a/app/views/tenants/_form.html.haml b/app/views/tenants/_form.html.haml
index 2ca8a69..1641e78 100644
--- a/app/views/tenants/_form.html.haml
+++ b/app/views/tenants/_form.html.haml
@@ -11,13 +11,13 @@
= f.input :from_field_voicemail_email, :label => t('tenants.form.from_field_voicemail_email.label'), :hint => conditional_hint('tenants.form.from_field_voicemail_email.hint')
= f.input :from_field_pin_change_email, :label => t('tenants.form.from_field_pin_change_email.label'), :hint => conditional_hint('tenants.form.from_field_pin_change_email.hint')
- - if STRICT_INTERNAL_EXTENSION_HANDLING == true || STRICT_DID_HANDLING == true
+ - if GsParameter.get('STRICT_INTERNAL_EXTENSION_HANDLING') == true || GsParameter.get('STRICT_DID_HANDLING') == true
%h2= t('tenants.form.phone_numbers')
%p= t('tenants.form.intro')
- - if STRICT_INTERNAL_EXTENSION_HANDLING == true
+ - if GsParameter.get('STRICT_INTERNAL_EXTENSION_HANDLING') == true
= f.input :internal_extension_ranges, :label => t('tenants.form.internal_extension_ranges.label'), :hint => conditional_hint('tenants.form.internal_extension_ranges.hint')
- - if STRICT_DID_HANDLING == true
+ - if GsParameter.get('STRICT_DID_HANDLING') == true
= f.input :did_list, :label => t('tenants.form.did_list.label'), :hint => conditional_hint('tenants.form.did_list.hint')
.actions
diff --git a/config/initializers/gemeinschaft_parameters.rb b/config/initializers/gemeinschaft_parameters.rb
deleted file mode 100644
index 1624165..0000000
--- a/config/initializers/gemeinschaft_parameters.rb
+++ /dev/null
@@ -1,81 +0,0 @@
-# Use this file to set generic parameters for Gemeinschaft
-
-GEMEINSCHAFT_VERSION = '5.0.2-nightly-build'
-SUPER_TENANT_NAME = 'Super-Tenant'
-
-# System defaults
-MINIMUM_PIN_LENGTH = 4
-MAXIMUM_PIN_LENGTH = 10
-
-# GUI
-GUI_REDIRECT_HTTPS = false
-
-# Phone numbers
-# Only touch this if you know what you are doing!
-STRICT_INTERNAL_EXTENSION_HANDLING = false
-STRICT_DID_HANDLING = false
-
-# SIP defaults
-DEFAULT_LENGTH_SIP_AUTH_NAME = 10
-DEFAULT_LENGTH_SIP_PASSWORD = 15
-CALL_WAITING = false
-DEFAULT_CLIR_SETTING = false
-DEFAULT_CLIP_SETTING = true
-
-TO_S_MAX_CALLER_NAME_LENGTH = 25
-TO_S_MAX_LENGTH_OF_AUTH_NAME = 6
-
-# Pagination defaults
-DEFAULT_PAGINATION_ENTRIES_PER_PAGE = 50
-
-# Conference defaults
-MAXIMUM_NUMBER_OF_PEOPLE_IN_A_CONFERENCE = 100
-DEFAULT_MAX_CONFERENCE_MEMBERS = 10
-
-# Misc defaults
-MAX_EXTENSION_LENGTH = 6
-
-# Fax defaults
-DEFAULT_NUMBER_OF_RETRIES = 3
-DAYS_TILL_AUTO_DELETE = 90
-
-# Names of PhoneNumberRanges
-INTERNAL_EXTENSIONS = 'internal_extensions'
-SERVICE_NUMBERS = 'service_numbers'
-DIRECT_INWARD_DIALING_NUMBERS = 'direct_inward_dialing_numbers'
-
-# Callthrough defaults
-CALLTHROUGH_HAS_WHITELISTS = true
-
-# Hunt groups
-HUNT_GROUP_STRATEGIES = ['ring_all', 'ring_recursively']
-VALID_SECONDS_BETWEEN_JUMPS_VALUES = (1 .. 60).to_a.map{|x| x * 2}
-
-# Callforward
-DEFAULT_CALL_FORWARD_DEPTH = 1
-MAX_CALL_FORWARD_DEPTH = 40
-CALLFORWARD_DESTINATION_DEFAULT = '+49'
-CALLFORWARD_RULES_ACT_PER_SIP_ACCOUNT_DEFAULT = true
-
-# Phone
-PROVISIONING_AUTO_ADD_PHONE = true
-PROVISIONING_AUTO_ADD_SIP_ACCOUNT = true
-PROVISIONING_AUTO_TENANT_ID = 2
-PROVISIONING_AUTO_SIP_ACCOUNT_CALLER_PREFIX = 'Gemeinschaft '
-PROVISIONING_IEEE8021X_EAP_USERNAME = ''
-PROVISIONING_IEEE8021X_EAP_PASSWORD = ''
-NIGHTLY_REBOOT_OF_PHONES = true
-SIEMENS_HISTORY_RELOAD_TIMES = {0..6 => 600, 7..20 => 40, 21..24 => 300}
-
-# API configuration
-DEFAULT_API_TENANT_ID = 2
-REMOTE_IP_ADDRESS_WHITELIST = [] # e.g. ['10.0.0.1']
-IMPORT_CSV_FILE = '/var/tmp/ExampleVoipCsvExport.csv'
-DOUBLE_CHECK_POSITIVE_USERS_CSV = '/var/tmp/ExampleDoubleCheckVoipCsvExport.csv'
-IMPORT_CSV_ENCODING = 'UTF-8'
-USER_NAME_PREFIX = 'dtc'
-CALLTHROUGH_NAME_TO_BE_USED_FOR_DEFAULT_ACTIVATION = 'Callthrough for employees'
-
-# GS Cluster configuration
-WRITE_GS_CLUSTER_SYNC_LOG = true
-HOMEBASE_IP_ADDRESS = '0.0.0.0'
diff --git a/config/locales/views/gs_parameters/de.yml b/config/locales/views/gs_parameters/de.yml
new file mode 100644
index 0000000..f6935b8
--- /dev/null
+++ b/config/locales/views/gs_parameters/de.yml
@@ -0,0 +1,60 @@
+de:
+ gs_parameters:
+ name: 'Gsparameter'
+ controller:
+ successfuly_created: 'Gsparameter wurde angelegt.'
+ successfuly_updated: 'Gsparameter wurde aktualisiert.'
+ successfuly_destroyed: 'Gsparameter wurde gelöscht.'
+ index:
+ page_title: 'Übersicht von Gsparameter'
+ name: 'Name'
+ section: 'Section'
+ value: 'Value'
+ class_type: 'Class type'
+ description: 'Description'
+ actions:
+ confirm: 'Sind Sie sicher, dass Sie folgendes löschen möchten: Gsparameter'
+ destroy: 'Löschen'
+ edit: 'Bearbeiten'
+ show: 'Anzeigen'
+ create: 'Neu anlegen'
+ create_for: 'Gsparameter neu anlegen für %{resource}'
+ show:
+ page_title: 'Gsparameter bearbeiten'
+ name: 'Name'
+ section: 'Section'
+ value: 'Value'
+ class_type: 'Class type'
+ description: 'Description'
+ actions:
+ confirm: 'Sind Sie sicher, dass die dieses Element löschen möchten?'
+ destroy: 'Löschen'
+ edit: 'Bearbeiten'
+ view_all: 'Alle anzeigen'
+ new:
+ page_title: 'Gsparameter neu anlegen'
+ actions:
+ back_to_list: 'Zurück zur Übersicht'
+ edit:
+ page_title: 'Gsparameter bearbeiten'
+ actions:
+ back_to_list: 'Zurück zur Übersicht'
+ edit: 'Bearbeiten'
+ view_all: 'Alle anzeigen'
+ form:
+ name:
+ label: 'Name'
+ hint: ''
+ section:
+ label: 'Section'
+ hint: ''
+ value:
+ label: 'Value'
+ hint: ''
+ class_type:
+ label: 'Class type'
+ hint: ''
+ description:
+ label: 'Description'
+ hint: ''
+ button: 'Absenden' \ No newline at end of file
diff --git a/config/locales/views/gs_parameters/en.yml b/config/locales/views/gs_parameters/en.yml
new file mode 100644
index 0000000..040a6b8
--- /dev/null
+++ b/config/locales/views/gs_parameters/en.yml
@@ -0,0 +1,60 @@
+en:
+ gs_parameters:
+ name: 'Gsparameter'
+ controller:
+ successfuly_created: 'Successfully created Gsparameter.'
+ successfuly_updated: 'Successfully updated Gsparameter.'
+ successfuly_destroyed: 'Successfully destroyed Gsparameter.'
+ index:
+ page_title: 'Listing Gsparameter'
+ name: 'Name'
+ section: 'Section'
+ value: 'Value'
+ class_type: 'Class type'
+ description: 'Description'
+ actions:
+ confirm: 'Are you sure you want to delete this Gsparameter?'
+ destroy: 'Delete'
+ edit: 'Edit'
+ show: 'View'
+ create: 'New'
+ create_for: 'New Gsparameter for %{resource}'
+ show:
+ page_title: 'Show Gsparameter'
+ name: 'Name'
+ section: 'Section'
+ value: 'Value'
+ class_type: 'Class type'
+ description: 'Description'
+ actions:
+ confirm: 'Are you sure you want to delete this element?'
+ destroy: 'Delete'
+ edit: 'Edit'
+ view_all: 'View All'
+ new:
+ page_title: 'New Gsparameter'
+ actions:
+ back_to_list: 'Back to Index'
+ edit:
+ page_title: 'Editing Gsparameter'
+ actions:
+ back_to_list: 'Back to Index'
+ edit: 'Edit'
+ view_all: 'View All'
+ form:
+ name:
+ label: 'Name'
+ hint: ''
+ section:
+ label: 'Section'
+ hint: ''
+ value:
+ label: 'Value'
+ hint: ''
+ class_type:
+ label: 'Class type'
+ hint: ''
+ description:
+ label: 'Description'
+ hint: ''
+ button: 'Submit' \ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index 33238dc..ee333fe 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,4 +1,6 @@
Gemeinschaft42c::Application.routes.draw do
+ resources :gs_parameters
+
resources :automatic_call_distributors
resources :gs_cluster_sync_log_entries
@@ -53,7 +55,7 @@ Gemeinschaft42c::Application.routes.draw do
end
end
- if CALLTHROUGH_HAS_WHITELISTS == true
+ if GsParameter.get('CALLTHROUGH_HAS_WHITELISTS') == true
resources :whitelists, :only => [] do
resources :phone_numbers do
member do
@@ -237,7 +239,7 @@ Gemeinschaft42c::Application.routes.draw do
resources :conferences
resources :phone_number_ranges
resources :callthroughs
- if CALLTHROUGH_HAS_WHITELISTS == true
+ if GsParameter.get('CALLTHROUGH_HAS_WHITELISTS') == true
resources :whitelists
end
resources :hunt_groups
@@ -252,7 +254,7 @@ Gemeinschaft42c::Application.routes.draw do
put 'move_lower'
end
end
- if CALLTHROUGH_HAS_WHITELISTS == true
+ if GsParameter.get('CALLTHROUGH_HAS_WHITELISTS') == true
resources :whitelists
end
end
diff --git a/db/migrate/20130105120126_create_gs_parameters.rb b/db/migrate/20130105120126_create_gs_parameters.rb
new file mode 100644
index 0000000..b8b915b
--- /dev/null
+++ b/db/migrate/20130105120126_create_gs_parameters.rb
@@ -0,0 +1,16 @@
+class CreateGsParameters < ActiveRecord::Migration
+ def self.up
+ create_table :gs_parameters do |t|
+ t.string :name
+ t.string :section
+ t.text :value
+ t.string :class_type
+ t.string :description
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :gs_parameters
+ end
+end
diff --git a/db/migrate/20130105120353_populate_gs_parameter_with_defaults.rb b/db/migrate/20130105120353_populate_gs_parameter_with_defaults.rb
new file mode 100644
index 0000000..a4c9358
--- /dev/null
+++ b/db/migrate/20130105120353_populate_gs_parameter_with_defaults.rb
@@ -0,0 +1,103 @@
+class PopulateGsParameterWithDefaults < ActiveRecord::Migration
+ def up
+ # Generic
+ #
+ GsParameter.create(:name => 'GEMEINSCHAFT_VERSION', :section => 'Generic', :value => '5.0.2-nightly-build', :class_type => 'String')
+ GsParameter.create(:name => 'SUPER_TENANT_NAME', :section => 'Generic', :value => 'Super-Tenant', :class_type => 'String')
+
+ # System defaults
+ #
+ GsParameter.create(:name => 'MINIMUM_PIN_LENGTH', :section => 'System defaults', :value => '4', :class_type => 'Integer')
+ GsParameter.create(:name => 'MAXIMUM_PIN_LENGTH', :section => 'System defaults', :value => '10', :class_type => 'Integer')
+
+ # GUI
+ #
+ GsParameter.create(:name => 'GUI_REDIRECT_HTTPS', :section => 'GUI', :value => 'false', :class_type => 'Boolean')
+
+ # Phone numbers
+ # Only touch this if you know what you are doing!
+ #
+ GsParameter.create(:name => 'STRICT_INTERNAL_EXTENSION_HANDLING', :section => 'Phone numbers', :value => 'false', :class_type => 'Boolean')
+ GsParameter.create(:name => 'STRICT_DID_HANDLING', :section => 'Phone numbers', :value => 'false', :class_type => 'Boolean')
+
+ # SIP defaults
+ #
+ GsParameter.create(:name => 'DEFAULT_LENGTH_SIP_AUTH_NAME', :section => 'SIP Defaults', :value => '10', :class_type => 'Integer')
+ GsParameter.create(:name => 'DEFAULT_LENGTH_SIP_PASSWORD', :section => 'SIP Defaults', :value => '15', :class_type => 'Integer')
+ GsParameter.create(:name => 'CALL_WAITING', :section => 'SIP Defaults', :value => 'false', :class_type => 'Boolean')
+ GsParameter.create(:name => 'DEFAULT_CLIR_SETTING', :section => 'SIP Defaults', :value => 'false', :class_type => 'Boolean')
+ GsParameter.create(:name => 'DEFAULT_CLIP_SETTING', :section => 'SIP Defaults', :value => 'true', :class_type => 'Boolean')
+ GsParameter.create(:name => 'TO_S_MAX_CALLER_NAME_LENGTH', :section => 'SIP Defaults', :value => '25', :class_type => 'Integer')
+ GsParameter.create(:name => 'TO_S_MAX_LENGTH_OF_AUTH_NAME', :section => 'SIP Defaults', :value => '6', :class_type => 'Integer')
+
+ # Pagination defaults
+ #
+ GsParameter.create(:name => 'DEFAULT_PAGINATION_ENTRIES_PER_PAGE', :section => 'Pagination defaults', :value => '50', :class_type => 'Integer')
+
+ # Conference defaults
+ #
+ GsParameter.create(:name => 'MAXIMUM_NUMBER_OF_PEOPLE_IN_A_CONFERENCE', :section => 'Conference defaults', :value => '100', :class_type => 'Integer')
+ GsParameter.create(:name => 'DEFAULT_MAX_CONFERENCE_MEMBERS', :section => 'Conference defaults', :value => '10', :class_type => 'Integer')
+
+ # Misc defaults
+ #
+ GsParameter.create(:name => 'MAX_EXTENSION_LENGTH', :section => 'Misc defaults', :value => '6', :class_type => 'Integer')
+
+ # Fax defaults
+ #
+ GsParameter.create(:name => 'DEFAULT_NUMBER_OF_RETRIES', :section => 'Fax defaults', :value => '3', :class_type => 'Integer')
+ GsParameter.create(:name => 'DAYS_TILL_AUTO_DELETE', :section => 'Fax defaults', :value => '90', :class_type => 'Integer')
+
+ # Names of PhoneNumberRanges
+ #
+ GsParameter.create(:name => 'INTERNAL_EXTENSIONS', :section => 'PhoneNumberRanges defaults', :value => 'internal_extensions', :class_type => 'String')
+ GsParameter.create(:name => 'SERVICE_NUMBERS', :section => 'PhoneNumberRanges defaults', :value => 'service_numbers', :class_type => 'String')
+ GsParameter.create(:name => 'DIRECT_INWARD_DIALING_NUMBERS', :section => 'PhoneNumberRanges defaults', :value => 'direct_inward_dialing_numbers', :class_type => 'String')
+
+ # Callthrough defaults
+ #
+ GsParameter.create(:name => 'CALLTHROUGH_HAS_WHITELISTS', :section => 'Callthrough defaults', :value => 'true', :class_type => 'Boolean')
+
+ # Huntgroup defaults
+ #
+ GsParameter.create(:name => 'HUNT_GROUP_STRATEGIES', :section => 'Huntgroup defaults', :value => ['ring_all', 'ring_recursively'].to_yaml, :class_type => 'YAML')
+ GsParameter.create(:name => 'VALID_SECONDS_BETWEEN_JUMPS_VALUES', :section => 'Huntgroup defaults', :value => (1 .. 60).to_a.map{|x| x * 2}.to_yaml, :class_type => 'YAML')
+
+ # Callforward defaults
+ #
+ GsParameter.create(:name => 'DEFAULT_CALL_FORWARD_DEPTH', :section => 'Callforward defaults', :value => '1', :class_type => 'Integer')
+ GsParameter.create(:name => 'MAX_CALL_FORWARD_DEPTH', :section => 'Callforward defaults', :value => '40', :class_type => 'Integer')
+ GsParameter.create(:name => 'CALLFORWARD_DESTINATION_DEFAULT', :section => 'Callforward defaults', :value => '+49', :class_type => 'String')
+ GsParameter.create(:name => 'CALLFORWARD_RULES_ACT_PER_SIP_ACCOUNT_DEFAULT', :section => 'Callforward defaults', :value => 'true', :class_type => 'Boolean')
+
+ # Phone
+ #
+ GsParameter.create(:name => 'PROVISIONING_AUTO_ADD_PHONE', :section => 'Phone', :value => 'true', :class_type => 'Boolean')
+ GsParameter.create(:name => 'PROVISIONING_AUTO_ADD_SIP_ACCOUNT', :section => 'Phone', :value => 'true', :class_type => 'Boolean')
+ GsParameter.create(:name => 'PROVISIONING_AUTO_TENANT_ID', :section => 'Phone', :value => '2', :class_type => 'Integer')
+ GsParameter.create(:name => 'PROVISIONING_AUTO_SIP_ACCOUNT_CALLER_PREFIX', :section => 'Phone', :value => 'Gemeinschaft ', :class_type => 'String')
+ GsParameter.create(:name => 'PROVISIONING_IEEE8021X_EAP_USERNAME', :section => 'Phone', :value => '', :class_type => 'String')
+ GsParameter.create(:name => 'PROVISIONING_IEEE8021X_EAP_PASSWORD', :section => 'Phone', :value => '', :class_type => 'String')
+ GsParameter.create(:name => 'NIGHTLY_REBOOT_OF_PHONES', :section => 'Phone', :value => 'true', :class_type => 'Boolean')
+ GsParameter.create(:name => 'SIEMENS_HISTORY_RELOAD_TIMES', :section => 'Phone', :value => {0..6 => 600, 7..20 => 40, 21..24 => 300}.to_yaml, :class_type => 'YAML')
+
+ # API configuration
+ #
+ GsParameter.create(:name => 'DEFAULT_API_TENANT_ID', :section => 'API configuration', :value => '2', :class_type => 'Integer')
+ GsParameter.create(:name => 'REMOTE_IP_ADDRESS_WHITELIST', :section => 'API configuration', :value => [].to_yaml, :class_type => 'YAML') # e.g. ['10.0.0.1']
+ GsParameter.create(:name => 'IMPORT_CSV_FILE', :section => 'API configuration', :value => '/var/tmp/ExampleVoipCsvExport.csv', :class_type => 'String')
+ GsParameter.create(:name => 'DOUBLE_CHECK_POSITIVE_USERS_CSV', :section => 'API configuration', :value => '/var/tmp/ExampleDoubleCheckVoipCsvExport.csv', :class_type => 'String')
+ GsParameter.create(:name => 'IMPORT_CSV_ENCODING', :section => 'API configuration', :value => 'UTF-8', :class_type => 'String')
+ GsParameter.create(:name => 'USER_NAME_PREFIX', :section => 'API configuration', :value => 'dtc', :class_type => 'String')
+ GsParameter.create(:name => 'CALLTHROUGH_NAME_TO_BE_USED_FOR_DEFAULT_ACTIVATION', :section => 'API configuration', :value => 'Callthrough for employees', :class_type => 'String')
+
+ # GS Cluster configuration
+ #
+ GsParameter.create(:name => 'WRITE_GS_CLUSTER_SYNC_LOG', :section => 'GS Cluster ', :value => 'true', :class_type => 'Boolean')
+ GsParameter.create(:name => 'HOMEBASE_IP_ADDRESS', :section => 'GS Cluster ', :value => '0.0.0.0', :class_type => 'String')
+ end
+
+ def down
+ GsParameter.destroy_all
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 12114dc..e8b3c4a 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20121230110747) do
+ActiveRecord::Schema.define(:version => 20130105120353) do
create_table "access_authorizations", :force => true do |t|
t.string "access_authorizationable_type"
@@ -526,6 +526,16 @@ ActiveRecord::Schema.define(:version => 20121230110747) do
t.datetime "last_sync"
end
+ create_table "gs_parameters", :force => true do |t|
+ t.string "name"
+ t.string "section"
+ t.text "value"
+ t.string "class_type"
+ t.string "description"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
create_table "gui_function_memberships", :force => true do |t|
t.integer "gui_function_id"
t.integer "user_group_id"
diff --git a/db/to-dos/20120119160732_emergency_numbers_germany.rb b/db/to-dos/20120119160732_emergency_numbers_germany.rb
index 9dd9131..f0c02d9 100644
--- a/db/to-dos/20120119160732_emergency_numbers_germany.rb
+++ b/db/to-dos/20120119160732_emergency_numbers_germany.rb
@@ -11,7 +11,7 @@ class EmergencyNumbersGermany < ActiveRecord::Migration
################################################################
# Emergency numbers which shouldn't be used as extensions
################################################################
- notruf_nummern = germany.phone_number_ranges.find_or_create_by_name(SERVICE_NUMBERS)
+ notruf_nummern = germany.phone_number_ranges.find_or_create_by_name(GsParameter.get('SERVICE_NUMBERS'))
notruf_nummern.phone_numbers.find_or_create_by_name_and_number('Polizei', '110')
notruf_nummern.phone_numbers.find_or_create_by_name_and_number('Feuerwehr', '112')
notruf_nummern.phone_numbers.find_or_create_by_name_and_number('Zentrale Behördenrufnummer', '115')
@@ -25,6 +25,6 @@ class EmergencyNumbersGermany < ActiveRecord::Migration
def down
germany = Country.find_by_name('Germany')
- germany.phone_number_ranges.where(:name => SERVICE_NUMBERS).destroy_all
+ germany.phone_number_ranges.where(:name => GsParameter.get('SERVICE_NUMBERS')).destroy_all
end
end
diff --git a/do-it.sh b/do-it.sh
new file mode 100644
index 0000000..5369db5
--- /dev/null
+++ b/do-it.sh
@@ -0,0 +1,47 @@
+perl -p -i -e "s/GsParameter.get('CALLFORWARD_DESTINATION_DEFAULT')/GsParameter.get('GsParameter.get('CALLFORWARD_DESTINATION_DEFAULT')')/g" `grep -ril GsParameter.get('CALLFORWARD_DESTINATION_DEFAULT') *`
+perl -p -i -e "s/GsParameter.get('CALLFORWARD_RULES_ACT_PER_SIP_ACCOUNT_DEFAULT')/GsParameter.get('GsParameter.get('CALLFORWARD_RULES_ACT_PER_SIP_ACCOUNT_DEFAULT')')/g" `grep -ril GsParameter.get('CALLFORWARD_RULES_ACT_PER_SIP_ACCOUNT_DEFAULT') *`
+perl -p -i -e "s/GsParameter.get('CALLTHROUGH_HAS_WHITELISTS')/GsParameter.get('GsParameter.get('CALLTHROUGH_HAS_WHITELISTS')')/g" `grep -ril GsParameter.get('CALLTHROUGH_HAS_WHITELISTS') *`
+perl -p -i -e "s/GsParameter.get('CALLTHROUGH_NAME_TO_BE_USED_FOR_DEFAULT_ACTIVATION')/GsParameter.get('GsParameter.get('CALLTHROUGH_NAME_TO_BE_USED_FOR_DEFAULT_ACTIVATION')')/g" `grep -ril GsParameter.get('CALLTHROUGH_NAME_TO_BE_USED_FOR_DEFAULT_ACTIVATION') *`
+perl -p -i -e "s/GsParameter.get('CALL_WAITING')/GsParameter.get('GsParameter.get('CALL_WAITING')')/g" `grep -ril GsParameter.get('CALL_WAITING') *`
+perl -p -i -e "s/GsParameter.get('DAYS_TILL_AUTO_DELETE')/GsParameter.get('GsParameter.get('DAYS_TILL_AUTO_DELETE')')/g" `grep -ril GsParameter.get('DAYS_TILL_AUTO_DELETE') *`
+perl -p -i -e "s/GsParameter.get('DEFAULT_API_TENANT_ID')/GsParameter.get('GsParameter.get('DEFAULT_API_TENANT_ID')')/g" `grep -ril GsParameter.get('DEFAULT_API_TENANT_ID') *`
+perl -p -i -e "s/GsParameter.get('DEFAULT_CALL_FORWARD_DEPTH')/GsParameter.get('GsParameter.get('DEFAULT_CALL_FORWARD_DEPTH')')/g" `grep -ril GsParameter.get('DEFAULT_CALL_FORWARD_DEPTH') *`
+perl -p -i -e "s/GsParameter.get('DEFAULT_CLIP_SETTING')/GsParameter.get('GsParameter.get('DEFAULT_CLIP_SETTING')')/g" `grep -ril GsParameter.get('DEFAULT_CLIP_SETTING') *`
+perl -p -i -e "s/GsParameter.get('DEFAULT_CLIR_SETTING')/GsParameter.get('GsParameter.get('DEFAULT_CLIR_SETTING')')/g" `grep -ril GsParameter.get('DEFAULT_CLIR_SETTING') *`
+perl -p -i -e "s/GsParameter.get('DEFAULT_LENGTH_SIP_AUTH_NAME')/GsParameter.get('GsParameter.get('DEFAULT_LENGTH_SIP_AUTH_NAME')')/g" `grep -ril GsParameter.get('DEFAULT_LENGTH_SIP_AUTH_NAME') *`
+perl -p -i -e "s/GsParameter.get('DEFAULT_LENGTH_SIP_PASSWORD')/GsParameter.get('GsParameter.get('DEFAULT_LENGTH_SIP_PASSWORD')')/g" `grep -ril GsParameter.get('DEFAULT_LENGTH_SIP_PASSWORD') *`
+perl -p -i -e "s/GsParameter.get('DEFAULT_MAX_CONFERENCE_MEMBERS')/GsParameter.get('GsParameter.get('DEFAULT_MAX_CONFERENCE_MEMBERS')')/g" `grep -ril GsParameter.get('DEFAULT_MAX_CONFERENCE_MEMBERS') *`
+perl -p -i -e "s/GsParameter.get('DEFAULT_NUMBER_OF_RETRIES')/GsParameter.get('GsParameter.get('DEFAULT_NUMBER_OF_RETRIES')')/g" `grep -ril GsParameter.get('DEFAULT_NUMBER_OF_RETRIES') *`
+perl -p -i -e "s/GsParameter.get('DEFAULT_PAGINATION_ENTRIES_PER_PAGE')/GsParameter.get('GsParameter.get('DEFAULT_PAGINATION_ENTRIES_PER_PAGE')')/g" `grep -ril GsParameter.get('DEFAULT_PAGINATION_ENTRIES_PER_PAGE') *`
+perl -p -i -e "s/GsParameter.get('DIRECT_INWARD_DIALING_NUMBERS')/GsParameter.get('GsParameter.get('DIRECT_INWARD_DIALING_NUMBERS')')/g" `grep -ril GsParameter.get('DIRECT_INWARD_DIALING_NUMBERS') *`
+perl -p -i -e "s/GsParameter.get('DOUBLE_CHECK_POSITIVE_USERS_CSV')/GsParameter.get('GsParameter.get('DOUBLE_CHECK_POSITIVE_USERS_CSV')')/g" `grep -ril GsParameter.get('DOUBLE_CHECK_POSITIVE_USERS_CSV') *`
+perl -p -i -e "s/GsParameter.get('GEMEINSCHAFT_VERSION')/GsParameter.get('GsParameter.get('GEMEINSCHAFT_VERSION')')/g" `grep -ril GsParameter.get('GEMEINSCHAFT_VERSION') *`
+perl -p -i -e "s/GsParameter.get('GUI_REDIRECT_HTTPS')/GsParameter.get('GsParameter.get('GUI_REDIRECT_HTTPS')')/g" `grep -ril GsParameter.get('GUI_REDIRECT_HTTPS') *`
+perl -p -i -e "s/GsParameter.get('HOMEBASE_IP_ADDRESS')/GsParameter.get('GsParameter.get('HOMEBASE_IP_ADDRESS')')/g" `grep -ril GsParameter.get('HOMEBASE_IP_ADDRESS') *`
+perl -p -i -e "s/GsParameter.get('HUNT_GROUP_STRATEGIES')/GsParameter.get('GsParameter.get('HUNT_GROUP_STRATEGIES')')/g" `grep -ril GsParameter.get('HUNT_GROUP_STRATEGIES') *`
+perl -p -i -e "s/GsParameter.get('IMPORT_CSV_ENCODING')/GsParameter.get('GsParameter.get('IMPORT_CSV_ENCODING')')/g" `grep -ril GsParameter.get('IMPORT_CSV_ENCODING') *`
+perl -p -i -e "s/GsParameter.get('IMPORT_CSV_FILE')/GsParameter.get('GsParameter.get('IMPORT_CSV_FILE')')/g" `grep -ril GsParameter.get('IMPORT_CSV_FILE') *`
+perl -p -i -e "s/GsParameter.get('INTERNAL_EXTENSIONS')/GsParameter.get('GsParameter.get('INTERNAL_EXTENSIONS')')/g" `grep -ril GsParameter.get('INTERNAL_EXTENSIONS') *`
+perl -p -i -e "s/GsParameter.get('MAXIMUM_NUMBER_OF_PEOPLE_IN_A_CONFERENCE')/GsParameter.get('GsParameter.get('MAXIMUM_NUMBER_OF_PEOPLE_IN_A_CONFERENCE')')/g" `grep -ril GsParameter.get('MAXIMUM_NUMBER_OF_PEOPLE_IN_A_CONFERENCE') *`
+perl -p -i -e "s/GsParameter.get('MAXIMUM_PIN_LENGTH')/GsParameter.get('GsParameter.get('MAXIMUM_PIN_LENGTH')')/g" `grep -ril GsParameter.get('MAXIMUM_PIN_LENGTH') *`
+perl -p -i -e "s/GsParameter.get('MAX_CALL_FORWARD_DEPTH')/GsParameter.get('GsParameter.get('MAX_CALL_FORWARD_DEPTH')')/g" `grep -ril GsParameter.get('MAX_CALL_FORWARD_DEPTH') *`
+perl -p -i -e "s/GsParameter.get('MAX_EXTENSION_LENGTH')/GsParameter.get('GsParameter.get('MAX_EXTENSION_LENGTH')')/g" `grep -ril GsParameter.get('MAX_EXTENSION_LENGTH') *`
+perl -p -i -e "s/GsParameter.get('MINIMUM_PIN_LENGTH')/GsParameter.get('GsParameter.get('MINIMUM_PIN_LENGTH')')/g" `grep -ril GsParameter.get('MINIMUM_PIN_LENGTH') *`
+perl -p -i -e "s/GsParameter.get('NIGHTLY_REBOOT_OF_PHONES')/GsParameter.get('GsParameter.get('NIGHTLY_REBOOT_OF_PHONES')')/g" `grep -ril GsParameter.get('NIGHTLY_REBOOT_OF_PHONES') *`
+perl -p -i -e "s/GsParameter.get('PROVISIONING_AUTO_ADD_PHONE')/GsParameter.get('GsParameter.get('PROVISIONING_AUTO_ADD_PHONE')')/g" `grep -ril GsParameter.get('PROVISIONING_AUTO_ADD_PHONE') *`
+perl -p -i -e "s/GsParameter.get('PROVISIONING_AUTO_ADD_SIP_ACCOUNT')/GsParameter.get('GsParameter.get('PROVISIONING_AUTO_ADD_SIP_ACCOUNT')')/g" `grep -ril GsParameter.get('PROVISIONING_AUTO_ADD_SIP_ACCOUNT') *`
+perl -p -i -e "s/GsParameter.get('PROVISIONING_AUTO_SIP_ACCOUNT_CALLER_PREFIX')/GsParameter.get('GsParameter.get('PROVISIONING_AUTO_SIP_ACCOUNT_CALLER_PREFIX')')/g" `grep -ril GsParameter.get('PROVISIONING_AUTO_SIP_ACCOUNT_CALLER_PREFIX') *`
+perl -p -i -e "s/GsParameter.get('PROVISIONING_AUTO_TENANT_ID')/GsParameter.get('GsParameter.get('PROVISIONING_AUTO_TENANT_ID')')/g" `grep -ril GsParameter.get('PROVISIONING_AUTO_TENANT_ID') *`
+perl -p -i -e "s/GsParameter.get('PROVISIONING_IEEE8021X_EAP_PASSWORD')/GsParameter.get('GsParameter.get('PROVISIONING_IEEE8021X_EAP_PASSWORD')')/g" `grep -ril GsParameter.get('PROVISIONING_IEEE8021X_EAP_PASSWORD') *`
+perl -p -i -e "s/GsParameter.get('PROVISIONING_IEEE8021X_EAP_USERNAME')/GsParameter.get('GsParameter.get('PROVISIONING_IEEE8021X_EAP_USERNAME')')/g" `grep -ril GsParameter.get('PROVISIONING_IEEE8021X_EAP_USERNAME') *`
+perl -p -i -e "s/GsParameter.get('REMOTE_IP_ADDRESS_WHITELIST')/GsParameter.get('GsParameter.get('REMOTE_IP_ADDRESS_WHITELIST')')/g" `grep -ril GsParameter.get('REMOTE_IP_ADDRESS_WHITELIST') *`
+perl -p -i -e "s/GsParameter.get('SERVICE_NUMBERS')/GsParameter.get('GsParameter.get('SERVICE_NUMBERS')')/g" `grep -ril GsParameter.get('SERVICE_NUMBERS') *`
+perl -p -i -e "s/GsParameter.get('SIEMENS_HISTORY_RELOAD_TIMES')/GsParameter.get('GsParameter.get('SIEMENS_HISTORY_RELOAD_TIMES')')/g" `grep -ril GsParameter.get('SIEMENS_HISTORY_RELOAD_TIMES') *`
+perl -p -i -e "s/GsParameter.get('STRICT_DID_HANDLING')/GsParameter.get('GsParameter.get('STRICT_DID_HANDLING')')/g" `grep -ril GsParameter.get('STRICT_DID_HANDLING') *`
+perl -p -i -e "s/GsParameter.get('STRICT_INTERNAL_EXTENSION_HANDLING')/GsParameter.get('GsParameter.get('STRICT_INTERNAL_EXTENSION_HANDLING')')/g" `grep -ril GsParameter.get('STRICT_INTERNAL_EXTENSION_HANDLING') *`
+perl -p -i -e "s/GsParameter.get('SUPER_TENANT_NAME')/GsParameter.get('GsParameter.get('SUPER_TENANT_NAME')')/g" `grep -ril GsParameter.get('SUPER_TENANT_NAME') *`
+perl -p -i -e "s/GsParameter.get('TO_S_MAX_CALLER_NAME_LENGTH')/GsParameter.get('GsParameter.get('TO_S_MAX_CALLER_NAME_LENGTH')')/g" `grep -ril GsParameter.get('TO_S_MAX_CALLER_NAME_LENGTH') *`
+perl -p -i -e "s/GsParameter.get('TO_S_MAX_LENGTH_OF_AUTH_NAME')/GsParameter.get('GsParameter.get('TO_S_MAX_LENGTH_OF_AUTH_NAME')')/g" `grep -ril GsParameter.get('TO_S_MAX_LENGTH_OF_AUTH_NAME') *`
+perl -p -i -e "s/GsParameter.get('USER_NAME_PREFIX')/GsParameter.get('GsParameter.get('USER_NAME_PREFIX')')/g" `grep -ril GsParameter.get('USER_NAME_PREFIX') *`
+perl -p -i -e "s/GsParameter.get('VALID_SECONDS_BETWEEN_JUMPS_VALUES')/GsParameter.get('GsParameter.get('VALID_SECONDS_BETWEEN_JUMPS_VALUES')')/g" `grep -ril GsParameter.get('VALID_SECONDS_BETWEEN_JUMPS_VALUES') *`
+perl -p -i -e "s/GsParameter.get('WRITE_GS_CLUSTER_SYNC_LOG')/GsParameter.get('GsParameter.get('WRITE_GS_CLUSTER_SYNC_LOG')')/g" `grep -ril GsParameter.get('WRITE_GS_CLUSTER_SYNC_LOG') *`
diff --git a/lib/activerecord_extensions.rb b/lib/activerecord_extensions.rb
index 50c44be..102ddd8 100644
--- a/lib/activerecord_extensions.rb
+++ b/lib/activerecord_extensions.rb
@@ -16,7 +16,7 @@ class ActiveRecord::Base
#
def populate_gs_node_id
if self.attribute_names.include?('gs_node_id') && self.gs_node_id.blank?
- self.gs_node_id = GsNode.where(:ip_address => HOMEBASE_IP_ADDRESS).first.try(:id)
+ self.gs_node_id = GsNode.where(:ip_address => GsParameter.get('HOMEBASE_IP_ADDRESS')).first.try(:id)
end
end
@@ -47,7 +47,7 @@ class ActiveRecord::Base
logger.error "Couldn't #{action} #{self.class} with the ID #{self.id} on other GsNodes because #{self.class} doesn't have a is_native attribute."
else
if self.is_native != false
- if defined? WRITE_GS_CLUSTER_SYNC_LOG && WRITE_GS_CLUSTER_SYNC_LOG == true
+ if defined? GsParameter.get('WRITE_GS_CLUSTER_SYNC_LOG') && GsParameter.get('WRITE_GS_CLUSTER_SYNC_LOG') == true
if !(defined? $gs_cluster_loop_protection) || $gs_cluster_loop_protection != true
begin
GsClusterSyncLogEntry.create(
@@ -55,7 +55,7 @@ class ActiveRecord::Base
:action => action,
:content => content,
:history => history,
- :homebase_ip_address => HOMEBASE_IP_ADDRESS,
+ :homebase_ip_address => GsParameter.get('HOMEBASE_IP_ADDRESS'),
:waiting_to_be_synced => true,
:association_method => association_method,
:association_uuid => association_uuid
diff --git a/lib/tasks/cvs_user_import.rake b/lib/tasks/cvs_user_import.rake
index 2475a43..81959d5 100644
--- a/lib/tasks/cvs_user_import.rake
+++ b/lib/tasks/cvs_user_import.rake
@@ -24,14 +24,14 @@ namespace :user_import do
# Read the CSV data and store them in the new_users hash.
#
- csv_data = CSV.read(IMPORT_CSV_FILE, encoding: IMPORT_CSV_ENCODING)
+ csv_data = CSV.read(GsParameter.get('IMPORT_CSV_FILE'), encoding: GsParameter.get('IMPORT_CSV_ENCODING'))
headers = csv_data.shift.map {|i| i.to_s }
string_data = csv_data.map {|row| row.map {|cell| cell.to_s } }
new_users = string_data.map {|row| Hash[*headers.zip(row).flatten] }
- gs_node_id = GsNode.where(:ip_address => HOMEBASE_IP_ADDRESS).first.try(:id)
+ gs_node_id = GsNode.where(:ip_address => GsParameter.get('HOMEBASE_IP_ADDRESS')).first.try(:id)
- if File.exists?(DOUBLE_CHECK_POSITIVE_USERS_CSV)
- csv_data = CSV.read(DOUBLE_CHECK_POSITIVE_USERS_CSV, encoding: IMPORT_CSV_ENCODING)
+ if File.exists?(GsParameter.get('DOUBLE_CHECK_POSITIVE_USERS_CSV'))
+ csv_data = CSV.read(GsParameter.get('DOUBLE_CHECK_POSITIVE_USERS_CSV'), encoding: GsParameter.get('IMPORT_CSV_ENCODING'))
if csv_data.blank?
double_checked_user_names = []
else
@@ -45,13 +45,13 @@ namespace :user_import do
double_checked_user_names = new_users.map{|user| user['UserName']}
end
- tenant = Tenant.find(DEFAULT_API_TENANT_ID)
+ tenant = Tenant.find(GsParameter.get('DEFAULT_API_TENANT_ID'))
# Destroy deleted user by making a diff of where(:importer_checksum)
# and users in the CSV file.
#
- if defined?(USER_NAME_PREFIX) && !USER_NAME_PREFIX.blank?
- new_users_user_names = new_users.map{|x| USER_NAME_PREFIX.to_s + x['UserName'].to_s}
+ if defined?(GsParameter.get('USER_NAME_PREFIX')) && !GsParameter.get('USER_NAME_PREFIX').blank?
+ new_users_user_names = new_users.map{|x| GsParameter.get('USER_NAME_PREFIX').to_s + x['UserName'].to_s}
else
new_users_user_names = new_users.map{|x| x['UserName']}
end
@@ -67,8 +67,8 @@ namespace :user_import do
new_users.each do |csv_user|
if !(csv_user['UserName'].blank? || csv_user['Email'].blank?) && double_checked_user_names.include?(csv_user['UserName'])
csv_user['Email'] = csv_user['Email'].downcase
- if defined?(USER_NAME_PREFIX) && !USER_NAME_PREFIX.blank?
- csv_user['UserName'] = USER_NAME_PREFIX.to_s + csv_user['UserName']
+ if defined?(GsParameter.get('USER_NAME_PREFIX')) && !GsParameter.get('USER_NAME_PREFIX').blank?
+ csv_user['UserName'] = GsParameter.get('USER_NAME_PREFIX').to_s + csv_user['UserName']
end
md5_sum = Digest::MD5.hexdigest(csv_user.to_yaml)
@@ -177,7 +177,7 @@ namespace :user_import do
if phone_numbers_count < sip_account.phone_numbers.count
call_forward_case_offline = CallForwardCase.find_by_value('offline')
if call_forward_case_offline
- sip_account.phone_numbers.first.call_forwards.create(:call_forward_case_id => call_forward_case_offline.id, :call_forwardable_type => 'Voicemail', :active => true, :depth => DEFAULT_CALL_FORWARD_DEPTH)
+ sip_account.phone_numbers.first.call_forwards.create(:call_forward_case_id => call_forward_case_offline.id, :call_forwardable_type => 'Voicemail', :active => true, :depth => GsParameter.get('DEFAULT_CALL_FORWARD_DEPTH'))
end
end
else
@@ -280,8 +280,8 @@ namespace :user_import do
conference.start = nil
conference.end = nil
conference.open_for_anybody = true
- conference.max_members = DEFAULT_MAX_CONFERENCE_MEMBERS
- conference.pin = (1..MINIMUM_PIN_LENGTH).map{|i| (0 .. 9).to_a.sample}.join
+ conference.max_members = GsParameter.get('DEFAULT_MAX_CONFERENCE_MEMBERS')
+ conference.pin = (1..GsParameter.get('MINIMUM_PIN_LENGTH')).map{|i| (0 .. 9).to_a.sample}.join
conference.save
end
@@ -314,7 +314,7 @@ namespace :user_import do
cell_phone_number = csv_user['CellPhone'].to_s.gsub(/[^0-9\+]/, '')
if !cell_phone_number.blank?
- callthrough = tenant.callthroughs.find_or_create_by_name(CALLTHROUGH_NAME_TO_BE_USED_FOR_DEFAULT_ACTIVATION)
+ callthrough = tenant.callthroughs.find_or_create_by_name(GsParameter.get('CALLTHROUGH_NAME_TO_BE_USED_FOR_DEFAULT_ACTIVATION'))
access_authorization = callthrough.access_authorizations.find_or_create_by_name('Cellphones')
diff --git a/lib/tasks/fax.rake b/lib/tasks/fax.rake
index 1f1c282..41ae7cf 100644
--- a/lib/tasks/fax.rake
+++ b/lib/tasks/fax.rake
@@ -37,7 +37,7 @@ task :import_inbound_fax, [
-o \"#{pdf_file}\" \\
-p #{paper_size} \\
-a \"#{fax_arguments[:remote_station_id]}\" \\
- -c \"AMOOMA Gemeinschaft version #{GEMEINSCHAFT_VERSION}\" \\
+ -c \"AMOOMA Gemeinschaft version #{GsParameter.get('GEMEINSCHAFT_VERSION')}\" \\
-t \"#{fax_arguments[:remote_station_id]}\" \"#{tiff_file}\""
if !File.exists?( pdf_file )
diff --git a/lib/tasks/gs_cluster.rake b/lib/tasks/gs_cluster.rake
index 565fd83..7b49ebb 100644
--- a/lib/tasks/gs_cluster.rake
+++ b/lib/tasks/gs_cluster.rake
@@ -1,15 +1,15 @@
namespace :gs_cluster do
desc "Sync local data to other gs cluster nodes."
task :push_waiting_data_to_other_nodes => :environment do
- infinity_loop_protection_counter = GsClusterSyncLogEntry.where(:homebase_ip_address => HOMEBASE_IP_ADDRESS,
+ infinity_loop_protection_counter = GsClusterSyncLogEntry.where(:homebase_ip_address => GsParameter.get('HOMEBASE_IP_ADDRESS'),
:waiting_to_be_synced => true).count + 10
# One bite at a time.
#
- while GsClusterSyncLogEntry.where(:homebase_ip_address => HOMEBASE_IP_ADDRESS,
+ while GsClusterSyncLogEntry.where(:homebase_ip_address => GsParameter.get('HOMEBASE_IP_ADDRESS'),
:waiting_to_be_synced => true).any? &&
infinity_loop_protection_counter > 0
- GsClusterSyncLogEntry.where(:homebase_ip_address => HOMEBASE_IP_ADDRESS,
+ GsClusterSyncLogEntry.where(:homebase_ip_address => GsParameter.get('HOMEBASE_IP_ADDRESS'),
:waiting_to_be_synced => true).first.populate_other_cluster_nodes
infinity_loop_protection_counter -= 1
end
@@ -38,7 +38,7 @@ namespace :gs_cluster do
desc "Pull objects from nodes."
task :pull => :environment do
- local_node = GsNode.where(:ip_address => HOMEBASE_IP_ADDRESS).first
+ local_node = GsNode.where(:ip_address => GsParameter.get('HOMEBASE_IP_ADDRESS')).first
GsNode.where(:accepts_updates_from => true).each do |remote_node|
if remote_node.id == local_node.id
next
diff --git a/lib/tasks/send_fax_notifications.rake b/lib/tasks/send_fax_notifications.rake
index 039c509..2ac74c8 100644
--- a/lib/tasks/send_fax_notifications.rake
+++ b/lib/tasks/send_fax_notifications.rake
@@ -23,7 +23,7 @@ task :send_fax_notifications => :environment do
-o \"#{pdf_file}\" \\
-p #{paper_size} \\
-a \"#{fax_document.remote_station_id}\" \\
- -c \"AMOOMA Gemeinschaft version #{GEMEINSCHAFT_VERSION}\" \\
+ -c \"AMOOMA Gemeinschaft version #{GsParameter.get('GEMEINSCHAFT_VERSION')}\" \\
-t \"#{fax_document.remote_station_id}\" \"#{TMP_DIR}#{tiff_file}\""
if !File.exists?( pdf_file )
diff --git a/misc/freeswitch/scripts/dialplan/sip_call.lua b/misc/freeswitch/scripts/dialplan/sip_call.lua
index ab6a471..0071075 100644
--- a/misc/freeswitch/scripts/dialplan/sip_call.lua
+++ b/misc/freeswitch/scripts/dialplan/sip_call.lua
@@ -65,11 +65,11 @@ end
function SipCall.call_waiting_busy(self, sip_account)
require 'common.str'
if common.str.to_b(sip_account.record.call_waiting) then
- self.log:info('CALL_WAITING - status: enabled');
+ self.log:info('GsParameter.get('CALL_WAITING') - status: enabled');
return false;
else
local state = sip_account:call_state();
- self.log:info('CALL_WAITING - status: disabled, sip_account state: ', state);
+ self.log:info('GsParameter.get('CALL_WAITING') - status: disabled, sip_account state: ', state);
return state;
end
end
diff --git a/script/fax_new b/script/fax_new
index 8015da8..125632c 100755
--- a/script/fax_new
+++ b/script/fax_new
@@ -63,7 +63,7 @@ system "tiff2pdf \\
-o \"#{pdf_file}\" \\
-p #{paper_size} \\
-a \"#{fax_arguments[:remote_station_id]}\" \\
- -c \"AMOOMA Gemeinschaft version #{GEMEINSCHAFT_VERSION}\" \\
+ -c \"AMOOMA Gemeinschaft version #{GsParameter.get('GEMEINSCHAFT_VERSION')}\" \\
-t \"#{fax_arguments[:remote_station_id]}\" \"#{tiff_file}\""
if !File.exists?( pdf_file )
diff --git a/test/factories/phone_number_ranges.rb b/test/factories/phone_number_ranges.rb
index 68d9a03..306fdee 100644
--- a/test/factories/phone_number_ranges.rb
+++ b/test/factories/phone_number_ranges.rb
@@ -2,7 +2,7 @@
FactoryGirl.define do
factory :phone_number_range do
- name INTERNAL_EXTENSIONS
+ name 'internal_extensions'
association :phone_number_rangeable, :factory => :tenant
end
end
diff --git a/test/functional/gs_parameters_controller_test.rb b/test/functional/gs_parameters_controller_test.rb
new file mode 100644
index 0000000..a0e498a
--- /dev/null
+++ b/test/functional/gs_parameters_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class GsParametersControllerTest < ActionController::TestCase
+ setup do
+ @gs_parameter = gs_parameters(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:gs_parameters)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create gs_parameter" do
+ assert_difference('GsParameter.count') do
+ post :create, gs_parameter: @gs_parameter.attributes
+ end
+
+ assert_redirected_to gs_parameter_path(assigns(:gs_parameter))
+ end
+
+ test "should show gs_parameter" do
+ get :show, id: @gs_parameter.to_param
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @gs_parameter.to_param
+ assert_response :success
+ end
+
+ test "should update gs_parameter" do
+ put :update, id: @gs_parameter.to_param, gs_parameter: @gs_parameter.attributes
+ assert_redirected_to gs_parameter_path(assigns(:gs_parameter))
+ end
+
+ test "should destroy gs_parameter" do
+ assert_difference('GsParameter.count', -1) do
+ delete :destroy, id: @gs_parameter.to_param
+ end
+
+ assert_redirected_to gs_parameters_path
+ end
+end
diff --git a/test/unit/callthrough_test.rb b/test/unit/callthrough_test.rb
index c1c6ab3..5764c0d 100644
--- a/test/unit/callthrough_test.rb
+++ b/test/unit/callthrough_test.rb
@@ -30,7 +30,7 @@ class CallthroughTest < ActiveSupport::TestCase
@gemeinschaft_setup.save
super_tenant = Tenant.create(
- :name => SUPER_TENANT_NAME,
+ :name => GsParameter.get('SUPER_TENANT_NAME'),
:country_id => @gemeinschaft_setup.country.id,
:language_id => @gemeinschaft_setup.language_id,
:description => I18n.t('gemeinschaft_setups.initial_setup.super_tenant_description'),
@@ -94,14 +94,14 @@ class CallthroughTest < ActiveSupport::TestCase
# Check the amount of phone_numbers
#
- assert_equal 11, @tenant.phone_number_ranges.find_by_name(INTERNAL_EXTENSIONS).phone_numbers.count
- assert_equal 12, @tenant.phone_number_ranges.find_by_name(DIRECT_INWARD_DIALING_NUMBERS).phone_numbers.count
+ assert_equal 11, @tenant.phone_number_ranges.find_by_name(GsParameter.get('INTERNAL_EXTENSIONS')).phone_numbers.count
+ assert_equal 12, @tenant.phone_number_ranges.find_by_name(GsParameter.get('DIRECT_INWARD_DIALING_NUMBERS')).phone_numbers.count
end
test 'that a callthrough can only be created with at least one DID' do
assert_equal 0, Callthrough.count
- did = @tenant.phone_number_ranges.find_by_name(DIRECT_INWARD_DIALING_NUMBERS).phone_numbers.first
+ did = @tenant.phone_number_ranges.find_by_name(GsParameter.get('DIRECT_INWARD_DIALING_NUMBERS')).phone_numbers.first
callthrough = @tenant.callthroughs.build
@@ -118,7 +118,7 @@ class CallthroughTest < ActiveSupport::TestCase
# test 'that one DID can not be used by two different callthroughs' do
# assert_equal 0, Callthrough.count
- # did = @tenant.phone_number_ranges.find_by_name(DIRECT_INWARD_DIALING_NUMBERS).phone_numbers.first
+ # did = @tenant.phone_number_ranges.find_by_name(GsParameter.get('DIRECT_INWARD_DIALING_NUMBERS')).phone_numbers.first
# callthroughs = Array.new
# (1..2).each do |i|
diff --git a/test/unit/conference_test.rb b/test/unit/conference_test.rb
index 85f7ddb..e7c05c9 100644
--- a/test/unit/conference_test.rb
+++ b/test/unit/conference_test.rb
@@ -29,16 +29,16 @@ class ConferenceTest < ActiveSupport::TestCase
assert conference.valid?
- (MINIMUM_PIN_LENGTH - 1).times do |i|
+ (GsParameter.get('MINIMUM_PIN_LENGTH') - 1).times do |i|
pin = "#{10**i}"
conference.pin = pin
assert !conference.valid?
end
- conference.pin = "#{10**(MINIMUM_PIN_LENGTH - 1)}"
+ conference.pin = "#{10**(GsParameter.get('MINIMUM_PIN_LENGTH') - 1)}"
assert conference.valid?
- conference.pin = "-#{10**(MINIMUM_PIN_LENGTH - 1)}"
+ conference.pin = "-#{10**(GsParameter.get('MINIMUM_PIN_LENGTH') - 1)}"
assert !conference.valid?
conference.pin = 'Teststring'
diff --git a/test/unit/gs_parameter_test.rb b/test/unit/gs_parameter_test.rb
new file mode 100644
index 0000000..2e3793a
--- /dev/null
+++ b/test/unit/gs_parameter_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class GsParameterTest < ActiveSupport::TestCase
+ def test_should_be_valid
+ assert GsParameter.new.valid?
+ end
+end
diff --git a/test/unit/phone_number_test.rb b/test/unit/phone_number_test.rb
index 3fd92d6..c991b0f 100644
--- a/test/unit/phone_number_test.rb
+++ b/test/unit/phone_number_test.rb
@@ -200,7 +200,7 @@ class PhoneNumberTest < ActiveSupport::TestCase
# create a tenant
tenant = FactoryGirl.create(:tenant, :country_id => germany.id)
# create some extensions
- internal_extension_range = tenant.phone_number_ranges.create(:name => INTERNAL_EXTENSIONS)
+ internal_extension_range = tenant.phone_number_ranges.create(:name => GsParameter.get('INTERNAL_EXTENSIONS'))
['2000', '2001', '2003', '2004', '2005', '2006', '2007', '2008', '2009', '2010', '5', '99'].each do |extension|
internal_extension_range.phone_numbers.create(:name => "Extension #{extension}", :number => extension)
end