summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2002-02-12 02:11:07 +0000
committerivan <ivan>2002-02-12 02:11:07 +0000
commitae23f6fe1ca915c995cfbf29bb39e7ed5e1cce2c (patch)
tree8c01bf01f5a214ae1bff6440e31c8c177a781e8a
parenta2c24812441a8f8ae3045a8c0c93c7f009d4f494 (diff)
add username_policy "@append domain"
add "select" config type, mmm
-rw-r--r--FS/FS/Conf.pm7
-rwxr-xr-xbin/svc_acct.export6
-rw-r--r--httemplate/config/config.cgi10
3 files changed, 19 insertions, 4 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 3a4f5b9de..5de25510c 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -711,9 +711,10 @@ httemplate/docs/config.html
{
'key' => 'username_policy',
'section' => '',
- 'description' => 'This file controls the mechanism for preventing duplicate usernames in passwd/radius files exported from svc_accts. This should be one of \'prepend domsvc\' \'append domsvc\' or \'append domain\'',
-# 'type' => 'select',
- 'type' => 'text',
+ 'description' => 'This file controls the mechanism for preventing duplicate usernames in passwd/radius files exported from svc_accts. This should be one of \'prepend domsvc\' \'append domsvc\' \'append domain\' or \'append @domain\'',
+ 'type' => 'select',
+ 'select_enum' => [ 'prepend domsvc', 'append domsvc', 'append domain', 'append @domain' ],
+ #'type' => 'text',
},
{
diff --git a/bin/svc_acct.export b/bin/svc_acct.export
index 3ac7a4f8f..e28de4aa7 100755
--- a/bin/svc_acct.export
+++ b/bin/svc_acct.export
@@ -1,6 +1,6 @@
#!/usr/bin/perl -w
#
-# $Id: svc_acct.export,v 1.28 2001-12-12 07:59:33 ivan Exp $
+# $Id: svc_acct.export,v 1.29 2002-02-12 02:11:07 ivan Exp $
#
# Create and export password, radius and vpopmail password files:
# passwd, passwd.adjunct, shadow, acp_passwd, acp_userinfo, acp_dialup
@@ -287,6 +287,10 @@ foreach $svc_domain (sort {$a->domain cmp $b->domain} @svc_domain) {
$username=$svc_acct->username . $svc_acct->domsvc;
} elsif ($userpolicy =~ /^append domain$/) {
$username=$svc_acct->username . $svc_domain->domain;
+ } elsif ($userpolicy =~ /^append domain$/) {
+ $username=$svc_acct->username . $svc_domain->domain;
+ } elsif ($userpolicy =~ /^append @domain$/) {
+ $username=$svc_acct->username . '@'. $svc_domain->domain;
} else {
die "Unknown policy in username_policy\n";
}
diff --git a/httemplate/config/config.cgi b/httemplate/config/config.cgi
index b9e84a8d5..f640d0b5e 100644
--- a/httemplate/config/config.cgi
+++ b/httemplate/config/config.cgi
@@ -30,6 +30,16 @@
<input name="<%= $i->key. $n %>" type="checkbox" value="1"<%= $conf->exists($i->key) ? ' CHECKED' : '' %>>
<% } elsif ( $type eq 'text' ) { %>
<input name="<%= $i->key. $n %>" type="<%= $type %>" value="<%= $conf->exists($i->key) ? $conf->config($i->key) : '' %>">
+ <% } elsif ( $type eq 'select' ) { %>
+ <select name="<%= $i->key. $n %>">
+ <% my %saw;
+ foreach my $value ( "", @{$i->select_enum} ) {
+ local($^W)=0; next if $saw{$value}++; %>
+ <option value="<%= $value %>"<%= $value eq $conf->config($i->key) ? ' SELECTED' : '' %>><%= $value %>
+ <% } %>
+ <% if ( $conf->exists($i->key) && $conf->config($i->key) && ! grep { $conf->config($i->key) eq $_ } @{$i->select_enum}) { %>
+ <option value=<%= $conf->config($i->key) %> SELECTED><%= conf->config($i->key) %>
+ <% } %>
<% } else { %>
<font color="#ff0000">unknown type <%= $type %></font>
<% } %>