Pick up data from LDAP to dtl file (template)

English! place to talk about development, programming and coding
Post Reply
leonardocoutoc
Znuny newbie
Posts: 4
Joined: 03 Nov 2011, 22:48
Znuny Version: 3.0.11
Real Name: Leonardo Conrado
Company: Grupo LM

Pick up data from LDAP to dtl file (template)

Post by leonardocoutoc »

Hi people,

As i can pick up data from ldap and use these data in template Kernel/Output/HTML/Standard/AgentDashboardTicketGeneric.dtl? I have created in my Config.pm the var that store the value from ldap, below the variable in bold:

Map => [
# note: Login, Email and CustomerID needed!
# var, frontend, storage, shown, required, storage-type
#[ 'UserSalutation', 'Title', 'title', 1, 0, 'var' ],
[ 'UserFirstname', 'Firstname', 'givenname', 1, 1, 'var' ],
[ 'UserLastname', 'Lastname', 'sn', 1, 1, 'var' ],
[ 'UserLogin', 'Login', 'sAMAccountName', 1, 1, 'var' ],
[ 'UserEmail', 'Email', 'mail', 1, 1, 'var' ],
[ 'UserCustomerID', 'CustomerID', 'mail', 0, 1, 'var' ],
[ 'UserPhone', 'Phone', 'telephonenumber', 1, 0, 'var' ],
[ 'UserOfficePlace', 'OfficePlace', 'physicalDeliveryOfficeName', 1, 1, 'var' ],
#[ 'UserAddress', 'Address', 'postaladdress', 1, 0, 'var' ],
#[ 'UserComment', 'Comment', 'description', 1, 0, 'var' ],
],

I wanna to create one extra colunm with this value in Agente Dashboard. I have one extra created using CustomerID but with OfficePlace I did not succeed. To CustomerID i used the following line in Kernel/Output/HTML/Standard/AgentDashboardTicketGeneric.dtl file:
<td width="10%">
<div title="$QData{"CustomerUserID"}">$QData{"CustomerID","50"}</div>
</td>

Thanks.
RBehr
Znuny expert
Posts: 167
Joined: 26 Jan 2011, 13:23
Znuny Version: 3.0.7
Real Name: Rod Behr
Company: Impact
Location: London, United Kingdom
Contact:

Re: Pick up data from LDAP to dtl file (template)

Post by RBehr »

I have a similar request: http://forums.otrs.org/viewtopic.php?f=64&t=12514

Any feedback?
Rod Behr
Software Design Manager and Database Analyst | Impact Audiovisual | London
Installation: OTRS 3.0.7, Apache 2, Strawberry Perl 5 on Ubuntu 10.04.3 Server with separate MySQL Server, also on Ubuntu 10.04.3
RBehr
Znuny expert
Posts: 167
Joined: 26 Jan 2011, 13:23
Znuny Version: 3.0.7
Real Name: Rod Behr
Company: Impact
Location: London, United Kingdom
Contact:

Re: Pick up data from LDAP to dtl file (template)

Post by RBehr »

Rod Behr
Software Design Manager and Database Analyst | Impact Audiovisual | London
Installation: OTRS 3.0.7, Apache 2, Strawberry Perl 5 on Ubuntu 10.04.3 Server with separate MySQL Server, also on Ubuntu 10.04.3
juanman80
Znuny newbie
Posts: 44
Joined: 11 Nov 2011, 10:30
Znuny Version: 5.0.15

Re: Pick up data from LDAP to dtl file (template)

Post by juanman80 »

Hi people,
I had the similar problem, with Users and CustomerUsers: I needed to show some fields present in ldap
I'll show my hack, it seems to me more elegant than the previous one.
  • First of all, I put in my Config.pm the field I need (DNI is the spanish official ID):

    Code: Select all

    $Self->{'AuthSyncModule::LDAP::UserSyncMap'} = {
            # DB -> LDAP
            ...
            UserDNI       => 'description',
            ...
    };
    
  • Then I copy Kernel/System/User.pm to Custom/Kernel/System/User.pm and modify subs UserAdd and UserUpdate, adding the following lines (the same to both functions):

    Code: Select all

    after #set email address
    
        # set description (DNI) as preference if it's defined
        $Self->SetPreferences( 
            UserID => $UserID, 
            Key    => 'UserDNI', 
            Value  => $Param{UserDNI} 
        ) if ($Param{UserDNI});
    
  • Finally, I copy Kernel/Output/HTML/Standard/AdminUser.dtl to my own skin and add the following lines:

    Code: Select all

    <label for="UserDNI">$Text{"DNI"}:</label>
    <div class="Field">
        <input type="text" name="UserDNI" id="UserDNI" value="$QData{"UserDNI"}" class="W50pc" maxlength="100" readonly="readonly"/>
    </div>
    <div class="Clear"></div>
Please, tell me how it goes if you try it
OTRS 5.0.15 on CentOSLinux with MariaDB database connected to an Active Directory for Agents and Customers.
RBehr
Znuny expert
Posts: 167
Joined: 26 Jan 2011, 13:23
Znuny Version: 3.0.7
Real Name: Rod Behr
Company: Impact
Location: London, United Kingdom
Contact:

Re: Pick up data from LDAP to dtl file (template)

Post by RBehr »

Nice. Like it. :D
Rod Behr
Software Design Manager and Database Analyst | Impact Audiovisual | London
Installation: OTRS 3.0.7, Apache 2, Strawberry Perl 5 on Ubuntu 10.04.3 Server with separate MySQL Server, also on Ubuntu 10.04.3
Post Reply