From: Cox, T. (NCI) <tc...@ma...> - 2002-05-21 14:41:47
|
I have a CGI script that does just what you want to do. I have a few cutom attributes that I have put in our NDS tree that are a pain to modify with the current too set. What I did to get around that (if I understand correctly) is a hash map that has what I want to display on the form. The key is the name I want to display and the value is the real LDAP value or attribute. My example is: # Display map hash my %attr_hash = ("First Name" => "givenName", "Last Name" => "surname", "Full Name" => "fullName", "Title" => "title", "Telephone Number" => "telephoneNumber", "Fax Number" => "facsimileTelephoneNumber","Email Address" => "mail", "Building" => "nciBuilding", "Room Number" => "roomNumber", "Group Volume" => "nciGroupVolume","TFS ID" => "nciTfsID", "Support ID" => "nciSupportID", "NIH UID" => "nciNihUID","Oracle ID" => "nciOracleId", "Directory Exclude" => "nciDirectoryExclude"); # Big chunk of code missing to save space..... foreach (@fields) { $nds_attr = $attr_hash{$_}; # Map the display name to the attribute variable $result = $entry->get_value($nds_attr); # Get the attribute and display it if($_ eq "Group Volume") # We have a few specific attributes that require special handling { ($volume,$num,$path) = split("#",$result); push(@data,"<th align=left nowrap >$_:</th><td nowrap><font color=\"FF0000\">$volume</td>"); }elsif($_ eq "Path"){ push(@data,"<th align=left nowrap >$_:</th><td nowrap><font color=\"FF0000\">$path</td>"); }elsif($_ eq "Password" || $_ eq "Password Again"){ next; }else{ push(@data,"<th align=left nowrap >$_:</th><td nowrap><font color=\"FF0000\">$result</td>"); } # Dummy cell placement to keep the colume aligned push(@data,"<th -align=LEFT nowrap> </th><td nowrap> </td>"); push(@data,"<th -align=LEFT nowrap> </th><td nowrap> </td>"); } I hope this helps in some way. Let me also say the Net::LDAP module has been a great enhancement/tool to our group. K. Todd Cox National Cancer Institute Rockville, MD -----Original Message----- From: Graham Barr [mailto:gb...@po...] Sent: Tuesday, May 21, 2002 10:09 AM To: LDAP Mailing List Cc: Mark Prior Subject: [Fwd] Question relating to Net::LDAP 0.25 ----- Forwarded message from Mark Prior <mr...@ia...> ----- Date: Tue, 21 May 2002 21:11:14 +0930 To: Graham Barr <gb...@po...> From: Mark Prior <mr...@ia...> Subject: Question relating to Net::LDAP 0.25 I am attempting to use Net::LDAP and I have run into a problem that I'm hoping you might have some advice on. I am writing a CGI to allow our staff to modify their entries. I am pulling out the objectClass attribute from their entry and using the schema routine to display the attributes they can modify. Naturally I want to provide the existing data as the default and that is where I ran into a number of problems. First of all I discovered that search returns the mobile phone attribute from the cosine schema as "mobile" but schema returns it as "mobileTelephoneNumber" (which I was expecting it to consider an alias). To try to work around that I was going to use Net::LDAP::Schema::item to grab the name of the attribute (which I was hoping would be consistent) but then I discovered that name2oid for telephoneNumber returned two oids (one for the syntax and another for the attribute). In the syntax case I would suggest that removing all spaces and lowercasing the value "Telephone Number" is a bad idea and at least replacing spaces with underscores would be better (although I haven't looked for other implications of that change). Do you think that the first problem is a bug and if so can you suggest a fix. If it's not a bug then any ideas on what I should be doing? Thanks, Mark. ----- End forwarded message ----- _______________________________________________________________ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm |