add svc_acct-no_edit_username config, RT#13416
authorivan <ivan>
Thu, 23 Jun 2011 23:19:27 +0000 (23:19 +0000)
committerivan <ivan>
Thu, 23 Jun 2011 23:19:27 +0000 (23:19 +0000)
FS/FS/Conf.pm
FS/FS/svc_acct.pm
httemplate/edit/svc_acct.cgi

index ac0f94c..7d9d6c7 100644 (file)
@@ -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.',
index 1c4b574..9a2f009 100644 (file)
@@ -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;
 
index 33e5d04..230a2a5 100755 (executable)
@@ -45,9 +45,14 @@ function randomPass() {
 
 <TR>
   <TD ALIGN="right"><% mt('Username') |h %></TD>
-  <TD>
-    <INPUT TYPE="text" NAME="username" VALUE="<% $username %>" SIZE=<% $ulen2 %> MAXLENGTH=<% $ulen %>>
-  </TD>
+% if ( $conf->exists('svc_acct-no_edit_username') ) {
+    <TD BGCOLOR="#eeeeee"><% $svc_acct->username() %></TD>
+    <INPUT TYPE="hidden" NAME="username" VALUE="<% $username %>">
+% } else {
+    <TD>
+      <INPUT TYPE="text" NAME="username" VALUE="<% $username %>" SIZE=<% $ulen2 %> MAXLENGTH=<% $ulen %>>
+    </TD>
+% }
 </TR>
 
 %if ( $part_svc->part_svc_column('_password')->columnflag ne 'F' ) {