From: ivan Date: Mon, 3 Apr 2006 23:26:03 +0000 (+0000) Subject: option to disable global uniqueness checking X-Git-Tag: BEFORE_FINAL_MASONIZE~179 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=7344abba907bdf860ee9afe602768ec44ded6c21 option to disable global uniqueness checking --- diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 6be6db5c5..c33f68b6c 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -1455,9 +1455,9 @@ httemplate/docs/config.html { 'key' => 'global_unique-username', 'section' => 'username', - 'description' => 'Global username uniqueness control: none (usual setting - check uniqueness per exports), username (all usernames are globally unique, regardless of domain or exports), or username@domain (all username@domain pairs are globally unique, regardless of exports)', + 'description' => 'Global username uniqueness control: none (usual setting - check uniqueness per exports), username (all usernames are globally unique, regardless of domain or exports), or username@domain (all username@domain pairs are globally unique, regardless of exports). disabled turns off duplicate checking completely and is STRONGLY NOT RECOMMENDED unless you REALLY need to turn this off.', 'type' => 'select', - 'select_enum' => [ 'none', 'username', 'username@domain' ], + 'select_enum' => [ 'none', 'username', 'username@domain', 'disabled' ], }, { diff --git a/FS/FS/svc_acct.pm b/FS/FS/svc_acct.pm index 2872a5f74..aa3e592a3 100644 --- a/FS/FS/svc_acct.pm +++ b/FS/FS/svc_acct.pm @@ -902,6 +902,9 @@ per export and with identical I values. sub _check_duplicate { my $self = shift; + my $global_unique = $conf->config('global_unique-username') || 'none'; + return '' if $global_unique eq 'disabled'; + #this is Pg-specific. what to do for mysql etc? # ( mysql LOCK TABLES certainly isn't equivalent or useful here :/ ) warn "$me locking svc_acct table for duplicate search" if $DEBUG; @@ -914,8 +917,6 @@ sub _check_duplicate { return 'unknown svcpart '. $self->svcpart; } - my $global_unique = $conf->config('global_unique-username') || 'none'; - my @dup_user = grep { !$self->svcnum || $_->svcnum != $self->svcnum } qsearch( 'svc_acct', { 'username' => $self->username } ); return gettext('username_in_use')