Revision 8206
Added by Jing Tao about 11 years ago
src/perl/ldapweb.cgi | ||
---|---|---|
251 | 251 |
} |
252 | 252 |
|
253 | 253 |
### Determine the display organization list (such as NCEAS, Account ) in the ldap template files |
254 |
my $displayOrgList; |
|
255 |
$displayOrgList = $skinProperties->getProperty("ldap.templates.organizationList") or $displayOrgList = $properties->getProperty('ldap.templates.organizationList'); |
|
254 |
my $displayOrgListStr; |
|
255 |
$displayOrgListStr = $skinProperties->getProperty("ldap.templates.organizationList") or $displayOrgListStr = $properties->getProperty('ldap.templates.organizationList'); |
|
256 |
my @displayOrgList = split(':', $displayOrgListStr); |
|
257 |
my @validDisplayOrgList; #this array contains the org list which will be shown in the templates files. |
|
256 | 258 |
|
259 |
my %orgNamesHash = %$orgNames; |
|
260 |
foreach my $element (@displayOrgList) { |
|
261 |
if(exists $orgNamesHash{$element}) { |
|
262 |
#if the name is found in the organization part of metacat.properties, put it into the valid array |
|
263 |
push(@validDisplayOrgList, $element); |
|
264 |
} |
|
265 |
|
|
266 |
} |
|
257 | 267 |
|
268 |
if(!@validDisplayOrgList) { |
|
269 |
my $sender; |
|
270 |
$sender = $skinProperties->getProperty("email.sender") or $sender = $properties->getProperty('email.sender'); |
|
271 |
print "Content-type: text/html\n\n"; |
|
272 |
print "The value of property ldap.templates.organizationList in " |
|
273 |
. $skinName . ".properties file or metacat.properties file (if the property doesn't exist in the " |
|
274 |
. $skinName . ".properties file) is invalid. Please send the information to ". $sender; |
|
275 |
exit(0); |
|
276 |
} |
|
277 |
|
|
278 |
|
|
258 | 279 |
#--------------------------------------------------------------------------80c-> |
259 | 280 |
# Define the main program logic that calls subroutines to do the work |
260 | 281 |
#--------------------------------------------------------------------------80c-> |
... | ... | |
906 | 927 |
my $ldapPassword = $ldapConfig->{$org}{'password'}; |
907 | 928 |
debug("LDAP connection to $ldapurl..."); |
908 | 929 |
|
909 |
my @organizationInfo = split(/=/, $ldapConfig->{$org}{'org'}); #split 'o=NCEAS' or something like that
|
|
930 |
my @organizationInfo = split('=', $ldapConfig->{$org}{'org'}); #split 'o=NCEAS' or something like that
|
|
910 | 931 |
my $organization = $organizationInfo[0]; # This will be 'o' or 'ou' |
911 | 932 |
my $organizationName = $organizationInfo[1]; # This will be 'NCEAS' or 'Account' |
912 | 933 |
|
... | ... | |
1429 | 1450 |
styleCommonPath => $contextUrl . "/style/common", |
1430 | 1451 |
contextUrl => $contextUrl, |
1431 | 1452 |
cgiPrefix => $cgiPrefix, |
1432 |
orgList => \@orgList,
|
|
1453 |
orgList => \@validDisplayOrgList,
|
|
1433 | 1454 |
config => $config, |
1434 | 1455 |
}; |
1435 | 1456 |
|
Also available in: Unified diff
Pass a organization list to the template.