Skip Menu |

This queue is for tickets about the RT-Extension-LDAPImport CPAN distribution.

Report information
The Basics
Id: 77612
Status: new
Priority: 0/
Queue: RT-Extension-LDAPImport

Owner: Nobody in particular
Requestors: rafal [...]

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)

Subject: LDAPImport - add convert rule (synchronizing users disabled in AD)
Date: Mon, 04 Jun 2012 15:37:05 +0200
To: <bug-RT-Extension-LDAPImport [...]>
From: Rafał Matera <rafal [...]>
Download (untitled) / with headers
text/plain 1.3k
I was wondering how to import RT User's Disabled field from Windows Active Directory using LDAP import. One missing thing was, how to execute the code to convert value form AD field userAccountControl. In fact I needed to extract second bit from that field and put result into User->Disabled So I added new config option $LDAPConvert: Set($LDAPMapping, {'Name' => 'sAMAccountName', 'EmailAddress' => 'mail', ... 'Disabled' => 'userAccountControl', ... }); Set($LDAPConvert, { 'Disabled' => sub { ($_[0] & 2) / 2 } }); And also 1 line of code executing this conversion: --- 2012-03-15 15:53:14.000000000 +0100 +++ 2012-03-16 10:13:51.406609924 +0100 @@ -283,6 +283,8 @@ push @values, scalar $args{ldap_entry}->get_value($attribute); } $object->{$rtfield} = join(' ',grep {defined} @values); + $object->{$rtfield} = ($RT::LDAPConvert->{$rtfield})->($object->{$rtfield}) + if (defined($RT::LDAPConvert->{$rtfield}) && ref($RT::LDAPConvert->{$rtfield}) eq 'CODE'); } return $object; This code refers to RT-Extension-LDAPImport-0.31 Maybe it is interesting enough for you to include in next release :-) BR Rafal

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to