2 require 'quota-lib.pl';
4 # acl_security_form(&options)
5 # Output HTML for editing security options for the quota module
8 local $groups = "as_supported() >= 2;
11 print &ui_table_row($text{'acl_fss'},
12 &ui_radio("filesys_def", $_[0]->{'filesys'} eq '*' ? 1 : 0,
13 [ [ 1, $text{'acl_fall'} ], [ 0, $text{'acl_fsel'} ] ]).
16 $_[0]->{'filesys'} eq '*' ? [ ] :
17 [ split(/\s+/, $_[0]->{'filesys'}) ],
18 [ map { $_->[0] } grep { $_->[4] } &list_filesystems() ],
22 print &ui_table_row($text{'acl_ro'},
23 &ui_yesno_radio("ro", $_[0]->{'ro'}), 3);
28 print &ui_table_row($text{'acl_quotaon'},
29 &ui_yesno_radio("enable", $_[0]->{'enable'}));
31 # Can edit defaults for new users?
32 print &ui_table_row($text{'acl_quotanew'},
33 &ui_yesno_radio("default", $_[0]->{'default'}));
35 # Can edit user grace times
36 print &ui_table_row($text{'acl_ugrace'},
37 &ui_yesno_radio("ugrace", $_[0]->{'ugrace'}));
39 # Can edit group grace times
41 print &ui_table_row($text{'acl_ggrace'},
42 &ui_yesno_radio("ggrace", $_[0]->{'ggrace'}));
45 # Can see total disk space
46 print &ui_table_row($text{'acl_vtotal'},
47 &ui_yesno_radio("diskspace", $_[0]->{'diskspace'}));
50 print &ui_table_row($text{'acl_maxblocks'},
51 &ui_opt_textbox("maxblocks", $_[0]->{'maxblocks'}, 8,
52 $text{'acl_unlimited'}));
55 print &ui_table_row($text{'acl_maxfiles'},
56 &ui_opt_textbox("maxfiles", $_[0]->{'maxfiles'}, 8,
57 $text{'acl_unlimited'}));
59 # Can edit email notifications?
60 print &ui_table_row($text{'acl_email'},
61 &ui_yesno_radio("email", $_[0]->{'email'}));
66 print &ui_table_row($text{'acl_uquota'},
67 &ui_radio_table("umode", int($_[0]->{'umode'}),
68 [ [ 0, $text{'acl_uall'} ],
69 [ 1, $text{'acl_uonly'},
71 $_[0]->{'umode'} == 1 ? $_[0]->{'users'} : "",
72 40)." ".&user_chooser_button("ucan", 1) ],
73 [ 2, $text{'acl_uexcept'},
74 &ui_textbox("ucannot",
75 $_[0]->{'umode'} == 2 ? $_[0]->{'users'} : "",
76 40)." ".&user_chooser_button("ucannot", 1) ],
77 [ 3, $text{'acl_ugroup'},
78 &ui_group_textbox("upri", $_[0]->{'umode'} == 3 ?
79 scalar(getgrgid($_[0]->{'users'})) : "") ],
80 [ 4, $text{'acl_uuid'},
82 $_[0]->{'umode'} == 4 ? $_[0]->{'umin'} : "", 6)." - ".
84 $_[0]->{'umode'} == 4 ? $_[0]->{'umax'} : "", 6) ]
91 print &ui_table_row($text{'acl_gquota'},
92 &ui_radio_table("gmode", int($_[0]->{'gmode'}),
93 [ [ 0, $text{'acl_gall'} ],
94 [ 3, $text{'acl_gnone'} ],
95 [ 1, $text{'acl_gonly'},
97 $_[0]->{'gmode'} == 1 ? $_[0]->{'groups'} : "", 40)." ".
98 &group_chooser_button("gcan", 1) ],
99 [ 2, $text{'acl_gexcept'},
100 &ui_textbox("gcannot",
101 $_[0]->{'gmode'} == 2 ? $_[0]->{'groups'} : "", 40)." ".
102 &group_chooser_button("gcannot", 1) ],
103 [ 4, $text{'acl_ggid'},
105 $_[0]->{'gmode'} == 4 ? $_[0]->{'gmin'} : "", 6)." - ".
107 $_[0]->{'gmode'} == 4 ? $_[0]->{'gmax'} : "", 6) ]
112 # acl_security_save(&options)
113 # Parse the form for security options for the quota module
114 sub acl_security_save
116 if ($in{'filesys_def'}) {
117 $_[0]->{'filesys'} = "*";
120 $_[0]->{'filesys'} = join(" ", split(/\0/, $in{'filesys'}));
122 $_[0]->{'ro'} = $in{'ro'};
123 $_[0]->{'umode'} = $in{'umode'};
124 $_[0]->{'users'} = $in{'umode'} == 0 ? "" :
125 $in{'umode'} == 1 ? $in{'ucan'} :
126 $in{'umode'} == 2 ? $in{'ucannot'} :
127 $in{'umode'} == 3 ? scalar(getgrnam($in{'upri'})) : "";
128 $_[0]->{'umin'} = $in{'umin'};
129 $_[0]->{'umax'} = $in{'umax'};
130 $_[0]->{'gmode'} = $in{'gmode'};
131 $_[0]->{'groups'} = $in{'gmode'} == 0 ? "" :
132 $in{'gmode'} == 1 ? $in{'gcan'} :
133 $in{'gmode'} == 2 ? $in{'gcannot'} : "";
134 $_[0]->{'gmin'} = $in{'gmin'};
135 $_[0]->{'gmax'} = $in{'gmax'};
136 $_[0]->{'enable'} = $in{'enable'};
137 $_[0]->{'default'} = $in{'default'};
138 $_[0]->{'email'} = $in{'email'};
139 $_[0]->{'ugrace'} = $in{'ugrace'};
140 $_[0]->{'ggrace'} = $in{'ggrace'};
141 $_[0]->{'diskspace'} = $in{'diskspace'};
142 $_[0]->{'maxblocks'} = $in{'maxblocks_def'} ? undef : $in{'maxblocks'};
143 $_[0]->{'maxfiles'} = $in{'maxfiles'};