[SOLVED] Fetch customer info from AD & show in ticket

Moderator: crythias

Locked
danieldai
Znuny newbie
Posts: 36
Joined: 20 Apr 2011, 05:56
Znuny Version: 3.1.12

[SOLVED] Fetch customer info from AD & show in ticket

Post by danieldai »

I am a IT supporter in a university and we are testing OTRS as the tool to track email tickets. Both agents and customers here are using AD accounts. According to our design, customers don't have to log in OTRS' customer interface to submit tickets. They only need to send mails to a shared mailbox, which is fetched by OTRS automatically. When a ticket is created, in agent's interface, we only see nothing but customer ID which is the customer's email address. Nothing more. I'd like see customer name, address, phone, etc. Other attributes in AD is preferred.

How can I make OTRS fetch such info from customers' attributes from AD? OTRS only knows customer's email address instead of AD account when a ticket is created.
What are the prerequisites to make it happen? BTW, I haven't added customers in "customer" section in OTRS agent interface. I've set up customer user backend (LDAP) in Kernel/Config.pm

Environment info as below:
OTRS version: 3.0.4
OS: CentOS 5.5
LDAP: Microsoft Active Directory
Mail system: Microsoft Exchange
Last edited by danieldai on 02 Aug 2011, 04:07, edited 1 time in total.
OTRS version: 3.1.12
OS: CentOS 5.5
LDAP: Microsoft Active Directory
Mail system: Microsoft Exchange
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Fetch customer info from AD & show in ticket

Post by crythias »

Can you provide the relevant Config.pm entries for your LDAP connection?
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
danieldai
Znuny newbie
Posts: 36
Joined: 20 Apr 2011, 05:56
Znuny Version: 3.1.12

Re: Fetch customer info from AD & show in ticket

Post by danieldai »

crythias wrote:Can you provide the relevant Config.pm entries for your LDAP connection?
Entries as below. Thanks in advance.

Real name is replaced by "ABC".

Code: Select all

# 2. Customer user backend: Active Directory
    # --------------------------------------- #
    #	Configuring a LDAP customer backend   #
    #   Added by Michael #
    # --------------------------------------- #
    # CustomerUser
    # (customer ldap backend and settings)
	$Self->{CustomerUser} = {
		Name => 'ABC Active Directory',
		Module => 'Kernel::System::CustomerUser::LDAP',
		Params => {
			# ldap host
			Host => 'ldap.ABC.edu.cn',
			# ldap base dn
			BaseDN => 'ou=Users,dc=ABC,dc=edu,dc=cn',
			# 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 => 'ldap@ABC.edu.cn',
			UserPw => 'ABCabc123',
			# 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 your frontend is e. g. iso-8859-1 and the charset of your
			# ldap server is utf-8, use these options.
			#            SourceCharset => 'utf-8',
			#            DestCharset => 'iso-8859-1',
				# if both your frontend and your LDAP are unicode, use this:
			            SourceCharset => 'utf-8',
			            DestCharset   => 'utf-8',
				# Net::LDAP new params (if needed - for more info see perldoc Net::LDAP)
				Params => {
					port => 389,
					timeout => 120,
					async => 0,
					version => 3,
				},
		},
		# customer unique id
		CustomerKey => 'sAMAccount',
		# customer #
		CustomerID => 'mail',
		CustomerUserListFields => ['cn', 'mail'],
		CustomerUserSearchFields => ['sAMAccount', 'cn', 'mail'],
		CustomerUserSearchPrefix => '',
		CustomerUserSearchSuffix => '*',
		CustomerUserSearchListLimit => 0,
		CustomerUserPostMasterSearchFields => ['mail'],
		CustomerUserNameFields => ['givenname', 'sn'],
		# show not own tickets in customer panel, CompanyTickets
		CustomerUserExcludePrimaryCustomerID => 0,
		# add an ldap filter for valid users (expert setting)
	#    CustomerUserValidFilter => '(!(description=locked))',
		# administrator can't change customer preferences
		AdminSetPreferences => 0,
	#    # cache time to live in sec. - cache any database queries
	#    CacheTTL => 0,
		Map => [
			# note: Login, Email and CustomerID are mandatory!
			# 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 ],
		],
	};
Last edited by danieldai on 21 Apr 2011, 08:16, edited 1 time in total.
OTRS version: 3.1.12
OS: CentOS 5.5
LDAP: Microsoft Active Directory
Mail system: Microsoft Exchange
Wolfgangf
Znuny ninja
Posts: 1029
Joined: 13 Apr 2009, 12:26
Znuny Version: 6.0.13
Real Name: Wolfgang Fürtbauer
Company: PBS Logitek GmbH
Location: Pinsdorf

Re: Fetch customer info from AD & show in ticket

Post by Wolfgangf »

this following config does both: look for the customer in the OTRS customer DB and in your LDAP

Code: Select all

    # CustomerUser
    # (customer user database backend and settings)
    $Self->{CustomerUser} = {
        Name   => 'Database Backend',
        Module => 'Kernel::System::CustomerUser::DB',
        Params => {
            Table => 'customer_user',
            DestCharset => 'utf-8',
            SourceCharset => 'utf-8',
        },
        # customer uniq id
        CustomerKey => 'login',

        # customer #
        CustomerID             => 'customer_id',
        CustomerValid          => 'valid_id',
        CustomerUserListFields => [ 'first_name', 'last_name', 'email' ],
        CustomerUserListFields => ['login', 'first_name', 'last_name', 'customer_id', 'email'],
        CustomerUserSearchFields => [ 'login', 'first_name', 'last_name', 'customer_id' ],
        CustomerUserSearchPrefix => '',
        CustomerUserSearchSuffix => '*',
        CustomerUserSearchListLimit => 1000,
        CustomerUserPostMasterSearchFields => ['email'],
        CustomerUserNameFields => [ 'salutation', 'first_name', 'last_name' ],
        #CustomerUserEmailUniqCheck => 1,##

        # show now own tickets in customer panel, CompanyTickets
        #CustomerUserExcludePrimaryCustomerID => 0,
        # generate auto logins
        #AutoLoginCreation => 0,
        # generate auto login prefix
        #AutoLoginCreationPrefix => 'auto',
        # admin can change customer preferences
        #AdminSetPreferences => 1,
        # use customer company support (reference to company, See CustomerCompany settings)
        #CustomerCompanySupport => 1,
        # cache time to life in sec. - cache any database queris
        #CacheTTL => 0,
        # just a read only source
        ReadOnly => 1,
        Map => [

           # note: Login, Email and CustomerID needed!
           # var, frontend, storage, shown (1=always,2=lite), required, storage-type, http-link, readonly, http-link-target
           # [ 'UserSalutation', 'Salutation', 'salutation', 1, 0, 'var', '', 0 ],
            [ 'UserFirstname',  'Firstname',  'first_name',     1, 1, 'var', '', 0 ],
            [ 'UserLastname',   'Lastname',   'last_name',      1, 1, 'var', '', 0 ],
            [ 'UserLogin',      'Username',   'login',          1, 1, 'var', '', 0 ],
           # [ 'UserPassword',   'Password',   'pw',            1, 1, 'var', '', 0 ],
            [ 'UserEmail',      'Email',      'email',          1, 1, 'var', '', 0 ],
            [ 'UserCustomerID', 'CustomerID', 'customer_id',    0, 1, 'var', '', 0 ],
            [ 'UserPhone','Phone',      'phone',                1, 0,'var', '', 0 ],
            [ 'UserMobile',      'Mobile',      'mobile',       1, 0,'var', '', 0 ],          
            # [ 'UserEmail',      'Email', 'email',1, 1, 'var', '', 0 ],       
           # [ 'UserCustomerIDs', 'CustomerIDs', 'customer_ids', 1, 0, 'var', '', 0 ],
           # [ 'UserComment', 'Comment', 'comments', 1, 0, 'var', '', 0 ],
           # [ 'ValidID',     'Valid',   'valid_id', 0, 1, 'int', '', 0 ],
        ],
    };

# ===================================================
# LDAP Customer User Authentication [WF]
# ===================================================

    $Self->{CustomerUser1} = {
        Name => 'Active Directory <holding.ah>',
        Module => 'Kernel::System::CustomerUser::LDAP',
        Params => {
            Host => '<host>',
            BaseDN => 'DC=base,DC=dn',
            SSCOPE => 'sub',
            UserDN => 'CN=otrs,OU=some,DC=your,DC=ort,DC=country',
            UserPw => 'very_secret',
            AlwaysFilter =>  '(&(objectclass=user)(mail=*))',
            DestCharset => 'utf-8',
            SourceCharset => 'utf-8',
            Params => {
                port => 3268,
                timeout => 10,
                async => 0,
                version => 3,
            },
        },
        CustomerKey => 'sAMAccountName',
        CustomerID => 'mail',
        CustomerUserListFields => ['cn', 'mail'],
        CustomerUserSearchFields => ['sAMAccountName', 'cn', 'mail'],
        CustomerUserSearchListLimit => 1000,
        CustomerUserPostMasterSearchFields => ['mail'],
        CustomerUserNameFields => ['givenname', 'sn'],
        CustomerUserExcludePrimaryCustomerID => 0,
        AdminSetPreferences => 0,
        Map => [
           #[ 'UserSalutation', 'Title',      'title',           1, 0, 'var', '', 0 ],
            [ 'UserFirstname',  'Firstname',  'givenname',       1, 1,'var', '', 0 ],
            [ 'UserLastname',   'Lastname',   'sn',              1, 1,'var', '', 0 ],
            [ 'UserLogin',      'Username',   'sAMAccountName',  1, 1,'var', '', 0 ],
            [ 'UserEmail',      'Email',      'mail',            1, 1,'var', '', 0 ],
            [ 'UserCustomerID', 'CustomerID', 'mail',            0, 1,'var', '', 0 ],
            [ 'UserPhone',      'Phone',      'telephoneNumber', 1, 0,'var', '', 0 ],
            [ 'UserMobile',     'Mobile',      'mobile',         1, 0,'var', '', 0 ],
           # [ 'UserAddress',    'Address',    'postaladdress',   1, 0,'var', '', 0 ],
           # [ 'UserComment',    'Comment',    'description',     1, 0,'var', '', 0 ],
        ],
    };

 
  # This is the auth. module against the otrs db
    $Self->{'Customer::AuthModule1'} = 'Kernel::System::CustomerAuth::DB';
    $Self->{'Customer::AuthModule::DB::Table1'} = 'customer_user';
    $Self->{'Customer::AuthModule::DB::CustomerKey1'} = 'login';
    $Self->{'Customer::AuthModule::DB::CustomerPassword1'} = 'pw';
  # This is the auth. module against LDAP
    $Self->{'Customer::AuthModule2'} = 'Kernel::System::CustomerAuth::LDAP';
    $Self->{'Customer::AuthModule::LDAP::Host2'} = 'ldap.host';
    $Self->{'Customer::AuthModule::LDAP::BaseDN2'} = 'DC=base,DC=dn';                                                     
    $Self->{'Customer::AuthModule::LDAP::UID2'} = 'sAMAccountName';
    $Self->{'Customer::AuthModule::LDAP::SearchUserDN2'} = 'CN=otrs,OU=some,DC=your,DC=org,DC=coutry';
    $Self->{'Customer::AuthModule::LDAP::SearchUserPw2'} = 'very_secret';
    $Self->{'Customer::AuthModule::LDAP::AlwaysFilter2'} = '(&(objectclass=user)(mail=*))';
    $Self->{'Customer::AuthModule::LDAP::Params2'} = {
        port => 3268,
        timeout => 10,
        async => 0,
        version => 3,
    };

Hope this helps
Produktiv:
OTRS 6.0.13/ ITSM 6.0.13
OS: SUSE Linux (SLES 12, Leap), MySql 5.5.x, 5.6.x
Windows 2012 AD Integration (agents and customers), Nagios integration (incidents, CMDB), Survey, TimeAccounting
danieldai
Znuny newbie
Posts: 36
Joined: 20 Apr 2011, 05:56
Znuny Version: 3.1.12

Re: Fetch customer info from AD & show in ticket

Post by danieldai »

[quote="Wolfgangf"]this following config does both: look for the customer in the OTRS customer DB and in your LDAP

Thanks first. Our customers don't log in OTRS customer interface to submit ticket. We only receive their emails. So OTRS only knows customer's email address. I am wondering how OTRS can fetch customer info from AD knowing email address only.
OTRS version: 3.1.12
OS: CentOS 5.5
LDAP: Microsoft Active Directory
Mail system: Microsoft Exchange
Wolfgangf
Znuny ninja
Posts: 1029
Joined: 13 Apr 2009, 12:26
Znuny Version: 6.0.13
Real Name: Wolfgang Fürtbauer
Company: PBS Logitek GmbH
Location: Pinsdorf

Re: Fetch customer info from AD & show in ticket

Post by Wolfgangf »

this is also catched by the config above
Produktiv:
OTRS 6.0.13/ ITSM 6.0.13
OS: SUSE Linux (SLES 12, Leap), MySql 5.5.x, 5.6.x
Windows 2012 AD Integration (agents and customers), Nagios integration (incidents, CMDB), Survey, TimeAccounting
danieldai
Znuny newbie
Posts: 36
Joined: 20 Apr 2011, 05:56
Znuny Version: 3.1.12

Re: Fetch customer info from AD & show in ticket

Post by danieldai »

Wolfgangf wrote:this following config does both: look for the customer in the OTRS customer DB and in your LDAP

Code: Select all

    # CustomerUser
    # (customer user database backend and settings)
    $Self->{CustomerUser} = {
        Name   => 'Database Backend',
        Module => 'Kernel::System::CustomerUser::DB',
        Params => {
            Table => 'customer_user',
            DestCharset => 'utf-8',
            SourceCharset => 'utf-8',
        },
        # customer uniq id
        CustomerKey => 'login',

        # customer #
        CustomerID             => 'customer_id',
        CustomerValid          => 'valid_id',
        CustomerUserListFields => [ 'first_name', 'last_name', 'email' ],
        CustomerUserListFields => ['login', 'first_name', 'last_name', 'customer_id', 'email'],
        CustomerUserSearchFields => [ 'login', 'first_name', 'last_name', 'customer_id' ],
        CustomerUserSearchPrefix => '',
        CustomerUserSearchSuffix => '*',
        CustomerUserSearchListLimit => 1000,
        CustomerUserPostMasterSearchFields => ['email'],
        CustomerUserNameFields => [ 'salutation', 'first_name', 'last_name' ],
        #CustomerUserEmailUniqCheck => 1,##

        # show now own tickets in customer panel, CompanyTickets
        #CustomerUserExcludePrimaryCustomerID => 0,
        # generate auto logins
        #AutoLoginCreation => 0,
        # generate auto login prefix
        #AutoLoginCreationPrefix => 'auto',
        # admin can change customer preferences
        #AdminSetPreferences => 1,
        # use customer company support (reference to company, See CustomerCompany settings)
        #CustomerCompanySupport => 1,
        # cache time to life in sec. - cache any database queris
        #CacheTTL => 0,
        # just a read only source
        ReadOnly => 1,
        Map => [

           # note: Login, Email and CustomerID needed!
           # var, frontend, storage, shown (1=always,2=lite), required, storage-type, http-link, readonly, http-link-target
           # [ 'UserSalutation', 'Salutation', 'salutation', 1, 0, 'var', '', 0 ],
            [ 'UserFirstname',  'Firstname',  'first_name',     1, 1, 'var', '', 0 ],
            [ 'UserLastname',   'Lastname',   'last_name',      1, 1, 'var', '', 0 ],
            [ 'UserLogin',      'Username',   'login',          1, 1, 'var', '', 0 ],
           # [ 'UserPassword',   'Password',   'pw',            1, 1, 'var', '', 0 ],
            [ 'UserEmail',      'Email',      'email',          1, 1, 'var', '', 0 ],
            [ 'UserCustomerID', 'CustomerID', 'customer_id',    0, 1, 'var', '', 0 ],
            [ 'UserPhone','Phone',      'phone',                1, 0,'var', '', 0 ],
            [ 'UserMobile',      'Mobile',      'mobile',       1, 0,'var', '', 0 ],          
            # [ 'UserEmail',      'Email', 'email',1, 1, 'var', '', 0 ],       
           # [ 'UserCustomerIDs', 'CustomerIDs', 'customer_ids', 1, 0, 'var', '', 0 ],
           # [ 'UserComment', 'Comment', 'comments', 1, 0, 'var', '', 0 ],
           # [ 'ValidID',     'Valid',   'valid_id', 0, 1, 'int', '', 0 ],
        ],
    };

# ===================================================
# LDAP Customer User Authentication [WF]
# ===================================================

    $Self->{CustomerUser1} = {
        Name => 'Active Directory <holding.ah>',
        Module => 'Kernel::System::CustomerUser::LDAP',
        Params => {
            Host => '<host>',
            BaseDN => 'DC=base,DC=dn',
            SSCOPE => 'sub',
            UserDN => 'CN=otrs,OU=some,DC=your,DC=ort,DC=country',
            UserPw => 'very_secret',
            AlwaysFilter =>  '(&(objectclass=user)(mail=*))',
            DestCharset => 'utf-8',
            SourceCharset => 'utf-8',
            Params => {
                port => 3268,
                timeout => 10,
                async => 0,
                version => 3,
            },
        },
        CustomerKey => 'sAMAccountName',
        CustomerID => 'mail',
        CustomerUserListFields => ['cn', 'mail'],
        CustomerUserSearchFields => ['sAMAccountName', 'cn', 'mail'],
        CustomerUserSearchListLimit => 1000,
        CustomerUserPostMasterSearchFields => ['mail'],
        CustomerUserNameFields => ['givenname', 'sn'],
        CustomerUserExcludePrimaryCustomerID => 0,
        AdminSetPreferences => 0,
        Map => [
           #[ 'UserSalutation', 'Title',      'title',           1, 0, 'var', '', 0 ],
            [ 'UserFirstname',  'Firstname',  'givenname',       1, 1,'var', '', 0 ],
            [ 'UserLastname',   'Lastname',   'sn',              1, 1,'var', '', 0 ],
            [ 'UserLogin',      'Username',   'sAMAccountName',  1, 1,'var', '', 0 ],
            [ 'UserEmail',      'Email',      'mail',            1, 1,'var', '', 0 ],
            [ 'UserCustomerID', 'CustomerID', 'mail',            0, 1,'var', '', 0 ],
            [ 'UserPhone',      'Phone',      'telephoneNumber', 1, 0,'var', '', 0 ],
            [ 'UserMobile',     'Mobile',      'mobile',         1, 0,'var', '', 0 ],
           # [ 'UserAddress',    'Address',    'postaladdress',   1, 0,'var', '', 0 ],
           # [ 'UserComment',    'Comment',    'description',     1, 0,'var', '', 0 ],
        ],
    };

 
  # This is the auth. module against the otrs db
    $Self->{'Customer::AuthModule1'} = 'Kernel::System::CustomerAuth::DB';
    $Self->{'Customer::AuthModule::DB::Table1'} = 'customer_user';
    $Self->{'Customer::AuthModule::DB::CustomerKey1'} = 'login';
    $Self->{'Customer::AuthModule::DB::CustomerPassword1'} = 'pw';
  # This is the auth. module against LDAP
    $Self->{'Customer::AuthModule2'} = 'Kernel::System::CustomerAuth::LDAP';
    $Self->{'Customer::AuthModule::LDAP::Host2'} = 'ldap.host';
    $Self->{'Customer::AuthModule::LDAP::BaseDN2'} = 'DC=base,DC=dn';                                                     
    $Self->{'Customer::AuthModule::LDAP::UID2'} = 'sAMAccountName';
    $Self->{'Customer::AuthModule::LDAP::SearchUserDN2'} = 'CN=otrs,OU=some,DC=your,DC=org,DC=coutry';
    $Self->{'Customer::AuthModule::LDAP::SearchUserPw2'} = 'very_secret';
    $Self->{'Customer::AuthModule::LDAP::AlwaysFilter2'} = '(&(objectclass=user)(mail=*))';
    $Self->{'Customer::AuthModule::LDAP::Params2'} = {
        port => 3268,
        timeout => 10,
        async => 0,
        version => 3,
    };

Hope this helps

After configuring like this, does OTRS import customers from AD automatically so that I can see the customer list in customer panel when I log in as an admin? Will the customer info be displayed on a ticket?
OTRS version: 3.1.12
OS: CentOS 5.5
LDAP: Microsoft Active Directory
Mail system: Microsoft Exchange
Locked