require 'virtual-server-lib.pl'; # acl_security_form(&options) # Output HTML for editing security options for the virtual server module sub acl_security_form { print " $text{'acl_warn'} \n"; print " $text{'acl_domains'}\n"; printf " %s\n", $_[0]->{'domains'} eq '*' ? "checked" : "", $text{'acl_all'}; printf " %s
\n", $_[0]->{'domains'} eq '*' ? "" : "checked", $text{'acl_sel'}; local %doms = map { $_, 1 } split(/\s+/, $_[0]->{'domains'}); print " \n"; foreach $q ('create', 'import', 'edit', 'local', 'stop') { print " ",$text{'acl_'.$q}," \n"; printf " %s\n", $q, $_[0]->{$q} == 1 ? "checked" : "", $text{'yes'}; if ($q eq "create") { printf " %s\n", $q, $_[0]->{$q} == 2 ? "checked" : "", $text{'acl_only'}; } elsif ($q eq "edit") { printf " %s\n", $q, $_[0]->{$q} == 2 ? "checked" : "", $text{'acl_lim'}; } printf " %s\n", $q, $_[0]->{$q} == 0 ? "checked" : "", $text{'no'}; print " \n"; } print " $text{'limits_features'}\n"; print "\n"; foreach $f (@opt_features) { print "\n" if ($i%2 == 0); printf "\n", $f, $_[0]->{"feature_$f"} ? "checked" : "", $text{'feature_'.$f}; print "\n" if ($i++%2 == 1); } print "
%s
\n"; } # acl_security_save(&options) # Parse the form for security options for the useradmin module sub acl_security_save { $_[0]->{'domains'} = $in{'domains_def'} ? "*" : join(" ", split(/\0/, $in{'domains'})); $_[0]->{'create'} = $in{'create'}; $_[0]->{'import'} = $in{'import'}; $_[0]->{'edit'} = $in{'edit'}; $_[0]->{'local'} = $in{'local'}; $_[0]->{'stop'} = $in{'stop'}; %sel_features = map { $_, 1 } split(/\0/, $in{'features'}); foreach $f (@opt_features) { $_[0]->{"feature_".$f} = $sel_features{$f}; } }