Pulling CustomerIDs from a multi-valued LDAP attribute

Hi list, According to the doc, CustomerIDs can be pulled from a LDAP customer backend if the declared attribute contains a list of customer ids separated by commas. (see http://doc.otrs.org/3.2/en/html/external-backends.html#multi-customer-ids-ld...) We use an ActiveDirectory as user repository an plan to use the directReports/manager attributes. That is, for a manager, asking for the directReports attribute return a list of reporters. Is it possible to set the LDAP attribute to an attribute that returns multiple values ? I guess if not, I should try to adapt Kernel/System/CustomerUser/LDAP.pm for that purpose by myself ? Thanks for your feedback, Ionel -- This message and any attachments (the message) are confidential and intended solely for the addressees. Any unauthorised use, dissemination or reproduction is strictly prohibited. The sender does not accept liability for any errors or omissions in the contents of this message arising as a result of e-mail transmission.

for ldap returning different values for the same attribute? out of the box,
no.
Ldap->search returns a string.
http://search.cpan.org/~marschap/perl-ldap-0.53/lib/Net/LDAP.pod
relevant code in CustomerUser/LDAP.pm
my %Users;
for my $entry ( $Result->all_entries() ) {
my $CustomerString = '';
for my $Field (@attrs) {
my $FieldValue = $entry->get_value($Field); # <==
http://search.cpan.org/~marschap/perl-ldap-0.53/lib/Net/LDAP/Entry.pod *
$FieldValue = defined $FieldValue ? $FieldValue : '';
$CustomerString .= $Self->_ConvertFrom($FieldValue) . ' ';
}
my $KeyValue = $entry->get_value( $Self->{CustomerKey} );
$KeyValue = defined $KeyValue ? $KeyValue : '';
$Users{ $Self->_ConvertFrom($KeyValue) } = $CustomerString;
}
* $FieldValue will be the first value for the $Field attribute
changing
my $FieldValue = $entry->get_value($Field);
to
my $FieldValue = $entry->get_value($Field, asref => 1);
makes it a reference to an array.
to deref
@{ $FieldValue };
to make it a CSV list:
$FieldValue = join( ',', @{ $FieldValue } );
http://www.perlmonks.org/?node_id=30279
At least, that's what I'd consider doing. Haven't tried it. Your results
may vary.
On Sun, Feb 24, 2013 at 9:40 AM, GARDAIS Ionel
Hi list,
According to the doc, CustomerIDs can be pulled from a LDAP customer backend if the declared attribute contains a list of customer ids separated by commas. (see http://doc.otrs.org/3.2/en/html/external-backends.html#multi-customer-ids-ld... )
We use an ActiveDirectory as user repository an plan to use the directReports/manager attributes. That is, for a manager, asking for the directReports attribute return a list of reporters.
Is it possible to set the LDAP attribute to an attribute that returns multiple values ? I guess if not, I should try to adapt Kernel/System/CustomerUser/LDAP.pm for that purpose by myself ?
Thanks for your feedback, Ionel
-- This message and any attachments (the message) are confidential and intended solely for the addressees. Any unauthorised use, dissemination or reproduction is strictly prohibited. The sender does not accept liability for any errors or omissions in the contents of this message arising as a result of e-mail transmission.
--------------------------------------------------------------------- OTRS mailing list: otrs - Webpage: http://otrs.org/ Archive: http://lists.otrs.org/pipermail/otrs To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs

Oops. ok, not string, SCALAR.
On Sun, Feb 24, 2013 at 11:12 AM, Gerald Young
for ldap returning different values for the same attribute? out of the box, no. Ldap->search returns a string. http://search.cpan.org/~marschap/perl-ldap-0.53/lib/Net/LDAP.pod
relevant code in CustomerUser/LDAP.pm my %Users; for my $entry ( $Result->all_entries() ) {
my $CustomerString = ''; for my $Field (@attrs) {
my $FieldValue = $entry->get_value($Field); # <== http://search.cpan.org/~marschap/perl-ldap-0.53/lib/Net/LDAP/Entry.pod * $FieldValue = defined $FieldValue ? $FieldValue : '';
$CustomerString .= $Self->_ConvertFrom($FieldValue) . ' '; }
my $KeyValue = $entry->get_value( $Self->{CustomerKey} ); $KeyValue = defined $KeyValue ? $KeyValue : '';
$Users{ $Self->_ConvertFrom($KeyValue) } = $CustomerString; }
* $FieldValue will be the first value for the $Field attribute
changing my $FieldValue = $entry->get_value($Field); to my $FieldValue = $entry->get_value($Field, asref => 1);
makes it a reference to an array. to deref @{ $FieldValue };
to make it a CSV list: $FieldValue = join( ',', @{ $FieldValue } );
http://www.perlmonks.org/?node_id=30279
At least, that's what I'd consider doing. Haven't tried it. Your results may vary.
On Sun, Feb 24, 2013 at 9:40 AM, GARDAIS Ionel
wrote: Hi list,
According to the doc, CustomerIDs can be pulled from a LDAP customer backend if the declared attribute contains a list of customer ids separated by commas. (see http://doc.otrs.org/3.2/en/html/external-backends.html#multi-customer-ids-ld... )
We use an ActiveDirectory as user repository an plan to use the directReports/manager attributes. That is, for a manager, asking for the directReports attribute return a list of reporters.
Is it possible to set the LDAP attribute to an attribute that returns multiple values ? I guess if not, I should try to adapt Kernel/System/CustomerUser/LDAP.pm for that purpose by myself ?
Thanks for your feedback, Ionel
-- This message and any attachments (the message) are confidential and intended solely for the addressees. Any unauthorised use, dissemination or reproduction is strictly prohibited. The sender does not accept liability for any errors or omissions in the contents of this message arising as a result of e-mail transmission.
--------------------------------------------------------------------- OTRS mailing list: otrs - Webpage: http://otrs.org/ Archive: http://lists.otrs.org/pipermail/otrs To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs

Thanks Gerald.
In the case stated, other steps should be required as the attributes are DN. My guess is the DNs should be searched to extract the CustomerKey attribute for each, then setting the CSV from them.
Unfortunately it's beyond my Perl capabilities.
Could it be a good candidate for an enhancement request ?
Ionel
________________________________________
De : otrs-bounces@otrs.org [otrs-bounces@otrs.org] de la part de Gerald Young [crythias@gmail.com]
Date d'envoi : dimanche 24 février 2013 17:12
À : User questions and discussions about OTRS.
Objet : Re: [otrs] Pulling CustomerIDs from a multi-valued LDAP attribute
Oops. ok, not string, SCALAR.
On Sun, Feb 24, 2013 at 11:12 AM, Gerald Young

"the attributes are DN" ...
"Could it be a good candidate for an enhancement request?"
Yes. It's a good candidate for a request. But consider what you're asking
when every other attribute provides exactly the requested result instead of
needle-in-a-haystack... "Oh, you mean *this* needle"
I recommend the department for ... erm... departments or Custom1 to hold
customerIds.
On Sun, Feb 24, 2013 at 12:55 PM, GARDAIS Ionel
Thanks Gerald.
In the case stated, other steps should be required as the attributes are DN. My guess is the DNs should be searched to extract the CustomerKey attribute for each, then setting the CSV from them.
Unfortunately it's beyond my Perl capabilities. Could it be a good candidate for an enhancement request ?
Ionel ________________________________________ De : otrs-bounces@otrs.org [otrs-bounces@otrs.org] de la part de Gerald Young [crythias@gmail.com] Date d'envoi : dimanche 24 février 2013 17:12 À : User questions and discussions about OTRS. Objet : Re: [otrs] Pulling CustomerIDs from a multi-valued LDAP attribute
Oops. ok, not string, SCALAR.
On Sun, Feb 24, 2013 at 11:12 AM, Gerald Young
> wrote: for ldap returning different values for the same attribute? out of the box, no. Ldap->search returns a string. http://search.cpan.org/~marschap/perl-ldap-0.53/lib/Net/LDAP.pod relevant code in CustomerUser/LDAP.pm my %Users; for my $entry ( $Result->all_entries() ) {
my $CustomerString = ''; for my $Field (@attrs) {
my $FieldValue = $entry->get_value($Field); # <== http://search.cpan.org/~marschap/perl-ldap-0.53/lib/Net/LDAP/Entry.pod * $FieldValue = defined $FieldValue ? $FieldValue : '';
$CustomerString .= $Self->_ConvertFrom($FieldValue) . ' '; }
my $KeyValue = $entry->get_value( $Self->{CustomerKey} ); $KeyValue = defined $KeyValue ? $KeyValue : '';
$Users{ $Self->_ConvertFrom($KeyValue) } = $CustomerString; }
* $FieldValue will be the first value for the $Field attribute
changing my $FieldValue = $entry->get_value($Field); to my $FieldValue = $entry->get_value($Field, asref => 1);
makes it a reference to an array. to deref @{ $FieldValue };
to make it a CSV list: $FieldValue = join( ',', @{ $FieldValue } );
http://www.perlmonks.org/?node_id=30279
At least, that's what I'd consider doing. Haven't tried it. Your results may vary.
On Sun, Feb 24, 2013 at 9:40 AM, GARDAIS Ionel
mailto:Ionel.Gardais@beicip.com> wrote: Hi list, According to the doc, CustomerIDs can be pulled from a LDAP customer backend if the declared attribute contains a list of customer ids separated by commas. (see http://doc.otrs.org/3.2/en/html/external-backends.html#multi-customer-ids-ld... )
We use an ActiveDirectory as user repository an plan to use the directReports/manager attributes. That is, for a manager, asking for the directReports attribute return a list of reporters.
Is it possible to set the LDAP attribute to an attribute that returns multiple values ? I guess if not, I should try to adapt Kernel/System/CustomerUser/LDAP.pm for that purpose by myself ?
Thanks for your feedback, Ionel
-- This message and any attachments (the message) are confidential and intended solely for the addressees. Any unauthorised use, dissemination or reproduction is strictly prohibited. The sender does not accept liability for any errors or omissions in the contents of this message arising as a result of e-mail transmission.
--------------------------------------------------------------------- OTRS mailing list: otrs - Webpage: http://otrs.org/ Archive: http://lists.otrs.org/pipermail/otrs To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs
-- This message and any attachments (the message) are confidential and intended solely for the addressees. Any unauthorised use, dissemination or reproduction is strictly prohibited. The sender does not accept liability for any errors or omissions in the contents of this message arising as a result of e-mail transmission.
--------------------------------------------------------------------- OTRS mailing list: otrs - Webpage: http://otrs.org/ Archive: http://lists.otrs.org/pipermail/otrs To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs
participants (2)
-
GARDAIS Ionel
-
Gerald Young