OTRS会使用许多客户数据属性如用户名、邮件地址、电话号码等等,这些属性在服务人员和客户前端界面都会显示,还用于客户的身份验证。
在OTRS中使用或显示的客户数据是高度可定制的,但下面的信息始终需要用于客户身份验证:
用户登录名
电子邮件地址
客户ID
如果你要在服务人员界面显示客户信息,使用下面的系统配置参数。
# Ticket::Frontend::CustomerInfo* # (在编写电话/邮件工单、工单详情和队列视图屏幕显示客户信息) $Self->{'Ticket::Frontend::CustomerInfoCompose'} = 1; $Self->{'Ticket::Frontend::CustomerInfoZoom'} = 1;
脚本:系统配置参数
你可以使用两种类型的客户后端:DB和LDAP。如果你已经有另外的客户后端(如SAP),当然可用写一个模块来使用它。
下面的示例显示一个客户数据库后端的配置,使用了存储在OTRS数据库中的客户数据。
例 4.7. 配置客户的数据库后端
# CustomerUser (customer database backend and settings) $Self->{CustomerUser} = { Name => 'Database Datasource', Module => 'Kernel::System::CustomerUser::DB', Params => { # if you want to use an external database, add the required settings # DSN => 'DBI:odbc:yourdsn', # Type => 'mssql', # only for ODBC connections # DSN => 'DBI:mysql:database=customerdb;host=customerdbhost', # User => '', # Password => '', Table => 'customer_user', # CaseSensitive will control if the SQL statements need LOWER() # function calls to work case insensitively. Setting this to # 1 will improve performance dramatically on large databases. CaseSensitive => 0, }, # customer unique 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 => ['title','first_name','last_name'], CustomerUserEmailUniqCheck => 1, # # show not own tickets in customer panel, CompanyTickets # CustomerUserExcludePrimaryCustomerID => 0, # # generate auto logins # AutoLoginCreation => 0, # AutoLoginCreationPrefix => 'auto', # # admin can change customer preferences # AdminSetPreferences => 1, # # cache time to live in sec. - cache any database queries # 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, link class(es) [ 'UserTitle', 'Title', 'title', 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, 0, 'var', '', 0 ], [ 'UserEmail', 'Email', 'email', 1, 1, 'var', '', 0 ], # [ 'UserEmail', Translatable('Email'), 'email', 1, 1, 'var', '[% Env("CGIHandle") %]?Action=AgentTicketCompose;ResponseID=1;TicketID=[% Data.TicketID | uri %];ArticleID=[% Data.ArticleID | uri %]', 0, '', 'AsPopup OTRSPopup_TicketAction' ], [ 'UserCustomerID', 'CustomerID', 'customer_id', 0, 1, 'var', '', 0 ], # [ 'UserCustomerIDs', 'CustomerIDs', 'customer_ids', 1, 0, 'var', '', 0 ], [ 'UserPhone', 'Phone', 'phone', 1, 0, 'var', '', 0 ], [ 'UserFax', 'Fax', 'fax', 1, 0, 'var', '', 0 ], [ 'UserMobile', 'Mobile', 'mobile', 1, 0, 'var', '', 0 ], [ 'UserStreet', 'Street', 'street', 1, 0, 'var', '', 0 ], [ 'UserZip', 'Zip', 'zip', 1, 0, 'var', '', 0 ], [ 'UserCity', 'City', 'city', 1, 0, 'var', '', 0 ], [ 'UserCountry', 'Country', 'country', 1, 0, 'var', '', 0 ], [ 'UserComment', 'Comment', 'comments', 1, 0, 'var', '', 0 ], [ 'ValidID', 'Valid', 'valid_id', 0, 1, 'int', '', 0 ], # Dynamic field example # [ 'DynamicField_Name_X', undef, 'Name_X', 0, 0, 'dynamic_field', undef, 0, undef, undef, ], ], # default selections Selections => { UserTitle => { 'Mr.' => 'Mr.', 'Mrs.' => 'Mrs.', }, }, };
如果你要定制客户数据,修改OTRS数据库中customer_user表的列标题或添加一个新列。作为一个示例,下面的脚本显示了如果添加一个房间号的新列。
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 room VARCHAR (250); Query OK, 1 rows affected (0.01 sec) Records: 1 Duplicates: 0 Warnings: 0 mysql> quit Bye linux:~#
脚本:添加一个房间字段到customer_user表。
现在添加新列到文件Kernel/Config.pm
中的MAP数组,如下面的脚本所示。
# var, frontend, storage, shown (1=always,2=lite), required, storage-type, http-link, readonly, http-link-target, link class(es) [...] [ 'UserRoom', 'Room', 'room', 0, 1, 'var', '', 0 ],
脚本:添加一个房间列到Kernel/Config.pm文件。
还可以在服务人员界面通过客户链接编辑所有的客户信息。
请注意,您可以忽略在映射中的数组元素http-link-target
和link
class
键,如果他们不被使用。
这些键分别将target=""
和class=""
属性添加到HTTP链接元素。
如果没有设置http-link
,则忽略它们。
给一个客户分配多个ID是可能的。这在一个客户必须访问另一个客户的工单时很有用,例如:一名主管想关注他的助手的工单。如果一个客户能够访问另一个客户的工单,需要使用OTRS的单位工单功能。可通过客户界面的“单位工单”链接来访问单位工单。
要使用单位工单,必须在OTRS数据库中的customer_user表中添加一个可以被客户访问的ID的新列,请参阅下面的脚本。
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:~#
脚本:给customer_user表添加一个customer_ids列。
现在必须将新列添加到文件Kernel/Config.pm
中的MAP数组,如下面的脚本所示。
# var, frontend, storage, shown (1=always,2=lite), required, storage-type, http-link, readonly, http-link-target, link class(es) [...] [ 'UserCustomerIDs', 'CustomerIDs', 'customer_ids', 1, 0, 'var', '', 0 ],
脚本:在文件Kernel/Config.pm中添加UserCustomerIDs列。
现在,这个用于多个客户ID的新列能够通过服务人员界面客户管理部分进行编辑。
要确保一个客户能够访问其它客户的工单,将其它客户的ID添加到这个新列,每个ID要用分号分隔(见下面的示例)。
例 4.8. 通过数据库后端使用单位工单
系统中有客户A、B和C,A想要通过客户界面访问B和C的工单,B和C不能访问其他人的工单。
要实现这个设置,修改表customer_user并按以上描述修改文件Kernel/Config.pm
中的映射。然后在服务人员界面中或者通过系统管理页面载入客户A的设置,设置显示出来后,将CustomerIDs字段输入值“B;C;”。
如果你有一个客户数据的LDAP目录,你可以用它作为OTRS的客户后端,如下面的例子所示。
例 4.9. 配置一个LDAP客户后端
# CustomerUser # (customer ldap backend and settings) $Self->{CustomerUser} = { Name => 'LDAP Data Source', 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 the charset of your ldap server is iso-8859-1, use this: # SourceCharset => '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 unique id CustomerKey => 'uid', # customer # CustomerID => 'mail', CustomerUserListFields => ['cn', 'mail'], CustomerUserSearchFields => ['uid', 'cn', 'mail'], CustomerUserSearchPrefix => '', CustomerUserSearchSuffix => '*', CustomerUserSearchListLimit => 250, 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, http-link-target, link class(es) [ '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 ], ], };
如果你的LDAP目录存储有附加的客户信息如经理的姓名、手机号或部分,并且你想在OTRS中显示这些信息,只需用这些属性条目扩展文件Kernel/Config.pm
中的MAP数组即可,如下面的脚本所示。
# var, frontend, storage, shown (1=always,2=lite), required, storage-type, http-link, readonly, http-link-target, link class(es) [...] [ 'UserPhone', 'Phone', 'telephonenumber', 1, 0, 'var', '', 0 ],
脚本:添加新的字段到 Kernel/Config.pm文件。
使用LDAP后端时同样可以给一个客户分配多个ID。要使用单位工单,需要在LDAP中添加一个新的字段以包含其它客户的ID。
如果这个新的字段已经在LDAP目录中创建成功,必须将新的条目添加到文件Kernel/Config.pm
的MAP数组中,如下面的脚本所示。
# var, frontend, storage, shown (1=always,2=lite), required, storage-type, http-link, readonly [...] [ 'UserCustomerIDs', 'CustomerIDs', 'customer_ids', 1, 0, 'var', '', 0 ],
脚本:映射新的字段到 Kernel/Config.pm文件中。
用于多ID的字段必须在LDAP目录中直接编辑。OTRS只能从LDAP读取数据,而不能写入数据。
要确保一个客户能够访问其它客户的工单,将其它客户的ID添加到这个在LDAP中的新字段,每个ID要用分号分隔(见下面的示例)。
例 4.10. 通过LDAP后端使用单位工单
系统中有客户A、B和C,A想要通过客户界面访问B和C的工单,B和C不能访问其他人的工单。
要实现这个设置,按上述方法修改LDAP目录和文件Kernel/Config.pm
中的映射。然后在LDAP目录中为客户A的新字段输入值“B;C;”。
如果你要在OTRS中利用多个客户数据源(例如:一个LDAP和一个数据库后端),配置参数CustomerUser的后面要加个数字后缀,如“CustomerUser1”、“CustomerUser2”(见下面的示例)。
例 4.11. 在OTRS中利用多个客户数据后端
下面的配置示例显示了OTRS中使用一个LDAP和一个数据库后端的用法。
# 1. Customer user backend: DB # (customer database backend and settings) $Self->{CustomerUser1} = { Name => 'Customer Database', Module => 'Kernel::System::CustomerUser::DB', Params => { # if you want to use an external database, add the # required settings # DSN => 'DBI:odbc:yourdsn', # Type => 'mssql', # only for ODBC connections # DSN => 'DBI:mysql:database=customerdb;host=customerdbhost', # User => '', # Password => '', Table => 'customer_user', }, # customer unique 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 => ['title','first_name','last_name'], CustomerUserEmailUniqCheck => 1, # # show not own tickets in customer panel, CompanyTickets # CustomerUserExcludePrimaryCustomerID => 0, # # generate auto logins # AutoLoginCreation => 0, # AutoLoginCreationPrefix => 'auto', # # admin can change customer preferences # AdminSetPreferences => 1, # # cache time to live in sec. - cache any database queries # 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 [ 'UserTitle', 'Title', 'title', 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, 0, 'var', '', 0 ], [ 'UserEmail', 'Email', 'email', 1, 1, 'var', '', 0 ], [ 'UserCustomerID', 'CustomerID', 'customer_id', 0, 1, 'var', '', 0 ], [ 'UserPhone', 'Phone', 'phone', 1, 0, 'var', '', 0 ], [ 'UserFax', 'Fax', 'fax', 1, 0, 'var', '', 0 ], [ 'UserMobile', 'Mobile', 'mobile', 1, 0, 'var', '', 0 ], [ 'UserStreet', 'Street', 'street', 1, 0, 'var', '', 0 ], [ 'UserZip', 'Zip', 'zip', 1, 0, 'var', '', 0 ], [ 'UserCity', 'City', 'city', 1, 0, 'var', '', 0 ], [ 'UserCountry', 'Country', 'country', 1, 0, 'var', '', 0 ], [ 'UserComment', 'Comment', 'comments', 1, 0, 'var', '', 0 ], [ 'ValidID', 'Valid', 'valid_id', 0, 1, 'int', '', 0 ], ], # default selections Selections => { UserTitle => { 'Mr.' => 'Mr.', 'Mrs.' => 'Mrs.', }, }, }; # 2. Customer user backend: LDAP # (customer ldap backend and settings) $Self->{CustomerUser2} = { Name => 'LDAP Datasource', 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 the charset of your ldap server is iso-8859-1, use this: # SourceCharset => '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 unique id CustomerKey => 'uid', # customer # CustomerID => 'mail', CustomerUserListFields => ['cn', 'mail'], CustomerUserSearchFields => ['uid', 'cn', 'mail'], CustomerUserSearchPrefix => '', CustomerUserSearchSuffix => '*', CustomerUserSearchListLimit => 250, CustomerUserPostMasterSearchFields => ['mail'], CustomerUserNameFields => ['givenname', 'sn'], # show not own tickets in customer panel, CompanyTickets CustomerUserExcludePrimaryCustomerID => 0, # add a ldap filter for valid users (expert setting) # CustomerUserValidFilter => '(!(description=locked))', # 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 [ '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 ], ], };
最多可以集成10个不同的客户数据后端,在OTRS中使用客户管理界面来查看或编辑(需要写入权限)所有的客户数据。
有些时候在工单中直接存储客户用户数据也是很有用的,例如在这些数据上创建一些特殊的统计。
当创建一个工单或修改了工单的客户时设置动态字段的值。动态字段的值来源于客户数据,这适用于所有的客户数据后端,但对LDAP后端特别有用。
要激活OTRS的这个可选功能,请激活设置 Ticket :: EventModulePost ###
950-DynamicFieldFromCustomerUser
和
DynamicFieldFromCustomerUser :: Mapping
。
后一个设置包含应该在哪个工单动态字段中存储 CustomerUser
字段条目的配置。
这些字段必须存在于系统中,并且应启用 AgentTicketFreeText(服务人员工单自定义字段)
,以便可以手动设置。
不能启用AgentTicketPhone
、AgentTicketEmail
和AgentTicketCustomer
。
如果启用了它们,它们将优先于自动设置的值。
OTRS提供了不同的服务人员和客户身份认证后端。
如果你所有的服务人员数据存储在LDAP目录中,你可以使用LDAP模块来对OTRS中的用户进行身份认证(见下面例子)。这个模块只对LDAP树有读取权限,这意味着你不能通过服务人员管理界面来编辑用户数据。
例 4.13. 使用LDAP后端认证服务人员
# This is an example configuration for an LDAP auth. backend. # (Make sure Net::LDAP is installed!) $Self->{'AuthModule'} = 'Kernel::System::Auth::LDAP'; $Self->{'AuthModule::LDAP::Host'} = 'ldap.example.com'; $Self->{'AuthModule::LDAP::BaseDN'} = 'dc=example,dc=com'; $Self->{'AuthModule::LDAP::UID'} = 'uid'; # Check if the user is allowed to auth in a posixGroup # (e. g. user needs to be in a group xyz to use otrs) $Self->{'AuthModule::LDAP::GroupDN'} = 'cn=otrsallow,ou=posixGroups,dc=example,dc=com'; $Self->{'AuthModule::LDAP::AccessAttr'} = 'memberUid'; # for ldap posixGroups objectclass (just uid) # $Self->{'AuthModule::LDAP::UserAttr'} = 'UID'; # for non ldap posixGroups objectclass (with full user dn) # $Self->{'AuthModule::LDAP::UserAttr'} = 'DN'; # The following is valid but would only be necessary if the # anonymous user do NOT have permission to read from the LDAP tree $Self->{'AuthModule::LDAP::SearchUserDN'} = ''; $Self->{'AuthModule::LDAP::SearchUserPw'} = ''; # in case you want to add always one filter to each ldap query, use # this option. e. g. AlwaysFilter => '(mail=*)' or AlwaysFilter => '(objectclass=user)' $Self->{'AuthModule::LDAP::AlwaysFilter'} = ''; # in case you want to add a suffix to each login name, then # you can use this option. e. g. user just want to use user but # in your ldap directory exists user@domain.com # $Self->{'AuthModule::LDAP::UserSuffix'} = '@domain.com'; # Net::LDAP new params (if needed - for more info see perldoc Net::LDAP) $Self->{'AuthModule::LDAP::Params'} = { port => 389, timeout => 120, async => 0, version => 3, };
下面脚本中显示的配置参数可用来从LDAP目录同步用户数据到本地OTRS数据库。这减少了到LDAP的请求时间,加快了OTRS身份认证的速度。当服务人员首次认证后就会完成数据同步。虽然数据已经同步到本地的OTRS数据库,但LDAP目录是身份认证的最后实例,所以一个在LDAP中非活动的用户是不能通过OTRS认证的,即使帐户数据已经存储到OTRS数据库中。不能通过OTRS的WEB界面编辑LDAP中的服务人员数据,所以需要直接在LDAP目录中管理这些数据。
# defines AuthSyncBackend (AuthSyncModule) for AuthModule # if this key exists and is empty, there won't be a sync. # example values: AuthSyncBackend, AuthSyncBackend2 $Self->{'AuthModule::UseSyncBackend'} = 'AuthSyncBackend'; # agent data sync against ldap $Self->{'AuthSyncModule'} = 'Kernel::System::Auth::Sync::LDAP'; $Self->{'AuthSyncModule::LDAP::Host'} = 'ldap://ldap.example.com/'; $Self->{'AuthSyncModule::LDAP::BaseDN'} = 'dc=otrs, dc=org'; $Self->{'AuthSyncModule::LDAP::UID'} = 'uid'; $Self->{'AuthSyncModule::LDAP::SearchUserDN'} = 'uid=sys, ou=user, dc=otrs, dc=org'; $Self->{'AuthSyncModule::LDAP::SearchUserPw'} = 'some_pass'; $Self->{'AuthSyncModule::LDAP::UserSyncMap'} = { # DB -> LDAP UserFirstname => 'givenName', UserLastname => 'sn', UserEmail => 'mail', }; [...] # AuthSyncModule::LDAP::UserSyncInitialGroups # (sync following group with rw permission after initial create of first agent # login) $Self->{'AuthSyncModule::LDAP::UserSyncInitialGroups'} = [ 'users', ];
脚本:同步LDAP目录中的用户数据到OTRS数据库。
做为选择,你可以使用LDAP组信息来确定OTRS中的组成员或角色。更多的信息和示例,请查看Kernel/Config/Defaults.pm
,这里有一个同步LDAP组信息到OTRS组的例子。
# Attributes needed for group syncs # (attribute name for group value key) $Self->{'AuthSyncModule::LDAP::AccessAttr'} = 'memberUid'; # (select the attribute for type of group content UID/DN for full ldap name) # $Self->{'AuthSyncModule::LDAP::UserAttr'} = 'UID'; # $Self->{'AuthSyncModule::LDAP::UserAttr'} = 'DN'; AuthSyncModule::LDAP::UserSyncGroupsDefinition # (If "LDAP" was selected for AuthModule and you want to sync LDAP # groups to otrs groups, define the following.) $Self->{'AuthSyncModule::LDAP::UserSyncGroupsDefinition'} = { # your ldap group 'cn=agent,o=otrs' => { # otrs group(s) 'admin' => { # permission rw => 1, ro => 1, }, 'faq' => { rw => 0, ro => 1, }, }, 'cn=agent2,o=otrs' => { 'users' => { rw => 1, ro => 1, }, } };
如果你要为所有的服务人员部署一套“单点登录”解决方案,可以使用HTTP基本认证(对所有需要单点登录的系统)和OTRS的HTTPBasicAuth模块(见下面的例子)。
例 4.14. 使用HTTPBasic认证服务人员
# This is an example configuration for an apache ($ENV{REMOTE_USER}) # auth. backend. Use it if you want to have a singe login through # apache http-basic-auth $Self->{'AuthModule'} = 'Kernel::System::Auth::HTTPBasicAuth'; # Note: # # If you use this module, you should use as fallback # the following configuration settings if the user is not authorized # apache ($ENV{REMOTE_USER}) $Self->{LoginURL} = 'http://host.example.com/not-authorised-for-otrs.html'; $Self->{LogoutURL} = 'http://host.example.com/thanks-for-using-otrs.html';
OTRS中客户身份认证后端默认是OTRS数据库,可以通过OTRS的WEB界面编辑所有的客户数据(见下面的例子)。
例 4.16. 用数据库后端认证客户用户
# This is the auth. module against the otrs db $Self->{'Customer::AuthModule'} = 'Kernel::System::CustomerAuth::DB'; $Self->{'Customer::AuthModule::DB::Table'} = 'customer_user'; $Self->{'Customer::AuthModule::DB::CustomerKey'} = 'login'; $Self->{'Customer::AuthModule::DB::CustomerPassword'} = 'pw'; #$Self->{'Customer::AuthModule::DB::DSN'} = "DBI:mysql:database=customerdb;host=customerdbhost"; #$Self->{'Customer::AuthModule::DB::User'} = "some_user"; #$Self->{'Customer::AuthModule::DB::Password'} = "some_password";
如果你所有的客户数据在LDAP目录中,可以使用OTRS的LDAP模块来认证你的客户(见下面的例子)。因为这个模块只有LDAP后端的只读权限,所以不能通过OTRS的WEB界面编辑客户数据。
例 4.17. 用LDAP后端认证客户用户
# This is an example configuration for an LDAP auth. backend. # (make sure Net::LDAP is installed!) $Self->{'Customer::AuthModule'} = 'Kernel::System::CustomerAuth::LDAP'; $Self->{'Customer::AuthModule::LDAP::Host'} = 'ldap.example.com'; $Self->{'Customer::AuthModule::LDAP::BaseDN'} = 'dc=example,dc=com'; $Self->{'Customer::AuthModule::LDAP::UID'} = 'uid'; # Check if the user is allowed to auth in a posixGroup # (e. g. user needs to be in a group xyz to use otrs) $Self->{'Customer::AuthModule::LDAP::GroupDN'} = 'cn=otrsallow,ou=posixGroups,dc=example,dc=com'; $Self->{'Customer::AuthModule::LDAP::AccessAttr'} = 'memberUid'; # for ldap posixGroups objectclass (just uid) $Self->{'Customer::AuthModule::LDAP::UserAttr'} = 'UID'; # for non ldap posixGroups objectclass (full user dn) #$Self->{'Customer::AuthModule::LDAP::UserAttr'} = 'DN'; # The following is valid but would only be necessary if the # anonymous user does NOT have permission to read from the LDAP tree $Self->{'Customer::AuthModule::LDAP::SearchUserDN'} = ''; $Self->{'Customer::AuthModule::LDAP::SearchUserPw'} = ''; # in case you want to add always one filter to each ldap query, use # this option. e. g. AlwaysFilter => '(mail=*)' or AlwaysFilter => '(objectclass=user)' $Self->{'Customer::AuthModule::LDAP::AlwaysFilter'} = ''; # in case you want to add a suffix to each customer login name, then # you can use this option. e. g. user just want to use user but # in your ldap directory exists user@domain.com #$Self->{'Customer::AuthModule::LDAP::UserSuffix'} = '@domain.com'; # Net::LDAP new params (if needed - for more info see perldoc Net::LDAP) $Self->{'Customer::AuthModule::LDAP::Params'} = { port => 389, timeout => 120, async => 0, version => 3, };
如果你要为所有的客户用户部署一套“单点登录”解决方案,可以使用HTTP基本认证(对所有需要单点登录的系统)和OTRS的HTTPBasicAuth模块(客户使用OTRS不再需要登录),见下面的例子。
例 4.18. 为客户用户配置HTTP基本认证
# This is an example configuration for an apache ($ENV{REMOTE_USER}) # auth. backend. Use it if you want to have a singe login through # apache http-basic-auth $Self->{'Customer::AuthModule'} = 'Kernel::System::CustomerAuth::HTTPBasicAuth'; # Note: # If you use this module, you should use the following # config settings as fallback, if user isn't login through # apache ($ENV{REMOTE_USER}) $Self->{CustomerPanelLoginURL} = 'http://host.example.com/not-authorised-for-otrs.html'; $Self->{CustomerPanelLogoutURL} = 'http://host.example.com/thanks-for-using-otrs.html';
下面例子中显示的配置参数使用一个Radius服务器来认证客户。
例 4.19. 使用一个Radius后端的客户用户身份认证
# This is a example configuration to auth. customer against a radius server $Self->{'Customer::AuthModule'} = 'Kernel::System::Auth::Radius'; $Self->{'Customer::AuthModule::Radius::Host'} = 'radiushost'; $Self->{'Customer::AuthModule::Radius::Password'} = 'radiussecret';
可以定制新的客户通过customer.pl面板访问的自助注册。可以添加新的可选或必填字段如房间号、地址或状态等。
下面的例子显示了如何在客户数据库中指定一个必填字段,在这个例子中是存储客户的房间号。
要在WEB界面customer.pl中显示新的房间号字段,必须修改界面布局的.tt文件。编辑Kernel/Output/HTML/Templates/Standard/CustomerLogin.tt
文件,在130行附近添加新字段的内容(见下面的脚本)。
[...] <div class="NewLine"> <label for="Room">[% Translate("Room{CustomerUser}") | html %]</label> <input title="[% Translate("Room Number") | html %]" name="Room" type="text" id="UserRoom" maxlength="50" /> </div> [...]
脚本:在WEB界面显示一个新字段。
下一步用新的房间号条目扩展客户映射。为确保OTRS更新后不会丢失自定义的修改内容,将“CustomerUser”设置从文件Kernel/Config/Defaults.pm
放到文件Kernel/Config.pm
中。现在修改MAP数组并添加新的房间号字段,如下面脚本所示。
# CustomerUser # (customer database backend and settings) $Self->{CustomerUser} = { Name => 'Database Backend', Module => 'Kernel::System::CustomerUser::DB', Params => { # if you want to use an external database, add the # required settings # DSN => 'DBI:odbc:yourdsn', # Type => 'mssql', # only for ODBC connections # DSN => 'DBI:mysql:database=customerdb;host=customerdbhost', # User => '', # Password => '', Table => 'customer_user', }, # customer unique 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', 'last_name', 'customer_id'], CustomerUserSearchPrefix => '', CustomerUserSearchSuffix => '*', CustomerUserSearchListLimit => 250, CustomerUserPostMasterSearchFields => ['email'], CustomerUserNameFields => ['title', 'first_name', 'last_name'], CustomerUserEmailUniqCheck => 1, # # show not own tickets in customer panel, CompanyTickets # CustomerUserExcludePrimaryCustomerID => 0, # # generate auto logins # AutoLoginCreation => 0, # AutoLoginCreationPrefix => 'auto', # # admin can change customer preferences # AdminSetPreferences => 1, # # cache time to live in sec. - cache database queries # 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 [ 'UserTitle', 'Title', 'title', 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, 0, 'var', '', 0 ], [ 'UserEmail', 'Email', 'email', 1, 1, 'var', '', 0 ], [ 'UserCustomerID', 'CustomerID', 'customer_id', 0, 1, 'var', '', 0 ], [ 'UserPhone', 'Phone', 'phone', 1, 0, 'var', '', 0 ], [ 'UserFax', 'Fax', 'fax', 1, 0, 'var', '', 0 ], [ 'UserMobile', 'Mobile', 'mobile', 1, 0, 'var', '', 0 ], [ 'UserRoom', 'Room', 'room', 1, 0, 'var', '', 0 ], [ 'UserStreet', 'Street', 'street', 1, 0, 'var', '', 0 ], [ 'UserZip', 'Zip', 'zip', 1, 0, 'var', '', 0 ], [ 'UserCity', 'City', 'city', 1, 0, 'var', '', 0 ], [ 'UserCountry', 'Country', 'country', 1, 0, 'var', '', 0 ], [ 'UserComment', 'Comment', 'comments', 1, 0, 'var', '', 0 ], [ 'ValidID', 'Valid', 'valid_id', 0, 1, 'int', '', 0 ], ], # default selections Selections => { UserTitle => { 'Mr.' => 'Mr.', 'Mrs.' => 'Mrs.', }, }, };
脚本:修改映射数组。
最后一步是将新的房间号列添加到OTRS数据库(见下面的脚本)。这个列会存储房间号信息。
linux:~# mysql -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 6 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 room VARCHAR (200); Query OK, 3 rows affected (0.01 sec) Records: 3 Duplicates: 0 Warnings: 0 mysql> quit Bye linux:~#
脚本: 添加一个新列到customer_user表。
现在新的房间字段(若填写了)会在客户信息面板中显示,在客户管理屏幕也会显示。另外,新的客户在注册新帐户时应该输入他们的房间号。