You can use two types of customer backends, DB and LDAP. If you allready have another customer backend (e.g. SAP) it is ofcourse possible to write a module that uses this type of backend.
Example 9.1. Configuring a DB customer backend
This example shows the configuration of a DB customer backend which uses customer data stored in the OTRS database.
# CustomerUser # (customer user database backend and settings) $Self->{CustomerUser} = { Name => 'Datenbank Quelle', Module => 'Kernel::System::CustomerUser::DB', Params => { # if you want to use an external database, add the # required settings # DSN => 'DBI:odbc:yourdsn', # DSN => 'DBI:mysql:database=customerdb;host=customerdbhost', # User => '', # Password => '', Table => 'customer_user', }, # customer uniq id CustomerKey = 'login', # customer # CustomerID = 'customer_id', CustomerValid = 'valid_id', CustomerUserListFields => ['first_name', 'last_name', 'email'], CustomerUserSearchFields => ['login', 'last_name', 'customer_id'], CustomerUserSearchPrefix => '', CustomerUserSearchSuffix => '*', CustomerUserSearchListLimit => 250, 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, # AutoLoginCreationPrefix => 'auto', # # admin can change customer preferences # AdminSetPreferences => 1, # # 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 [ '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', 0, 1, 'var', '', 0 ], [ 'UserEmail', 'Email', 'email', 0, 1, 'var', '', 0 ], # [ 'UserEmail', 'Email', 'email', 1, 1, # 'var','$Env{"CGIHandle"}?Action=AgentTicketCompose&ResponseID=1&TicketID=$Data{"TicketID"}&ArticleID=$Data{"ArticleID"}', 0 ], [ 'UserCustomerID', 'CustomerID', 'customer_id', 0, 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 ], ], # default selections Selections => { UserSalutation => { 'Mr.' => 'Mr.', 'Mrs.' => 'Mrs.', }, }, };
If you want to customize the customer data, change the table columns in the customer_user table in the OTRS database or add new columns. In the following example a new field for phone number is added.
linux:~# mysql -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 116 to server version: 5.0.18-Debian_7-log Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> use otrs; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> ALTER TABLE customer_user ADD phone VARCHAR (250); Query OK, 1 rows affected (0.01 sec) Records: 1 Duplicates: 0 Warnings: 0 mysql> quit Bye linux:~#
Now add the new column to the MAP array in
Kernel/Config.pm
:
# var, frontend, storage, shown (1=always,2=lite), required, storage-type, http-link, readonly [...] [ 'UserPhone', 'Phone', 'phone', 0, 1, 'var', '', 0 ],
Ofcourse it is possible to edit all these customer information via the customer area in the agent interface.
It is possible to assign more than one customer ID to a customer. This can be usefull if a customer must access tickets of other customers, e.g. a supervisor wants to watch the tickets of his assistants. If a customer can access the tickets of another customer user, the company ticket feature of OTRS is used. Company tickets can be accessed via the "Company Ticket" link in the customer panel.
To use company tickets a new column has to be added to the customer_user table in the OTRS database. In this new column the IDs of the customers are stored that tickets need to be accessed.
linux:~# mysql -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 124 to server version: 5.0.18-Debian_7-log Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> use otrs; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> ALTER TABLE customer_user ADD customer_ids VARCHAR (250); Query OK, 1 rows affected (0.02 sec) Records: 1 Duplicates: 0 Warnings: 0 mysql> quit Bye linux:~#
Now the new column has to be added to the MAP array in
Kernel/Config.pm
:
# var, frontend, storage, shown (1=always,2=lite), required, storage-type, http-link, readonly [...] [ 'UserCustomerIDs', 'CustomerIDs', 'customer_ids', 1, 0, 'var', '', 0 ],
The new column for the multi customer IDs can be edited via the agent interface in the section for the customer user management now.
To ensure that one customer can access the tickets of other customer users add the IDs of this other users into the new field for the multible customer IDs. Each ID hast to be seperated by a semicolon.
Example 9.2. Using company tickets with a DB backend
The customers A, B and C exists in your system and A wants to have access to the tickets of B and C via the customer panel. B and C should have no access to the tickets of other users.
To realize this setup change the customer_user table and the mapping in
Kernel/Config.pm
like described above. Then load the
settings for customer A via the customer area in the agent interface or via
the admin area. If the settings are displaied add into the field for
CustomerIDs the values "B;C;".
If you have a LDAP directory with your customer data you can use it as customer backend with OTRS.
Example 9.3. Configuring a LDAP customer backend
This is a example for a customer backend that has stored all customer information in a LDAP directory.
# CustomerUser # (customer user ldap backend and settings) $Self->{CustomerUser} = { Name => 'LDAP Datenquelle', Module => 'Kernel::System::CustomerUser::LDAP', Params => { # ldap host Host => 'bay.csuhayward.edu', # ldap base dn BaseDN => 'ou=seas,o=csuh', # 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 your frontend is e. g. iso-8859-1 and the charset of your # ldap server is utf-8, use this options (if not, ignore it) # SourceCharset => 'utf-8', # DestCharset => 'iso-8859-1', # 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, Map => [ # note: Login, Email and CustomerID needed! # var, frontend, storage, shown (1=always,2=lite), required, storage-type, http-link, readonly [ 'UserSalutation', '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 ], ], };
If additional customer information are stored in your LDAP directory and if you
like to use this information with OTRS also, just expand the MAP array in
Kernel/Config.pm
with the entries for this data.
# var, frontend, storage, shown (1=always,2=lite), required, storage-type, http-link, readonly [...] [ 'UserPhone', 'Phone', 'telephonenumber', 1, 0, 'var', '', 0 ],
It is possible to assign more than one customer ID to a customer. This can be usefull if a customer must access tickets of other customers, e.g. a supervisor wants to watch the tickets of his assistants. If a customer can access the tickets of another customer user, the company ticket feature of OTRS is used. Company tickets can be accessed via the "Company Ticket" link in the customer panel.
Du use company tickets a new field has to be added to the LDAP directory that can contain the entries with the IDs for the customers that tickets should be accessible for a customer user.
If the new field in the LDAP directory has been created the new entry
has to be added to the MAP array in
Kernel/Config.pm
:
# var, frontend, storage, shown (1=always,2=lite), required, storage-type, http-link, readonly [...] [ 'UserCustomerIDs', 'CustomerIDs', 'customer_ids', 1, 0, 'var', '', 0 ],
The field for the multible customer IDs has to be edited directly in the LDAP directory, OTRS can only read from LDAP.
To ensure the access for a customer to the tickets of other customers add the customer IDs of the customers that tickets should be accessed to the new field in your LDAP directory. Each ID has to be seperated by a semicolon.
Example 9.4. Using Company tickets with a LDAP backend
The customers A, B and C exists in your system and A wants to have access to the tickets of B and C via the customer panel. B and C should have no access to tickets of other users.
To realize this setup change the LDAP directory and the mapping in
Kernel/Config.pm
like described above. Then
add into the field for CustomerIDs the values "B;C;" for customer A in your
LDAP directory.
If more than one customer backend with different customer data should be used with OTRS (e.g. a LDAP and a DB backend), the CustomerUser config parameter has to be expanded with a number, e.g. "CustomerUser1", "CustomerUser2".
Example 9.5. Using more than one customer backend with OTRS
The following configuration example shows parallel usage of an LDAP and DB customer backend with OTRS.
# 1. Customer user backend: DB # (customer user database backend and settings) $Self->{CustomerUser1} = { Name => 'Datenbank Quelle', Module => 'Kernel::System::CustomerUser::DB', Params => { # if you want to use an external database, add the # required settings # DSN => 'DBI:odbc:yourdsn', # DSN => 'DBI:mysql:database=customerdb;host=customerdbhost', # User => '', # Password => '', Table => 'customer_user', }, # customer uniq id CustomerKey = 'login', # customer # CustomerID = 'customer_id', CustomerValid = 'valid_id', CustomerUserListFields => ['first_name', 'last_name', 'email'], CustomerUserSearchFields => ['login', 'last_name', 'customer_id'], CustomerUserSearchPrefix => '', CustomerUserSearchSuffix => '*', CustomerUserSearchListLimit => 250, 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, # AutoLoginCreationPrefix => 'auto', # # admin can change customer preferences # AdminSetPreferences => 1, # # 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 [ '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', 0, 1, 'var', '', 0 ], [ 'UserEmail', 'Email', 'email', 0, 1, 'var', '', 0 ], # [ 'UserEmail', 'Email', 'email', 1, 1, # 'var','$Env{"CGIHandle"}?Action=AgentTicketCompose&ResponseID=1&TicketID=$Data{"TicketID"}&ArticleID=$Data{"ArticleID"}', 0 ], [ 'UserCustomerID', 'CustomerID', 'customer_id', 0, 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 ], ], # default selections Selections => { UserSalutation => { 'Mr.' => 'Mr.', 'Mrs.' => 'Mrs.', }, }, }; # 2. Customer user backend: LDAP # (customer user ldap backend and settings) $Self->{CustomerUser2} = { Name => 'LDAP Datenquelle', Module => 'Kernel::System::CustomerUser::LDAP', Params => { # ldap host Host => 'bay.csuhayward.edu', # ldap base dn BaseDN => 'ou=seas,o=csuh', # 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 your frontend is e. g. iso-8859-1 and the charset of your # ldap server is utf-8, use this options (if not, ignore it) # SourceCharset => 'utf-8', # DestCharset => 'iso-8859-1', # 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, Map => [ # note: Login, Email and CustomerID needed! # var, frontend, storage, shown (1=always,2=lite), required, storage-type, http-link, readonly [ 'UserSalutation', '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 ], ], };
It is possible to integrate up to 10 different customer user backends. With the customer user management interface in OTRS all customer data can be viewed or edited (if write access is possible).