fs_ system accounts, RT#8731
[freeside.git] / httemplate / edit / process / access_user.html
1 %  if ( $cgi->param('_password') ne $cgi->param('_password2') ) {
2 %    $cgi->param('error', "The passwords do not match");
3 %    print $cgi->redirect(popurl(2) . "access_user.html?" . $cgi->query_string);
4 %  } else {
5 <%   include( 'elements/process.html',
6                  'table'       => 'access_user',
7                  'viewall_dir' => 'browse',
8                  'copy_on_empty' => [ '_password' ],
9                  'clear_on_error' => [ '_password', '_password2' ],
10                  'process_m2m' => { 'link_table'   => 'access_usergroup',
11                                     'target_table' => 'access_group',
12                                   },
13                  'precheck_callback'=> \&precheck_callback,
14              )
15 %>
16 %   }
17 <%init>
18
19 die "access denied"
20   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
21
22 if ( FS::Conf->new->exists('disable_acl_changes') ) {
23   errorpage('ACL changes disabled in public demo.');
24   die "shouldn't be reached";
25 }
26
27 sub precheck_callback {
28   my $cgi = shift;
29   my $o = FS::access_user->new({username => $cgi->param('username')});
30   if( $o->is_system_user and !$cgi->param('usernum') ) {
31     $cgi->param('username','');
32     return "username '".$o->username."' reserved for system account."
33   }
34   return '';
35 }
36 </%init>