113 lines
4.2 KiB
Perl
Executable File
113 lines
4.2 KiB
Perl
Executable File
#!/usr/bin/perl
|
|
# addgrpapps.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';
|
|
&headerstta($text{'index_addgrpapps'}, "", "addgrpapps",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 }
|
|
&foreign_require("proc", "proc-lib.pl");
|
|
&ReadParse();
|
|
if ( $config{'is_ldapcache'} eq "true" && $in{tta3tier_login} ) {
|
|
do "ldap-lib.pl";
|
|
}
|
|
|
|
$type_cmd = $in{ttacmd};
|
|
$tta_norun = $in{ttanorun};
|
|
$grpappsname=$in{grpappsname};
|
|
$grp_grpapps=$in{grpapps};
|
|
$obj_descrip=$in{descrip};
|
|
$aliasgrpapps=$in{aliasgrpapps};
|
|
$maxsess=$in{maxsess};
|
|
|
|
print "<table width=100% border>\n";
|
|
print "<tr $tb> <td><font color='$revtext'><b>$text{'titidx_adgrpapps'} $grpappsname </b></td> </tr>\n";
|
|
print "<tr $cb> <td><table width=100%>\n";
|
|
print "<center>\n";
|
|
|
|
if (!$grpappsname) { &footHere; exit } ;
|
|
$alias=$aliasgrpapps;
|
|
%h_grpapps=&list_grpapps();
|
|
if ( $h_grpapps{$aliasgrpapps}->{'alias'} eq $aliasgrpapps ) {
|
|
$err_msg=$text{'list_err'};
|
|
&footHere;
|
|
exit;
|
|
}
|
|
$grp_name="";
|
|
$dn_grpapps="";
|
|
$grp_descrip="";
|
|
$ens_grpapps="";
|
|
if ( $h_grpapps{$grp_grpapps}->{'alias'} eq $grp_grpapps ) {
|
|
$dn_grpapps=$h_grpapps{$grp_grpapps}->{obj};
|
|
$ens_grpapps=$h_grpapps{$grp_grpapps}->{ens};
|
|
$grp_name=$h_grpapps{$grp_grpapps}->{name};
|
|
$grp_descrip=$h_grpapps{$grp_grpapps}->{descrip};
|
|
} else {
|
|
$err_msg="$grp_grpapps: ".$text{'list_errno'};
|
|
&footHere;
|
|
exit;
|
|
}
|
|
if ( $dn_grpapps eq "" ) {
|
|
$dn = "ou=$grpappsname";
|
|
$ens = "ou=$grpappsname";
|
|
} else {
|
|
$dn = "ou=$grpappsname,$dn_grpapps";
|
|
$ens = "$ens_grpapps/ou=$grpappsname";
|
|
}
|
|
$ens_obj = "--name \"".$config{tta_base}."/$ens\"";
|
|
$dn_org=$dn;
|
|
$| = 1;
|
|
$temp = &tempname();
|
|
open(TEMP, ">$temp");
|
|
print TEMP "#!/bin/sh\n";
|
|
print TEMP $env;
|
|
print TEMP "export $export\n" if ($export);
|
|
print TEMP "$str\n";
|
|
close(TEMP);
|
|
$temp_f=$config{'tta_defaults_grpapps'};
|
|
# Assigning and collecting values to be used in the form ...
|
|
%h_ttaobj=&load_ttaobj();
|
|
$cdm =$h_ttaobj{'cdm'}->{'value'};
|
|
$inherit =$h_ttaobj{'inherit'}->{'value'};
|
|
$webtop =$h_ttaobj{'webtop'}->{'value'};
|
|
$conntype=$h_ttaobj{'conntype'}->{'value'};
|
|
$temp_f = &tempname();
|
|
open(TEMPF, ">$temp_f");
|
|
print TEMPF "$ens_obj\\\n";
|
|
if ( $cdm ne "" ) {print TEMPF " --cdm \"$cdm\"\\\n"; }
|
|
if ( $inherit ne "" ) {print TEMPF " --inherit \"$inherit\"\\\n"; }
|
|
if ( $conntype ne "" ) { print TEMPF " --conntype \"$conntype\"\\\n"; }
|
|
if ( $webtop ne "" ) {print TEMPF " --webtop \"$webtop\"\\\n"; }
|
|
print TEMPF " --description \"$obj_descrip\" \n";
|
|
close(TEMPF);
|
|
if ( $tta_norun eq "true" ) { $type_cmd = "no_run $type_cmd"; };
|
|
if ( &run_tta_cmd($type_cmd,$ens_obj,$temp_f) ) {
|
|
print "</pre>\n";
|
|
} else { &html_errshow("tta")};
|
|
if ( $config{'is_ldapcache'} eq "true" && $in{tta3tier_login} ) {
|
|
$dnldap = "default";
|
|
$default_obj="cn=$config{ldapcache_defaultobj}";
|
|
$ldapcache_server=1;
|
|
&connect_cache ();
|
|
@tta3tier=&set_tta3tier($default_obj,$dn,$dnldap,"add","grpapps");
|
|
if ( &cache_obj(\%tta3tier) ne 0 ) {
|
|
&html_errshow("ldap");
|
|
&footHere; exit;
|
|
} ;
|
|
if ( $config{ldapcache2_server}.length gt 0 ) {
|
|
$ldapcache_server=2;
|
|
&connect_cache ();
|
|
if ( &cache_obj(\%tta3tier) ne 0 ) { &err_replication() }
|
|
}
|
|
}
|
|
$lin_grpapps=$aliasgrpapps."::".$grpappsname."::"."$dn"."::"."$ens"."::".$maxsess."::".$obj_descrip."::";
|
|
&out_objslist( "add", "addgrpapps.cgi", "grpapps", "grpapps_list", $aliasgrpapps, $lin_grpapps, undef );
|
|
if ( $debug lt 2 ) { unlink($temp_f); }
|
|
print "<tr><p><b>".$text{'user_made'}.$grpappsname." -> ".$grp_name."</b></tr>\n";
|
|
print "<tr></tr>\n";
|
|
&footHere;
|
|
exit;
|
|
|