#!/usr/bin/perl
# delobj.cgi
# ...  Services with Tarantella.:
# STTA Rev. 1.3 Copyright (c) 2001-2004 Jesús Pérez Lorenzo  --- license GNU GPL 
# stta: (@#) 1.31051043346- [2004_01_29_102036]

require './stta-lib.pl';
do "ldap-lib.pl";

&ReadParse();
&headerstta($text{'index_delldapcache'}, "", "delldapcache",undef,1,0,"$text{'headpage_right'}"."$text{'head_logout'}",undef,undef,"$text{head_below}" ); 
print "<hr><p>\n";
if ( $config{'is_ldapcache'} ne "true" ) { &footCacheHere; exit }
if (!$in{dn}) { &footHere; exit }

&foreign_require("proc", "proc-lib.pl");
 $dn=$in{dn};
 $grpdn=$in{grpdn};
 $lin_user=$in{lin_user};
 $lin_name=$in{lin_name};
 $NameUser=$in{NameUser};
 $objType=$in{objType};

 print "<table width=100% border>\n";
 print "<tr $tb> <td><font color='$revtext'><b>$text{'titidx_delldapcache'}</b>: $in{desc}</td> </tr>\n";  
 print "<tr $cb> <td><table width=100%>\n";

 $ldapcache_server=1;
 &connect_cache ();
 if ( $lnro >  -1 && $dn !=~ /cn=/ ) {   # cleaning entries 
    if ( &del_ldap_obj($dn) eq 0 ) {
          print "<tr><b>".$text{'user_delete'}."... LDAP CACHE ... </b></tr>\n";
    } else { &html_errshow("ldap")};
    &footHere;
    exit;
 }

 print "<p><tr><td valign=top><b>$text{'obj_origin'}</b>&nbsp;</td></tr>\n";

 print "   <tr><td valign=top>",&hlink("<b>$text{'f_obj'}</b>","fobj"),"&nbsp;</td>\n";
 print "<td valign=top><b>$NameUser  ---  $lin_user </b>&nbsp;</td></tr>\n";
 print "<p><tr><td valign=top><b>$text{'obj_target'}</b>&nbsp;</td></tr>\n"; 
 
 if ( "$objType" eq  "app" ) {
       print "   <tr><td valign=top>",&hlink("<b>$text{'f_appobjname'}</b>","fappobjname"),"&nbsp;</td>\n";
  } elsif ( "$objType" eq  "grpapps" ) {
       print "   <tr><td valign=top>",&hlink("<b>$text{'f_aliasgrpapps'}</b>","faliasgrpapps"),"&nbsp;</td>\n"
  } elsif ( "$objType" eq  "host" ) {
       print "   <tr><td valign=top>",&hlink("<b>$text{'f_hostname'}</b>","fhostname"),"&nbsp;</td>\n";
  } elsif ( "$objType" eq  "grphosts" ) {
       print "   <tr><td valign=top>",&hlink("<b>$text{'f_usergrphosts'}</b>","fusergrphosts"),"&nbsp;</td>\n"
  }
 print "<td valign=top><b>$lin_name </b>&nbsp;</td></tr>\n";   

 if ( &del_obj($dn) ne 0 ) { &footHere; exit };
 if ( $config{ldapcache2_server}.length gt 0 ) {
                $ldapcache_server=2;
                &connect_cache ();
                if ( &del_obj($dn) ne 0 ) { &err_replication() }
 }
 print "<tr><center><p><b>".$text{'user_delete'}."</b></tr>\n";
 print "<tr></tr>\n";
 &footHere;
 exit;

