Customers from LDAP have "$" sign in field.

Moderator: crythias

Locked
Niels2570
Znuny newbie
Posts: 20
Joined: 16 May 2011, 15:11
Znuny Version: 3.3.11
Real Name: Niels

Customers from LDAP have "$" sign in field.

Post by Niels2570 »

Hello,

I'm running otrs 3.0.7 and I have configured our LDAP to be used for the customers.

It seems to work fine except the Address field shows a "$" sign where I would like to have a "," :-(

e.g. Address: Pharmacologie et toxicologie$Rue du Bugnon 1$CH-1305 Lausanne$

Is there a possibilty to replace this "$" sign with a "," ?

Regards,
Niels
root
Administrator
Posts: 4250
Joined: 18 Dec 2007, 12:23
Znuny Version: Znuny and Znuny LTS
Real Name: Roy Kaldung
Company: Znuny
Contact:

Re: Customers from LDAP have "$" sign in field.

Post by root »

Hi,

Can you provide any details of your configuration? AD/eDirectory/OpenLDAP? Any filter?

Regards, Roy
Znuny and Znuny LTS running on CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO

Use a test system - always.

Do you need professional services? Check out https://www.znuny.com/

Do you want to contribute or want to know where it goes ?
Niels2570
Znuny newbie
Posts: 20
Joined: 16 May 2011, 15:11
Znuny Version: 3.3.11
Real Name: Niels

Re: Customers from LDAP have "$" sign in field.

Post by Niels2570 »

root wrote:Hi,

Can you provide any details of your configuration? AD/eDirectory/OpenLDAP? Any filter?

Regards, Roy
Hi Roy,

OTRS is running on a RHEL6 machine, our LDAP server is a Sun Java System Directory Server.
My configuration file (Config.pm) is very standard and looks like this :

Code: Select all

   $Self->{CustomerUser} = {
        Name => 'LDAP Backend',
        Module => 'Kernel::System::CustomerUser::LDAP',
        Params => {
            # ldap host
            Host => 'myhostname.com',
            # ldap base dn
            BaseDN => 'o=test,c=com',
            # search scope (one|sub)
            SSCOPE => 'sub',
            # The following is valid but would only be necessary if the
            # anonymous user does NOT have permission to read from the LDAP tree
            UserDN => '',
            UserPw => '',
            # in case you want to add always one filter to each ldap query, use
            # this option. e. g. AlwaysFilter => '(mail=*)' or AlwaysFilter => '(objectclass=user)'
            AlwaysFilter => '',
            # if both your frontend and your LDAP are unicode, use this:
            SourceCharset => 'utf-8',
            DestCharset   => 'utf-8',
#            DestCharset   => 'iso-8859-1',
            # die if backend can't work, e. g. can't connect to server
            Die => 0,
            # Net::LDAP new params (if needed - for more info see perldoc Net::LDAP)
            Params => {
                port    => 389,
                timeout => 120,
                async   => 0,
                version => 3,
            },
        },
        # customer uniq id
        CustomerKey => 'uid',
        # customer #
        CustomerID => 'mail',
        CustomerUserListFields => ['cn', 'mail'],
        CustomerUserSearchFields => ['uid', 'cn', 'mail'],
        CustomerUserSearchPrefix => '',
        CustomerUserSearchSuffix => '*',
        CustomerUserSearchListLimit => 250,
        CustomerUserPostMasterSearchFields => ['mail'],
        CustomerUserNameFields => ['givenname', 'sn'],
        # show now own tickets in customer panel, CompanyTickets
        CustomerUserExcludePrimaryCustomerID => 0,
        # add a ldap filter for valid users (expert setting)
        # CustomerUserValidFilter => '(!(description=gesperrt))',
        # admin can't change customer preferences
        AdminSetPreferences => 0,
        # cache time to live in sec. - cache any ldap queries
        CacheTTL => 0,
        Map => [
            # note: Login, Email and CustomerID needed!
            # var, frontend, storage, shown (1=always,2=lite), required, storage-type, http-link, readonly
            [ 'UserTitle',      'Title',      'title',           1, 0, 'var', '', 0 ],
            [ 'UserFirstname',  'Firstname',  'givenname',       1, 1, 'var', '', 0 ],
            [ 'UserLastname',   'Lastname',   'sn',              1, 1, 'var', '', 0 ],
            [ 'UserLogin',      'Username',   'uid',             1, 1, 'var', '', 0 ],
            [ 'UserEmail',      'Email',      'mail',            1, 1, 'var', '', 0 ],
            [ 'UserCustomerID', 'CustomerID', 'mail',            0, 1, 'var', '', 0 ],
           # [ 'UserCustomerIDs', 'CustomerIDs', 'second_customer_ids', 1, 0, 'var', '', 0 ],
            [ 'UserPhone',      'Phone',      'telephonenumber', 1, 0, 'var', '', 0 ],
            [ 'UserAddress',    'Address',    'postaladdress',   1, 0, 'var', '', 0 ],
            [ 'UserComment',    'Comment',    'description',     1, 0, 'var', '', 0 ],
        ],
    };
Regards.
Niels
root
Administrator
Posts: 4250
Joined: 18 Dec 2007, 12:23
Znuny Version: Znuny and Znuny LTS
Real Name: Roy Kaldung
Company: Znuny
Contact:

Re: Customers from LDAP have "$" sign in field.

Post by root »

It looks like the $ is used as an internal delimiter. My guess is that the only way to fix this in Kernel/System/CustomerUser/LDAP.pm

This could work:

1.) copy Kernel/System/CustomerUser/LDAP.pm to Custom/Kernel/System/CustomerUser/LDAP.pm
2.) see in the copied file line at 628ff:

Code: Select all

627     # get customer user info
628     for my $Entry ( @{ $Self->{CustomerUserMap}->{Map} } ) {
629         my $Value = $Self->_ConvertFrom( $Result2->get_value( $Entry->[2] ) ) || '';
630         if ( $Value && $Entry->[2] =~ /^targetaddress$/i ) {
631             $Value =~ s/SMTP:(.*)/$1/;
632         }
633         $Data{ $Entry->[0] } = $Value;
634     }
and try this one with the new line 633-635:

Code: Select all

628     for my $Entry ( @{ $Self->{CustomerUserMap}->{Map} } ) {
629         my $Value = $Self->_ConvertFrom( $Result2->get_value( $Entry->[2] ) ) || '';
630         if ( $Value && $Entry->[2] =~ /^targetaddress$/i ) {
631             $Value =~ s/SMTP:(.*)/$1/;
632         }
633         if ( $Value && $Entry->[2] =~ /^postaladdress$/i ) {
634             $Value =~ s/\$/,/g;
635         }
636         $Data{ $Entry->[0] } = $Value;
637     }
hth, Roy
Znuny and Znuny LTS running on CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO

Use a test system - always.

Do you need professional services? Check out https://www.znuny.com/

Do you want to contribute or want to know where it goes ?
Niels2570
Znuny newbie
Posts: 20
Joined: 16 May 2011, 15:11
Znuny Version: 3.3.11
Real Name: Niels

Re: Customers from LDAP have "$" sign in field.

Post by Niels2570 »

Hi Roy,

It works, thanks a lot !

Regards,
Niels
Locked