Customer User Backend

There are two existing customer user backends, DB and LDAP. Of course if you have an existing customer repository (e. g. SAP, ...) it's possible to write an own backend.

Note: It's also possible to define more the one "CustomerUser" config option. You just need to add a number between 1 and 10. For example "CustomerUser1".

Database (default)

This is an example for a database backend.

    [Kernel/Config.pm]
    # CustomerUser 
    # (customer user database backend and settings)
    $Self->{CustomerUser} = {
        Name => 'Database Source',
        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 => ['login', 'first_name', 'last_name', 'email'],
        CustomerUserSearchFields => ['login', 'last_name', 'customer_id'],
        CustomerUserPostMasterSearchFields => ['email'],
        CustomerUserNameFields => ['salutation', 'first_name', 'last_name'],
        Map => [
            # note: Login, Email and CustomerID needed!
            # var, frontend, storage, shown, required, storage-type, http-link
            [ 'UserSalutation', 'Salutation', 'salutation', 1, 0, 'var' ],
            [ 'UserFirstname', 'Firstname', 'first_name', 1, 1, 'var' ],
            [ 'UserLastname', 'Lastname', 'last_name', 1, 1, 'var' ],
            [ 'UserLogin', 'Login', 'login', 1, 1, 'var' ],
            [ 'UserPassword', 'Password', 'pw', 0, 1, 'var' ],
            [ 'UserEmail', 'Email', 'email', 0, 1, 'var' ],
#            [ 'UserEmail', 'Email', 'email', 1, 1, 'var', '$Env{"CGIHandle"}?Action=\
AgentCompose&ResponseID=1&TicketID=$Data{"TicketID"}&ArticleID=$Data{"ArticleID"}' ],
            [ 'UserCustomerID', 'CustomerID', 'customer_id', 0, 1, 'var' ],
            [ 'UserComment', 'Comment', 'comment', 1, 0, 'var' ],
            [ 'ValidID', 'Valid', 'valid_id', 0, 1, 'int' ],
        ],
    };
    [...]

If you want to customize your customer user information, change (add) you table columns e. g.
ALTER TABLE customer_user ADD phone VARCHAR (250);
And add your new column to your MAP array like:
            # var, frontend, storage, shown, required, storage-type, http-link
            [ 'UserPhone', 'Phone', 'phone', 1, 0, 'var' ],
Of course you will be able to maintain all this customer user information via the Admin-Interface.

LDAP

If you have an existing LDAP tree with your customer users then you will be able to use this LDAP tree in your OTRS system.

This is an example for a LDAP backend.
    [Kernel/Config.pm]
    # CustomerUser 
    # (customer user ldap backend and settings)
    $Self->{CustomerUser} = {
        Name => 'LDAP 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 => '',
        }, 
        # customer uniq id
        CustomerKey => 'uid',
        # customer #
        CustomerID => 'mail',
        CustomerUserListFields => ['uid', 'cn', 'mail'],
        CustomerUserSearchFields => ['uid', 'cn', 'mail'],
        CustomerUserPostMasterSearchFields => ['mail'],
        CustomerUserNameFields => ['givenname', 'sn'],
        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', 'uid', 1, 1, 'var' ],
            [ 'UserEmail', 'Email', 'mail', 1, 1, 'var' ],
            [ 'UserCustomerID', 'CustomerID', 'mail', 0, 1, 'var' ],
            [ 'UserPhone', 'Phone', 'telephonenumber', 1, 0, 'var' ],
            [ 'UserAddress', 'Address', 'postaladdress', 1, 0, 'var' ],
            [ 'UserComment', 'Comment', 'description', 1, 0, 'var' ],
        ],
    };
    [...]

If you want to customize your customer user information, add your new item (or remove it if not needed) to your MAP array like:
            # var, frontend, storage, shown, required, storage-type, http-link
            [ 'UserOrganisation', 'Organisation', 'ou', 1, 0, 'var' ],