From: ivan Date: Sun, 6 Jun 2010 05:58:16 +0000 (+0000) Subject: add disable_settings_changes conf for the demo X-Git-Tag: root_of_svc_elec_features~194 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=dad1e2689ba5ff448bf1bbc9a586023137864d12 add disable_settings_changes conf for the demo --- diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index a1ee23c19..472320dba 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -717,6 +717,13 @@ worry that config_items is freeside-specific and icky. }, { + 'key' => 'business-onlinepayment-test_transaction', + 'section' => 'billing', + 'description' => 'Turns on the Business::OnlinePayment test_transaction flag. Note that not all gateway modules support this flag; if yours does not, transactions will still be sent live.', + 'type' => 'checkbox', + }, + + { 'key' => 'countrydefault', 'section' => 'UI', 'description' => 'Default two-letter country code (if not supplied, the default is `US\')', @@ -3008,6 +3015,13 @@ worry that config_items is freeside-specific and icky. }, { + 'key' => 'disable_settings_changes', + 'section' => '', + 'description' => 'Disable all settings changes, for demos, except for the usernames given in the comma-separated list.', + 'type' => [qw( checkbox text )], + }, + + { 'key' => 'cust_main-edit_agent_custid', 'section' => 'UI', 'description' => 'Enable editing of the agent_custid field.', diff --git a/httemplate/config/config-delete.cgi b/httemplate/config/config-delete.cgi index a05cb1e14..488886824 100644 --- a/httemplate/config/config-delete.cgi +++ b/httemplate/config/config-delete.cgi @@ -1,6 +1,17 @@ <%init> -die "access denied\n" - unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +my $curuser = $FS::CurrentUser::CurrentUser; +die "access denied\n" unless $curuser->access_right('Configuration'); + +my $fsconf = new FS::Conf; +if ( $fsconf->exists('disable_settings_changes') ) { + my @changers = split(/\s*,\s*/, $fsconf->config('disable_settings_changes')); + my %changers = map { $_=>1 } @changers; + unless ( $changers{$curuser->username} ) { + errorpage("Disabled in web demo"); + die "shouldn't be reached"; + } +} $cgi->param('confnum') =~ /^(\d+)$/ or die "illegal or missing confnum"; my $confnum = $1; diff --git a/httemplate/config/config-process.cgi b/httemplate/config/config-process.cgi index 788d9016e..c96f8d44d 100644 --- a/httemplate/config/config-process.cgi +++ b/httemplate/config/config-process.cgi @@ -70,10 +70,21 @@ my %namecol = ( ); <%init> -die "access denied\n" - unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +my $curuser = $FS::CurrentUser::CurrentUser; +die "access denied\n" unless $curuser->access_right('Configuration'); my $conf = new FS::Conf; + +if ( $conf->exists('disable_settings_changes') ) { + my @changers = split(/\s*,\s*/, $conf->config('disable_settings_changes')); + my %changers = map { $_=>1 } @changers; + unless ( $changers{$curuser->username} ) { + errorpage("Disabled in web demo"); + die "shouldn't be reached"; + } +} + $FS::Conf::DEBUG = 1; my @config_items = grep { $_->key != ~/^invoice_(html|latex|template)/ } $conf->config_items;