stta/stta/tmp/t/tarantella/delapps.cgi
2021-10-01 20:35:43 +01:00

75 lines
2.6 KiB
Perl
Executable File

#!/usr/bin/perl
# tta_delapp.cgi
# Delete OrgUnits from Tarantella Services
require './tarantella-lib.pl';
do "ldap-lib.pl";
&header($text{'index_delapp'}, "", "");
print "<hr><p>\n";
if ( $config{'is_ldapcache'} ne "true" ) { &footCacheHere; exit }
&foreign_require("proc", "proc-lib.pl");
$ldapcache_server=1;
&connect_cache();
&ReadParse();
$appname=$in{appname};
print "<table width=100% border>\n";
print "<tr $tb> <td><b>$text{'titidx_delapp'} $appname </b></td> </tr>\n";
print "<tr $cb> <td><table width=100%>\n";
print "<center>\n";
if ($appname ) {
$descrip="";
$ensapp="";
$dnsapp="";
foreach $app (&list_apps()) {
if ( $app->{'alias'} eq $appname) {
$ensapp=$app->{ens};
$dnapp=$app->{obj};
$grpalias=$app->{grpalias};
$descrip=$app->{descrip};
last;
}
}
}
if (!$dnapp ) { &footHere; exit } ;
$dn = "$dnapp,".$config{ldapcache_base};
$ldapcache_server=1;
&connect_cache ();
if ( &del_cache_obj($dn) ne 0 ) { &footHere; exit } ;
if ( $config{ldapcache2_server}.length gt 0 ) {
$ldapcache_server=2;
&connect_cache ();
if ( &del_cache_obj($dn) ne 0 ) { &err_replication() }
}
print "<tr></tr><tr></tr>\n";
print "<tr><b>".$text{'user_delete'}."... LDAP CACHE ... </b></tr>\n";
print "<tr><td><pre>\n";
if ( $ensapp ne "" ) {
$ens_obj = "--name \"".$config{tta_ldapcacheApps}."/$ensapp\" --children";
$type_cmd="delete";
# if (&run_tta_cmd("delete",$ens_obj)) {
# print "</pre><tr><p><b>$text{'user_delete'}... Tarantella </b></tr>\n";
@listapps=&list_apps();
@list__apps = sort {$a->{'name'} cmp $b->{'name'}} @listapps;
&lock_file($config{'app_list'});
open(FILEAPPS, ">$config{'app_list'}");
foreach $app (@list__apps) {
if ( $app->{'alias'} ne $appname) {
$linapp=$app->{'alias'}."::".$app->{'name'}."::".$app->{'grpalias'}."::".$app->{'obj'}."::".$app->{'ens'}."::".$app->{'maxsess'}."::".$app->{'descrip'}."::\n";
print FILEAPPS "$linapp";
}
}
close (FILEAPPS);
$str=$text{'user_delete'}.$appname;
&additional_log('delapps.cgi', undef, $str);
&webmin_log($config{'app_list'}, undef, "delete");
&unlock_file($config{'app_list'});
# }
print "</tr></td></pre>\n";
}
&footHere;
exit;