#!/usr/local/bin/perl # edit_group.cgi # Display a form for editing or creating a group require './ldap-useradmin-lib.pl'; &ReadParse(); $ldap = &ldap_connect(); if ($in{'new'}) { $access{'gcreate'} || &error($text{'gedit_ecreate'}); &ui_print_header(undef, $text{'gedit_title2'}, ""); } else { $rv = $ldap->search(base => $in{'dn'}, scope => 'base', filter => '(objectClass=posixGroup)'); ($ginfo) = $rv->all_entries; $group = $ginfo->get_value('cn'); $gid = $ginfo->get_value('gidNumber'); $pass = $ginfo->get_value('userPassword'); @members = $ginfo->get_value('memberUid'); foreach $oc ($ginfo->get_value('objectClass')) { $oclass{$oc} = 1; } %ginfo = &dn_to_hash($ginfo); &can_edit_group(\%ginfo) || &error($text{'gedit_eedit'}); &ui_print_header(undef, $text{'gedit_title'}, ""); } print "
\n"; print "\n"; print "\n"; # Show group details print "\n"; print "\n"; print "
$text{'gedit_details'}
\n"; if (!$in{'new'}) { print "\n"; print "\n"; print "\n"; print "\n"; } print "\n"; print "\n"; print "\n"; if ($in{'new'}) { # Next GID comes from LDAP only $newgid = $mconfig{'base_gid'}; while(&check_gid_used($ldap, $newgid)) { $newgid++; } print "\n"; } else { print "\n"; } print "\n"; print "\n"; printf "\n"; print "\n"; print "\n"; print "
$text{'gedit_dn'}$in{'dn'}
$text{'uedit_classes'}",join(" , ", map { "$_" } $ginfo->get_value('objectClass')),"
$text{'gedit_group'}$text{'gedit_gid'}
$text{'pass'} $text{'none2'}
\n", $pass eq "" ? "checked" : ""; printf " $text{'encrypted'}\n", $pass eq "" ? "" : "checked"; print "
\n"; print " $text{'clear'}\n"; print "
$text{'gedit_members'}\n"; print "
",&user_chooser_button("members", 1), "

\n"; # Show extra fields (if any) &extra_fields_input($config{'group_fields'}, $ginfo); # Show capabilties section print "\n"; print "\n"; print "
$text{'gedit_cap'}
\n"; print "\n"; printf "\n", $oclass{$samba_group_class} ? "" : "checked", $text{'no'}; print "\n"; print "
$text{'gedit_samba'} %s\n", $oclass{$samba_group_class} ? "checked" : "", $text{'yes'}; printf " %s

\n"; # Show section for on-save or on-creation options if (!$in{'new'}) { print "\n"; print "\n"; print "
$text{'onsave'}
\n"; print "\n"; print "\n"; print "\n"; printf "\n", $mconfig{'default_other'} ? "" : "checked"; print "
$text{'chgid'} $text{'no'}\n"; print " $text{'gedit_homedirs'}\n"; print " $text{'gedit_allfiles'}
$text{'gedit_mothers'} $text{'yes'}\n", $mconfig{'default_other'} ? "checked" : ""; printf " $text{'no'}
\n"; } else { print "\n"; print "\n"; print "
$text{'uedit_oncreate'}
\n"; print "\n"; printf "\n", $mconfig{'default_other'} ? "" : "checked"; print "
$text{'gedit_cothers'} $text{'yes'}\n", $mconfig{'default_other'} ? "checked" : ""; printf " $text{'no'}
\n"; } print "\n"; if ($in{'new'}) { print "\n"; } else { print "\n"; print "\n"; print "\n"; } print "
\n"; &ui_print_footer("", $text{'index_return'});