option to disable global uniqueness checking
authorivan <ivan>
Mon, 3 Apr 2006 23:26:03 +0000 (23:26 +0000)
committerivan <ivan>
Mon, 3 Apr 2006 23:26:03 +0000 (23:26 +0000)
FS/FS/Conf.pm
FS/FS/svc_acct.pm

index 6be6db5..c33f68b 100644 (file)
@@ -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' ],
   },
 
   {
index 2872a5f..aa3e592 100644 (file)
@@ -902,6 +902,9 @@ per export and with identical I<svcpart> 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')