From 350d21e77152b1da498ef88c1055e847420bcce1 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 23 Jun 2011 23:19:27 +0000 Subject: [PATCH] add svc_acct-no_edit_username config, RT#13416 --- FS/FS/Conf.pm | 7 +++++++ FS/FS/svc_acct.pm | 4 ++++ httemplate/edit/svc_acct.cgi | 11 ++++++++--- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index ac0f94cf2..7d9d6c736 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -2904,6 +2904,13 @@ and customer address. Include units.', }, { + 'key' => 'svc_acct-no_edit_username', + 'section' => 'shell', + 'description' => 'Disallow username editing.', + 'type' => 'checkbox', + }, + + { 'key' => 'zone-underscore', 'section' => 'BIND', 'description' => 'Allow underscores in zone names. As underscores are illegal characters in zone names, this option is not recommended.', diff --git a/FS/FS/svc_acct.pm b/FS/FS/svc_acct.pm index 1c4b574e9..9a2f0092b 100644 --- a/FS/FS/svc_acct.pm +++ b/FS/FS/svc_acct.pm @@ -993,6 +993,10 @@ sub replace { } + return "can't change username" + if $old->username ne $new->username + && $conf->exists('svc_acct-no_edit_username'); + #change homdir when we change username $new->setfield('dir', '') if $old->username ne $new->username; diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi index 33e5d0414..230a2a58a 100755 --- a/httemplate/edit/svc_acct.cgi +++ b/httemplate/edit/svc_acct.cgi @@ -45,9 +45,14 @@ function randomPass() { <% mt('Username') |h %> - - MAXLENGTH=<% $ulen %>> - +% if ( $conf->exists('svc_acct-no_edit_username') ) { + <% $svc_acct->username() %> + +% } else { + + MAXLENGTH=<% $ulen %>> + +% } %if ( $part_svc->part_svc_column('_password')->columnflag ne 'F' ) { -- 2.11.0