5 require './itsecur-lib.pl';
6 &foreign_require("acl", "acl-lib.pl");
7 &can_use_error("users");
8 @users = &acl::list_users();
12 &header($text{'user_title1'}, "",
13 undef, undef, undef, undef, &apply_button());
14 %gotmods = ( $module_name, 1 );
17 &header($text{'user_title2'}, "",
18 undef, undef, undef, undef, &apply_button());
19 ($user) = grep { $_->{'name'} eq $in{'name'} } @users;
20 %gotmods = map { $_, 1 } @{$user->{'modules'}};
24 print "<form action=save_user.cgi>\n";
25 print "<input type=hidden name=new value='$in{'new'}'>\n";
26 print "<input type=hidden name=old value='$in{'name'}'>\n";
27 print "<table border>\n";
28 print "<tr $tb> <td><b>$text{'user_header'}</b></td> </tr>\n";
29 print "<tr $cb> <td><table>\n";
32 print "<tr> <td nowrap><b>$text{'user_name'}</b></td> <td>\n";
33 printf "<input name=name size=20 value='%s'></td> </tr>\n",
37 print "<tr> <td nowrap><b>$text{'user_pass'}</b></td> <td>\n";
39 print "<input type=radio name=same value=1 checked> ",
40 "$text{'user_same'}\n";
41 print "<input type=radio name=same value=0> ",
42 "$text{'user_change'}\n";
44 print "<input name=pass type=password size=20></td> </tr>\n";
47 print "<tr> <td nowrap><b>$text{'user_enabled'}</b></td> <td>\n";
48 printf "<input type=radio name=enabled value=1 %s> %s\n",
49 $user->{'pass'} =~ /^\*LK\*/ ? "" : "checked", $text{'yes'};
50 printf "<input type=radio name=enabled value=0 %s> %s</td> </tr>\n",
51 $user->{'pass'} =~ /^\*LK\*/ ? "checked" : "", $text{'no'};
54 print "<tr> <td valign=top nowrap><b>$acl::text{'edit_ips'}</b></td>\n";
55 print "<td><table><tr>\n";
56 printf "<td nowrap><input name=ipmode type=radio value=0 %s> %s<br>\n",
57 $user->{'allow'} || $user->{'deny'} ? '' : 'checked',
58 $acl::text{'edit_all'};
59 printf "<input name=ipmode type=radio value=1 %s> %s<br>\n",
60 $user->{'allow'} ? 'checked' : '', $acl::text{'edit_allow'};
61 printf "<input name=ipmode type=radio value=2 %s> %s</td> <td>\n",
62 $user->{'deny'} ? 'checked' : '', $acl::text{'edit_deny'};
63 print "<textarea name=ips rows=4 cols=30>",
64 join("\n", split(/\s+/, $user->{'allow'} ? $user->{'allow'}
67 print "</tr></table></td> </tr>\n";
69 # Show allowed modules (from list for *this* user)
70 print "<tr> <td valign=top nowrap><b>$text{'user_mods'}</b></td>\n";
72 @mymods = grep { $acl{$base_remote_user,$_->{'dir'}} } &get_all_module_infos();
73 print "<td><select name=mods size=5 multiple>\n";
74 foreach $m (sort { $a->{'desc'} cmp $b->{'desc'} } @mymods) {
75 printf "<option value=%s %s>%s\n",
76 $m->{'dir'}, $gotmods{$m->{'dir'}} ? "selected" : "",
79 print "</select></td> </tr>\n";
82 print "<tr> <td colspan=2><hr></td> </tr>\n";
83 require "./acl_security.pl";
85 %uaccess = ( 'features' => 'rules services groups nat pat spoof logs apply',
86 'rfeatures' => 'rules services groups nat pat spoof logs apply',
90 %uaccess = &get_module_acl($user->{'name'});
92 &acl_security_form(\%uaccess);
94 print "</table></td></tr></table>\n";
96 print "<input type=submit value='$text{'create'}'>\n";
99 print "<input type=submit value='$text{'save'}'>\n";
100 print "<input type=submit name=delete value='$text{'delete'}'>\n";
103 &can_edit_disable("users");
106 &footer("list_users.cgi", $text{'users_return'});