require 'quota-lib.pl'; # acl_security_form(&options) # Output HTML for editing security options for the quota module sub acl_security_form { local $groups = "as_supported() >= 2; print " $text{'acl_fss'}\n"; print "\n"; printf " %s\n", $_[0]->{'filesys'} eq '*' ? 'checked' : '', $text{'acl_fall'}; printf " %s
\n", $_[0]->{'filesys'} eq '*' ? '' : 'checked', $text{'acl_fsel'}; print " \n"; print " $text{'acl_ro'} \n"; printf " $text{'yes'}\n", $_[0]->{'ro'} ? "checked" : ""; printf " $text{'no'} \n", $_[0]->{'ro'} ? "" : "checked"; print "
\n"; print " $text{'acl_quotaon'} \n"; printf " $text{'yes'}\n", $_[0]->{'enable'} ? "checked" : ""; printf " $text{'no'}\n", $_[0]->{'enable'} ? "" : "checked"; print "$text{'acl_quotanew'} \n"; printf " $text{'yes'}\n", $_[0]->{'default'} ? "checked" : ""; printf " $text{'no'} \n", $_[0]->{'default'} ? "" : "checked"; print " $text{'acl_ugrace'} \n"; printf " $text{'yes'}\n", $_[0]->{'ugrace'} ? "checked" : ""; printf " $text{'no'}\n", $_[0]->{'ugrace'} ? "" : "checked"; print "$text{'acl_vtotal'} \n"; printf " $text{'yes'}\n", $_[0]->{'diskspace'} ? "checked" : ""; printf " $text{'no'} \n", $_[0]->{'diskspace'} ? "" : "checked"; print " $text{'acl_maxblocks'} \n"; printf " %s\n", $_[0]->{'maxblocks'} ? '' : 'checked', $text{'acl_unlimited'}; printf "\n", $_[0]->{'maxblocks'} ? 'checked' : ''; print "\n"; print "$text{'acl_maxfiles'} \n"; printf " %s\n", $_[0]->{'maxfiles'} ? '' : 'checked', $text{'acl_unlimited'}; printf "\n", $_[0]->{'maxfiles'} ? 'checked' : ''; print " \n"; print " $text{'acl_email'} \n"; printf " $text{'yes'}\n", $_[0]->{'email'} ? "checked" : ""; printf " $text{'no'}\n", $_[0]->{'email'} ? "" : "checked"; if ($groups) { print "$text{'acl_ggrace'} \n"; printf " $text{'yes'}\n", $_[0]->{'ggrace'} ? "checked" : ""; printf " $text{'no'}\n", $_[0]->{'ggrace'} ? "" : "checked"; } print "\n"; print "
\n"; print " $text{'acl_uquota'}", " \n"; printf " $text{'acl_uall'}
\n", $_[0]->{'umode'} == 0 ? "checked" : ""; printf " $text{'acl_uonly'}\n", $_[0]->{'umode'} == 1 ? "checked" : ""; printf " %s
\n", $_[0]->{'umode'} == 1 ? $_[0]->{'users'} : "", &user_chooser_button("ucan", 1); printf " $text{'acl_uexcept'}\n", $_[0]->{'umode'} == 2 ? "checked" : ""; printf " %s
\n", $_[0]->{'umode'} == 2 ? $_[0]->{'users'} : "", &user_chooser_button("ucannot", 1); printf " $text{'acl_ugroup'}\n", $_[0]->{'umode'} == 3 ? "checked" : ""; printf " %s
\n", $_[0]->{'umode'} == 3 ? scalar(getgrgid($_[0]->{'users'})) : "", &group_chooser_button("upri", 0); printf " $text{'acl_uuid'}\n", $_[0]->{'umode'} == 4 ? "checked" : ""; printf " -\n", $_[0]->{'umode'} == 4 ? $_[0]->{'umin'} : ""; printf " \n", $_[0]->{'umode'} == 4 ? $_[0]->{'umax'} : ""; if ($groups) { print "
\n"; print " $text{'acl_gquota'}", " \n"; printf "$text{'acl_gall'}
\n", $_[0]->{'gmode'} == 0 ? "checked" : ""; printf "$text{'acl_gnone'}
\n", $_[0]->{'gmode'} == 3 ? "checked" : ""; printf "$text{'acl_gonly'}\n", $_[0]->{'gmode'} == 1 ? "checked" : ""; printf " %s
\n", $_[0]->{'gmode'} == 1 ? $_[0]->{'groups'} : "", &group_chooser_button("gcan", 1); printf "$text{'acl_gexcept'}\n", $_[0]->{'gmode'} == 2 ? "checked" : ""; printf " %s \n", $_[0]->{'gmode'} == 2 ? $_[0]->{'groups'} : "", &group_chooser_button("gcannot", 1); } } # acl_security_save(&options) # Parse the form for security options for the quota module sub acl_security_save { if ($in{'filesys_def'}) { $_[0]->{'filesys'} = "*"; } else { $_[0]->{'filesys'} = join(" ", split(/\0/, $in{'filesys'})); } $_[0]->{'ro'} = $in{'ro'}; $_[0]->{'umode'} = $in{'umode'}; $_[0]->{'users'} = $in{'umode'} == 0 ? "" : $in{'umode'} == 1 ? $in{'ucan'} : $in{'umode'} == 2 ? $in{'ucannot'} : $in{'umode'} == 3 ? scalar(getgrnam($in{'upri'})) : ""; $_[0]->{'umin'} = $in{'umin'}; $_[0]->{'umax'} = $in{'umax'}; $_[0]->{'gmode'} = $in{'gmode'}; $_[0]->{'groups'} = $in{'gmode'} == 0 ? "" : $in{'gmode'} == 1 ? $in{'gcan'} : $in{'gcannot'}; $_[0]->{'enable'} = $in{'enable'}; $_[0]->{'default'} = $in{'default'}; $_[0]->{'email'} = $in{'email'}; $_[0]->{'ugrace'} = $in{'ugrace'}; $_[0]->{'ggrace'} = $in{'ggrace'}; $_[0]->{'diskspace'} = $in{'diskspace'}; $_[0]->{'maxblocks'} = $in{'maxblocks_def'} ? undef : $in{'maxblocks'}; $_[0]->{'maxfiles'} = $in{'maxfiles'}; }