From a3bf87ed7d6d693c28d081c2e7e8d8e55373cae4 Mon Sep 17 00:00:00 2001 From: spag Date: Mon, 31 Dec 2012 09:31:43 +0100 Subject: show hot deskable option for user sip accounts only --- app/controllers/sip_accounts_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'app/controllers/sip_accounts_controller.rb') diff --git a/app/controllers/sip_accounts_controller.rb b/app/controllers/sip_accounts_controller.rb index 1f3166e..8292a74 100644 --- a/app/controllers/sip_accounts_controller.rb +++ b/app/controllers/sip_accounts_controller.rb @@ -20,7 +20,9 @@ class SipAccountsController < ApplicationController @sip_account.clip = 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.hotdeskable = true + if @parent.class == User + @sip_account.hotdeskable = true + end # Make sure that we don't use an already taken auth_name # -- cgit v1.2.3 From ddb3dfa92ec0878240211cb2b7a8e125961b1360 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Sat, 5 Jan 2013 23:01:16 +0100 Subject: Moved to GsParemeter.get and set defaults for a couple of validations. --- app/controllers/sip_accounts_controller.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'app/controllers/sip_accounts_controller.rb') 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 -- cgit v1.2.3 From 6f69c1a85055ec7c2515719d79d2a7a4e60cec50 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Tue, 22 Jan 2013 15:31:47 +0100 Subject: UI improvements. --- app/controllers/sip_accounts_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/controllers/sip_accounts_controller.rb') diff --git a/app/controllers/sip_accounts_controller.rb b/app/controllers/sip_accounts_controller.rb index 4d042b3..a83208b 100644 --- a/app/controllers/sip_accounts_controller.rb +++ b/app/controllers/sip_accounts_controller.rb @@ -71,7 +71,7 @@ class SipAccountsController < ApplicationController def destroy @sip_account.destroy m = method( :"#{@parent.class.name.underscore}_sip_accounts_url" ) - redirect_to m.( @parent ), :notice => t('sip_accounts.controller.successfuly_destroyed') + redirect_to :back, :notice => t('sip_accounts.controller.successfuly_destroyed') end private -- cgit v1.2.3