summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/config_snom_controller.rb20
-rw-r--r--db/migrate/20130107222128_set_provisioning_set_http_user.rb13
-rw-r--r--db/schema.rb2
3 files changed, 24 insertions, 11 deletions
diff --git a/app/controllers/config_snom_controller.rb b/app/controllers/config_snom_controller.rb
index 123f2cd..7ee8276 100644
--- a/app/controllers/config_snom_controller.rb
+++ b/app/controllers/config_snom_controller.rb
@@ -199,19 +199,19 @@ class ConfigSnomController < ApplicationController
end
end
- if defined?(PROVISIONING_SET_HTTP_USER) && @phone.http_user.blank?
- if PROVISIONING_SET_HTTP_USER.class == Fixnum
- @phone.update_attributes({ :http_user => SecureRandom.hex(PROVISIONING_SET_HTTP_USER) })
- elsif PROVISIONING_SET_HTTP_USER.class == String
- @phone.update_attributes({ :http_user => PROVISIONING_SET_HTTP_USER })
+ if !GsParameter.get('PROVISIONING_SET_HTTP_USER').nil? && @phone.http_user.blank?
+ if GsParameter.get('PROVISIONING_SET_HTTP_USER').class == Fixnum
+ @phone.update_attributes({ :http_user => SecureRandom.hex(GsParameter.get('PROVISIONING_SET_HTTP_USER')) })
+ elsif GsParameter.get('PROVISIONING_SET_HTTP_USER').class == String
+ @phone.update_attributes({ :http_user => GsParameter.get('PROVISIONING_SET_HTTP_USER') })
end
end
- if defined?(PROVISIONING_SET_HTTP_PASSWORD) && @phone.http_password.blank?
- if PROVISIONING_SET_HTTP_PASSWORD.class == Fixnum
- @phone.update_attributes({ :http_password => SecureRandom.hex(PROVISIONING_SET_HTTP_PASSWORD) })
- elsif PROVISIONING_SET_HTTP_PASSWORD.class == String
- @phone.update_attributes({ :http_password => PROVISIONING_SET_HTTP_PASSWORD })
+ if !GsParameter.get('PROVISIONING_SET_HTTP_PASSWORD').nil? && @phone.http_password.blank?
+ if GsParameter.get('PROVISIONING_SET_HTTP_PASSWORD').class == Fixnum
+ @phone.update_attributes({ :http_password => SecureRandom.hex(GsParameter.get('PROVISIONING_SET_HTTP_PASSWORD')) })
+ elsif GsParameter.get('PROVISIONING_SET_HTTP_PASSWORD').class == String
+ @phone.update_attributes({ :http_password => GsParameter.get('PROVISIONING_SET_HTTP_PASSWORD') })
end
end
diff --git a/db/migrate/20130107222128_set_provisioning_set_http_user.rb b/db/migrate/20130107222128_set_provisioning_set_http_user.rb
new file mode 100644
index 0000000..8066fb9
--- /dev/null
+++ b/db/migrate/20130107222128_set_provisioning_set_http_user.rb
@@ -0,0 +1,13 @@
+class SetProvisioningSetHttpUser < ActiveRecord::Migration
+ def up
+ # Provisioning stuff
+ #
+ GsParameter.create(:name => 'PROVISIONING_SET_HTTP_USER', :section => 'Provisioning', :value => 'admin', :class_type => 'String')
+ GsParameter.create(:name => 'PROVISIONING_SET_HTTP_PASSWORD', :section => 'Provisioning', :value => '8', :class_type => 'Integer')
+ end
+
+ def down
+ GsParameter.where(:name => 'PROVISIONING_SET_HTTP_USER').destroy_all
+ GsParameter.where(:name => 'PROVISIONING_SET_HTTP_PASSWORD').destroy_all
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index e8b3c4a..982c406 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 => 20130105120353) do
+ActiveRecord::Schema.define(:version => 20130107222128) do
create_table "access_authorizations", :force => true do |t|
t.string "access_authorizationable_type"