73 lines
2.2 KiB
Perl
Executable File
73 lines
2.2 KiB
Perl
Executable File
#!/usr/bin/perl
|
|
# tta_delusr.cgi
|
|
# Delete Users to Tarantella Services
|
|
|
|
require './tarantella-lib.pl';
|
|
&foreign_require("proc", "proc-lib.pl");
|
|
do "ldap-lib.pl";
|
|
&ReadParse();
|
|
|
|
$dn = $in{dn};
|
|
if (!$dn) { &redirect("tta_selusr.cgi?form=delusr"); }
|
|
$username=$in{username};
|
|
$userou=$in{userou};
|
|
if ( $dn eq "-" ) {
|
|
$dn_ou="";
|
|
foreach $ou (&list_ous()) {
|
|
if ( $ou->{'alias'} eq $userou ) {
|
|
$dn_ou=$ou->{obj};
|
|
last;
|
|
}
|
|
}
|
|
$filter = "$username";
|
|
&redirect("tta_selusr.cgi?form=delusr&filter=$filter&base=$dn_ou");
|
|
}
|
|
&header($text{'index_delusr'}, "", "");
|
|
print "<hr><p>\n";
|
|
print "<table width=100% border>\n";
|
|
print "<tr $tb> <td><b>$text{'titidx_delusr'} $username ($dn_ouname) </b></td> </tr>\n";
|
|
print "<tr $cb> <td><table width=100%>\n";
|
|
print "<center>\n";
|
|
|
|
if ($dn) {
|
|
$ldap_server=1;
|
|
&connect ();
|
|
if ( &del_usr() eq 0 ) {
|
|
|
|
if ( $config{ldap2_server}.length gt 0 ) {
|
|
$ldap_server=2;
|
|
&connect ();
|
|
if ( &del_usr() ne 0 ) { &err_replication() }
|
|
}
|
|
$lin_user="del::".$username."::::".$dn;
|
|
&lock_file($config{'ldap_log'});
|
|
open(FILELDAPLOG, ">>$config{'ldap_log'}");
|
|
print FILELDAPLOG "$lin_user\n";
|
|
close (FILELDAPLOG);
|
|
$str=$text{'user_delete'}.$username." -> ".$dn;
|
|
&additional_log('delusr.cgi', undef, $str);
|
|
&webmin_log($config{'ldap_log'}, undef, "delete");
|
|
&unlock_file($config{'ldap_log'});
|
|
print "<tr></tr><tr></tr>\n";
|
|
print "<tr><b>".$text{'user_delete'}."... LDAP ... </b></tr>\n";
|
|
print "<tr><td><pre>\n";
|
|
foreach $ou (&list_ous()) {
|
|
if ( $ou->{'alias'} eq $in{userou}) {
|
|
$ens_ou=$ou->{ens};
|
|
last;
|
|
}
|
|
}
|
|
$ens_obj = "--name \"".$config{tta_base}."/$ens_ou/cn=$username\"";
|
|
$type_cmd="delete";
|
|
if (&run_tta_cmd("delete",$ens_obj)) {
|
|
print "</pre><tr><p><b>$text{'user_delete'}... Tarantella </b></tr>\n";
|
|
}
|
|
print "</tr></td></pre>\n";
|
|
}
|
|
}
|
|
print "<tr><tr></table></table><hr><p>\n";
|
|
&footer($config{'back_return'},$text{'index'});
|
|
print "<p><p><p>\n";
|
|
do "footer.pl";
|
|
exit;
|