Put LDAP info into Custom Fields of Users

Hi everybody -

Running RT 3.8.7 and using LDAP to authenticate users.

There is this code available to set specific user information from LDAP:

The mapping of RT attributes on to LDAP attributes

                                                    'attr_map'
   =>  {   'Name' => 'uid',

           'EmailAddress' => 'mail',

           'RealName' => 'givenName',

           'ExternalAuthId' => 'uid',

           'Gecos' => 'uid',

I was wondering if there is a way to take LDAP info and put it into a custom
field.

We have a custom field (Carthage ID#) for each user. I’d like to be able to
populate that directly from LDAP. Is that possible?

I guess I could always just populate a field we don’t use (something like
the nickname field) with the ID# – but I’d like to see if this is possible
first.

Thanks!

Max
Max McGrath
Asst. Network Admin/Systems Specialist
Carthage College
262-552-5512
mmcgrath@carthage.edu

Max McGrath wrote:

Hi everybody -

Running RT 3.8.7 and using LDAP to authenticate users.

There is this code available to set specific user information from LDAP:

The mapping of RT attributes on to LDAP attributes

                                                    'attr_map'      
       =>  {   'Name' => 'uid',
                                                                    
               'EmailAddress' => 'mail',
                                                                    
               'RealName' => 'givenName',
                                                                    
               'ExternalAuthId' => 'uid',
                                                                    
               'Gecos' => 'uid',

I was wondering if there is a way to take LDAP info and put it into a
custom field.

I don’t recall offhand how RT handles Custom Fields with respect to user
objects. The way the LDAP info is handled is that a user object is
pulled into a variable and the attribute hash is extracted to another,
then LDAP information is pulled and inserted into that hash and the
pushed right back into the user object, this way non-ldap-mapped
information is untouched, but all LDAP information is overwritten on
each lookup.

It is, then, easy to overwrite any existing user field with LDAP
information by adding it to the hash and pulling the specific field from
LDAP to write over it, but I don’t know that Custom Fields are as
simple. Perhaps it can be done in the same way by referring to
{CustomField1} or similar. It’s been a long time since I looked at CFs
that deeply.

Perhaps the way CommandByMail handles Custom Fields might provide useful
guidance.

Kind Regards,

Mike Peachey, IT Systems Administrator
Tel: +44 114 281 2655
Fax: +44 114 281 2951
Jennic Ltd, Furnival Street, Sheffield, S1 4QT, UK
Comp Reg No: 3191371 - Registered In England
http://www.jennic.com