require 'user-lib.pl'; # acl_security_form(&options) # Output HTML for editing security options for the useradmin module sub acl_security_form { local $o = $_[0]; print " $text{'acl_uedit'} \n"; printf " $text{'acl_uedit_all'}  \n", $o->{'uedit_mode'} == 0 ? "checked" : ""; printf " $text{'acl_uedit_none'} \n", $o->{'uedit_mode'} == 1 ? "checked" : ""; printf " $text{'acl_uedit_this'}
\n", $o->{'uedit_mode'} == 6 ? "checked" : ""; printf " $text{'acl_uedit_only'}\n", $o->{'uedit_mode'} == 2 ? "checked" : ""; printf " %s
\n", $o->{'uedit_mode'} == 2 ? $o->{'uedit'} : "", &user_chooser_button("uedit_can", 1); printf " $text{'acl_uedit_except'}\n", $o->{'uedit_mode'} == 3 ? "checked" : ""; printf " %s
\n", $o->{'uedit_mode'} == 3 ? $o->{'uedit'} : "", &user_chooser_button("uedit_cannot", 1); printf " $text{'acl_uedit_uid'}\n", $o->{'uedit_mode'} == 4 ? "checked" : ""; printf " - \n", $o->{'uedit_mode'} == 4 ? $o->{'uedit'} : ""; printf "
\n", $o->{'uedit_mode'} == 4 ? $o->{'uedit2'} : ""; printf " $text{'acl_uedit_group'}\n", $o->{'uedit_mode'} == 5 ? "checked" : ""; printf " %s
\n", $o->{'uedit_mode'} == 5 ? join(" ", map { "".&my_getgrgid($_) } split(/\s+/, $o->{'uedit'})) :"", &group_chooser_button("uedit_group", 1); printf "%s %s
\n", " " x 5, $o->{'uedit_sec'} ? 'checked' : '',$text{'acl_uedit_sec'}; printf " $text{'acl_uedit_re'}\n", $o->{'uedit_mode'} == 7 ? "checked" : ""; printf " %s
\n", $o->{'uedit_mode'} == 7 ? $o->{'uedit_re'} : ""; print " \n"; print " $text{'acl_ucreate'} \n"; printf " $text{'yes'}\n", $o->{'ucreate'} ? "checked" : ""; printf " $text{'no'} \n", $o->{'ucreate'} ? "" : "checked"; print " $text{'acl_batch'} \n"; printf " $text{'yes'}\n", $o->{'batch'} ? "checked" : ""; printf " $text{'no'} \n", $o->{'batch'} ? "" : "checked"; print " $text{'acl_export'} \n"; printf " $text{'yes'}\n", $o->{'export'} == 2 ? "checked" : ""; printf " $text{'acl_export1'}\n", $o->{'export'} == 1 ? "checked" : ""; printf " $text{'no'} \n", $o->{'export'} == 0 ? "checked" : ""; print " $text{'acl_uid'}\n"; print " -\n"; print "
\n"; printf " %s
\n", $o->{'autouid'} ? "checked" : "", $text{'acl_autouid'}; printf " %s
\n", $o->{'calcuid'} ? "checked" : "", $text{'acl_calcuid'}; printf " %s
\n", $o->{'useruid'} ? "checked" : "", $text{'acl_useruid'}; printf " %s
\n", $o->{'umultiple'} ? "checked" : "", $text{'acl_umultiple'}; printf " %s \n", $o->{'uuid'} ? "checked" : "", $text{'acl_uuid'}; local $uedit_gmode = defined($o->{'uedit_gmode'}) ? $o->{'uedit_gmode'} : $o->{'ugroups'} eq '*' ? 0 : 2; print " $text{'acl_ugroups'} \n"; printf " $text{'acl_gedit_all'}
\n", $uedit_gmode == 0 ? "checked" : ""; printf " $text{'acl_gedit_only'}\n", $uedit_gmode == 2 ? "checked" : ""; printf " %s
\n", $uedit_gmode == 2 ? $o->{'ugroups'} : "", &group_chooser_button("uedit_gcan", 1); printf " $text{'acl_gedit_except'}\n", $uedit_gmode == 3 ? "checked" : ""; printf " %s
\n", $uedit_gmode == 3 ? $o->{'ugroups'} : "", &group_chooser_button("uedit_gcannot", 1); printf " $text{'acl_gedit_gid'}\n", $uedit_gmode == 4 ? "checked" : ""; printf " -\n", $uedit_gmode == 4 ? $o->{'ugroups'} : ""; printf " \n", $uedit_gmode == 4 ? $o->{'ugroups2'} : ""; print " $text{'acl_shells'} \n"; printf " $text{'acl_any'}\n", $o->{'shells'} eq "*" ? "checked" : ""; printf " $text{'acl_listed'}
\n", $o->{'shells'} eq "*" ? "" : "checked"; print " \n"; print " $text{'acl_epeopt'} \n"; printf " $text{'yes'}\n", $o->{'peopt'} ? "checked" : ""; printf " $text{'no'} \n", $o->{'peopt'} ? "" : "checked"; print " $text{'acl_home'}\n"; printf " %s
\n", $o->{'home'}, &file_chooser_button("home", 1); printf " %s \n", $o->{'autohome'} ? "checked" : "", $text{'acl_autohome'}; print " $text{'acl_udelete'} \n"; printf " $text{'yes'}\n", $o->{'udelete'} ? "checked" : ""; printf " $text{'no'} \n", $o->{'udelete'} ? "" : "checked"; print " $text{'acl_urename'} \n"; printf " $text{'yes'}\n", $o->{'urename'} ? "checked" : ""; printf " $text{'no'} \n", $o->{'urename'} ? "" : "checked"; print " $text{'acl_delhome'}\n"; print "",&ui_radio("delhome", $o->{'delhome'}, [ [ 2, $text{'acl_option'} ], [ 1, $text{'acl_always'} ], [ 0, $text{'acl_never'} ] ])," \n"; # 0 = always on, 1 = can edit, 2 = always off print " $text{'acl_saveopts'} ", "\n"; foreach $opt ('chuid', 'chgid', 'movehome', 'mothers', 'makehome', 'copy', 'cothers', 'dothers') { print "\n"; printf "\n", $o->{$opt} == 2 ? "checked" : "", $text{'acl_off'}; } print "
",$text{"uedit_$opt"}," %s\n", $o->{$opt} == 1 ? "checked" : "", $text{'acl_canedit'}; printf " %s\n", $o->{$opt} == 0 ? "checked" : "", $text{'acl_on'}; printf " %s
\n"; print "
\n"; print " $text{'acl_gedit'} \n"; printf " $text{'acl_gedit_all'}  \n", $o->{'gedit_mode'} == 0 ? "checked" : ""; printf " $text{'acl_gedit_none'}
\n", $o->{'gedit_mode'} == 1 ? "checked" : ""; printf " $text{'acl_gedit_only'}\n", $o->{'gedit_mode'} == 2 ? "checked" : ""; printf " %s
\n", $o->{'gedit_mode'} == 2 ? $o->{'gedit'} : "", &group_chooser_button("gedit_can", 1); printf " $text{'acl_gedit_except'}\n", $o->{'gedit_mode'} == 3 ? "checked" : ""; printf " %s
\n", $o->{'gedit_mode'} == 3 ? $o->{'gedit'} : "", &group_chooser_button("gedit_cannot", 1); printf " $text{'acl_gedit_gid'}\n", $o->{'gedit_mode'} == 4 ? "checked" : ""; printf " -\n", $o->{'gedit_mode'} == 4 ? $o->{'gedit'} : ""; printf " \n", $o->{'gedit_mode'} == 4 ? $o->{'gedit2'} : ""; print " $text{'acl_gcreate'} \n"; printf " $text{'yes'}\n", $o->{'gcreate'}==1 ? "checked" : ""; printf " $text{'acl_gnew'}\n", $o->{'gcreate'}==2 ? "checked" : ""; printf " $text{'no'} \n", $o->{'gcreate'}==0 ? "checked" : ""; print " $text{'acl_gid'}\n"; print " -\n"; print "
\n"; printf " %s
\n", $o->{'autogid'} ? "checked" : "", $text{'acl_autogid'}; printf " %s
\n", $o->{'calcgid'} ? "checked" : "", $text{'acl_calcgid'}; printf " %s
\n", $o->{'usergid'} ? "checked" : "", $text{'acl_usergid'}; printf " %s
\n", $o->{'gmultiple'} ? "checked" : "", $text{'acl_gmultiple'}; printf " %s \n", $o->{'ggid'} ? "checked" : "", $text{'acl_ggid'}; print " $text{'acl_gdelete'} \n"; printf " $text{'yes'}\n", $o->{'gdelete'} ? "checked" : ""; printf " $text{'no'} \n", $o->{'gdelete'} ? "" : "checked"; print "
\n"; print "$text{'acl_logins'} \n"; printf " $text{'acl_lnone'}
\n", $o->{'logins'} ? "" : "checked"; printf " $text{'acl_lall'}
\n", $o->{'logins'} eq "*" ? "checked" : ""; printf "\n", $o->{'logins'} =~ /[^\*]/ ? "checked" : ""; printf " %s \n", $o->{'logins'} =~ /[^\*]/ ? $o->{'logins'} : "", &user_chooser_button("logins", 1); } # acl_security_save(&options) # Parse the form for security options for the useradmin module sub acl_security_save { $_[0]->{'lowuid'} = $in{'lowuid'}; $_[0]->{'hiuid'} = $in{'hiuid'}; $_[0]->{'autouid'} = $in{'autouid'}; $_[0]->{'autogid'} = $in{'autogid'}; $_[0]->{'calcuid'} = $in{'calcuid'}; $_[0]->{'calcgid'} = $in{'calcgid'}; $_[0]->{'useruid'} = $in{'useruid'}; $_[0]->{'usergid'} = $in{'usergid'}; $_[0]->{'lowgid'} = $in{'lowgid'}; $_[0]->{'higid'} = $in{'higid'}; $_[0]->{'uedit_mode'} = $in{'uedit_mode'}; $_[0]->{'uedit'} = $in{'uedit_mode'} == 2 ? $in{'uedit_can'} : $in{'uedit_mode'} == 3 ? $in{'uedit_cannot'} : $in{'uedit_mode'} == 4 ? $in{'uedit_uid'} : $in{'uedit_mode'} == 5 ? join(" ", map { "".&my_getgrnam($_) } split(/\s+/, $in{'uedit_group'})) : ""; $_[0]->{'uedit2'} = $in{'uedit_mode'} == 4 ? $in{'uedit_uid2'} : undef; $_[0]->{'uedit_sec'} = $in{'uedit_mode'} == 5 ? $in{'uedit_sec'} : undef; $_[0]->{'uedit_re'} = $in{'uedit_mode'} == 7 ? $in{'uedit_re'} : undef; $_[0]->{'gedit_mode'} = $in{'gedit_mode'}; $_[0]->{'gedit'} = $in{'gedit_mode'} == 2 ? $in{'gedit_can'} : $in{'gedit_mode'} == 3 ? $in{'gedit_cannot'} : $in{'gedit_mode'} == 4 ? $in{'gedit_gid'} : ""; $_[0]->{'gedit2'} = $in{'gedit_mode'} == 4 ? $in{'gedit_gid2'} : undef; $_[0]->{'ucreate'} = $in{'ucreate'}; $_[0]->{'gcreate'} = $in{'gcreate'}; if ($in{'uedit_gmode'} == 0) { delete($_[0]->{'uedit_gmode'}); $_[0]->{'ugroups'} = "*"; } elsif ($in{'uedit_gmode'} == 2) { delete($_[0]->{'uedit_gmode'}); $_[0]->{'ugroups'} = $in{'uedit_gcan'}; } else { $_[0]->{'uedit_gmode'} = $in{'uedit_gmode'}; $_[0]->{'ugroups'} = $in{'uedit_gmode'} == 3 ? $in{'uedit_gcannot'} : $in{'uedit_gmode'} == 4 ? $in{'uedit_gid'} : ""; } $_[0]->{'ugroups2'} = $in{'uedit_gmode'} == 4 ? $in{'uedit_gid2'} : undef; $_[0]->{'logins'} = $in{'logins_mode'} == 0 ? "" : $in{'logins_mode'} == 1 ? "*" : $in{'logins'}; $_[0]->{'shells'} = $in{'shells_def'} ? "*" : join(" ", split(/\s+/, $in{'shells'})); $_[0]->{'peopt'} = $in{'peopt'}; $_[0]->{'batch'} = $in{'batch'}; $_[0]->{'export'} = $in{'export'}; $_[0]->{'home'} = $in{'home'}; $_[0]->{'delhome'} = $in{'delhome'}; $_[0]->{'autohome'} = $in{'autohome'}; $_[0]->{'umultiple'} = $in{'umultiple'}; $_[0]->{'uuid'} = $in{'uuid'}; $_[0]->{'gmultiple'} = $in{'gmultiple'}; $_[0]->{'ggid'} = $in{'ggid'}; foreach $o ('chuid', 'chgid', 'movehome', 'mothers', 'makehome', 'copy', 'cothers', 'dothers') { $_[0]->{$o} = $in{$o}; } $_[0]->{'udelete'} = $in{'udelete'}; $_[0]->{'urename'} = $in{'urename'}; $_[0]->{'gdelete'} = $in{'gdelete'}; }