Handle hostnames with upper-case letters
[webmin.git] / rbac / acl_security.pl
1
2 do 'rbac-lib.pl';
3
4 # acl_security_form(&options)
5 # Output HTML for editing security options for the RBAC module
6 sub acl_security_form
7 {
8 $ui_table_cols = 4;
9 $ui_table_pos = 0;
10
11 print &ui_table_row($text{'acl_users'},
12                     &ui_radio("users", $_[0]->{'users'},
13                               [ [ 1, $text{'yes'} ], [ 0, $text{'no'} ] ]));
14
15 print &ui_table_row($text{'acl_roles'},
16                     &ui_radio("roles", $_[0]->{'roles'},
17                               [ [ 1, $text{'yes'} ], [ 0, $text{'no'} ] ]));
18
19 local $ra = $_[0]->{'roleassign'} eq "*" ? 0 :
20             $_[0]->{'roleassign'} eq "x" ? 1 : 2;
21 print &ui_table_row($text{'acl_roleassign'},
22                     &ui_radio("roleassign_def", $ra,
23                               [ [ 0, $text{'acl_roleassign0'} ],
24                                 [ 1, $text{'acl_roleassign1'} ],
25                                 [ 2, $text{'acl_roleassign2'} ] ])."\n".
26                     &ui_textbox("roleassign",
27                         $ra == 2 ? join(" ", split(/,/, $_[0]->{'roleassign'})) : "", 40),
28                     3);
29
30 local $ra = $_[0]->{'profassign'} eq "*" ? 0 :
31             $_[0]->{'profassign'} eq "x" ? 1 : 2;
32 print &ui_table_row($text{'acl_profassign'},
33                     &ui_radio("profassign_def", $ra,
34                               [ [ 0, $text{'acl_profassign0'} ],
35                                 [ 1, $text{'acl_profassign1'} ],
36                                 [ 2, $text{'acl_profassign2'} ] ])."<br>\n".
37                     &profiles_input("profassign", $ra == 2 ? $_[0]->{'profassign'} : ""),
38                     3);
39
40 print &ui_table_row($text{'acl_auths'},
41                     &ui_radio("auths", $_[0]->{'auths'},
42                               [ [ 1, $text{'yes'} ], [ 0, $text{'no'} ] ]));
43
44 print &ui_table_row($text{'acl_authassign'},
45                     &ui_radio("authassign", $_[0]->{'authassign'},
46                               [ [ 1, $text{'yes'} ], [ 0, $text{'no'} ] ]));
47
48 print &ui_table_row($text{'acl_profs'},
49                     &ui_radio("profs", $_[0]->{'profs'},
50                               [ [ 1, $text{'yes'} ], [ 2, $text{'acl_ro'} ],
51                                 [ 0, $text{'no'} ] ]));
52
53 print &ui_table_row($text{'acl_execs'},
54                     &ui_radio("execs", $_[0]->{'execs'},
55                               [ [ 1, $text{'yes'} ], [ 0, $text{'no'} ] ]));
56
57 print &ui_table_row($text{'acl_projects'},
58                     &ui_radio("projects", $_[0]->{'projects'},
59                               [ [ 1, $text{'yes'} ], [ 0, $text{'no'} ] ]));
60 }
61
62 # acl_security_save(&options)
63 # Parse the form for security options for the acl module
64 sub acl_security_save
65 {
66 $_[0]->{'roles'} = $in{'roles'};
67 $_[0]->{'users'} = $in{'users'};
68 $_[0]->{'roleassign'} = $in{'roleassign_def'} == 0 ? "*" :
69                         $in{'roleassign_def'} == 1 ? "x" :
70                                 join(",", split(/\s+/, $in{'roleassign'}));
71 $_[0]->{'profassign'} = $in{'profassign_def'} == 0 ? "*" :
72                         $in{'profassign_def'} == 1 ? "x" :
73                                 join(",", split(/\0/, $in{'profassign'}));
74 $_[0]->{'profs'} = $in{'profs'};
75 $_[0]->{'execs'} = $in{'execs'};
76 $_[0]->{'auths'} = $in{'auths'};
77 $_[0]->{'authassign'} = $in{'authassign'};
78 $_[0]->{'projects'} = $in{'projects'};
79 }
80