Revision 8207
Added by Jing Tao about 11 years ago
ldapweb.cgi | ||
---|---|---|
253 | 253 |
### Determine the display organization list (such as NCEAS, Account ) in the ldap template files |
254 | 254 |
my $displayOrgListStr; |
255 | 255 |
$displayOrgListStr = $skinProperties->getProperty("ldap.templates.organizationList") or $displayOrgListStr = $properties->getProperty('ldap.templates.organizationList'); |
256 |
my @displayOrgList = split(':', $displayOrgListStr); |
|
256 |
debug("the string of the org from properties : " . $displayOrgListStr); |
|
257 |
my @displayOrgList = split(';', $displayOrgListStr); |
|
258 |
|
|
257 | 259 |
my @validDisplayOrgList; #this array contains the org list which will be shown in the templates files. |
258 | 260 |
|
259 | 261 |
my %orgNamesHash = %$orgNames; |
260 | 262 |
foreach my $element (@displayOrgList) { |
261 | 263 |
if(exists $orgNamesHash{$element}) { |
264 |
debug("push the organization " . $element . " into the dispaly array"); |
|
262 | 265 |
#if the name is found in the organization part of metacat.properties, put it into the valid array |
263 | 266 |
push(@validDisplayOrgList, $element); |
264 | 267 |
} |
... | ... | |
451 | 454 |
|
452 | 455 |
my $allParams = { 'givenName' => $query->param('givenName'), |
453 | 456 |
'sn' => $query->param('sn'), |
454 |
'o' => 'unaffiliated', # only accept unaffiliated registration
|
|
457 |
'o' => $query->param('o'),
|
|
455 | 458 |
'mail' => $query->param('mail'), |
456 | 459 |
'uid' => $query->param('uid'), |
457 | 460 |
'userPassword' => $query->param('userPassword'), |
... | ... | |
941 | 944 |
$ldap->start_tls( verify => 'none'); |
942 | 945 |
debug("Attempting to bind to LDAP server with dn = $ldapUsername, pwd = $ldapPassword"); |
943 | 946 |
$ldap->bind( version => 3, dn => $ldapUsername, password => $ldapPassword ); |
944 |
my $additions; |
|
945 |
$additions = [ |
|
946 |
$organization => $organizationName, |
|
947 |
'objectclass' => ['top', 'organization'] |
|
948 |
]; |
|
947 |
my $additions; |
|
948 |
if($organization eq 'ou') { |
|
949 |
$additions = [ |
|
950 |
$organization => $organizationName, |
|
951 |
'objectclass' => ['top', 'organizationalUnit'] |
|
952 |
]; |
|
953 |
|
|
954 |
} else { |
|
955 |
$additions = [ |
|
956 |
$organization => $organizationName, |
|
957 |
'objectclass' => ['top', 'organization'] |
|
958 |
]; |
|
959 |
|
|
960 |
} |
|
961 |
|
|
949 | 962 |
$dn=$ldapConfig->{$org}{'org'} . ',' . $tmpSearchBase; |
950 | 963 |
# Do the insertion |
951 | 964 |
my $result = $ldap->add ( 'dn' => $dn, 'attr' => [ @$additions ]); |
Also available in: Unified diff
Fixed a bug to split the organization list from a property file.
Fixed a bug to use a wrong object class for the ou.