OTRS CVS - Manual
Prev | Chapter 10. Customer | Next

# 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'],
            CustomerUserSearchPrefix => '',
            CustomerUserSearchSuffix => '*',
            CustomerUserPostMasterSearchFields => ['email'],
            CustomerUserNameFields => ['salutation', 'first_name', 'last_name'],
    #        AdminSetPreferences => 1,
    #        ReadOnly => 1,
            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', 'Username', '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 CustomerUser MAP array in Kernel/Config.pm 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.

MultiCustomerIDs: It's also possible to have more the one customer id for one customer. E. g. one customer needs to see all ticket from other customers.

Add a new database row and put the customer ids in it (like "CustomerID1, CustomerID2, CustomerID3").

    ALTER TABLE customer_user ADD customer_ids VARCHAR (250);

And add your new column to your CustomerUser MAP array in Kernel/Config.pm like:

                # var, frontend, storage, shown, required, storage-type, http-link
                [ 'UserCustomerIDs', 'CustomerIDs', 'customer_ids', 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 => '',
                # 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 => '',
                # Net::LDAP new params (if needed - for more info see perldoc Net::LDAP)
                Params => {
                    port => 389,
                    version => 3,
                },
            },
            # customer uniq id
            CustomerKey => 'uid',
            # customer #
            CustomerID => 'mail',
            CustomerUserListFields => ['uid', 'cn', 'mail'],
            CustomerUserSearchFields => ['uid', 'cn', 'mail'],
            CustomerUserSearchPrefix => '',
            CustomerUserSearchSuffix => '*',
            CustomerUserPostMasterSearchFields => ['mail'],
            CustomerUserNameFields => ['givenname', 'sn'],
            AdminSetPreferences => 0,
            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', 'Username', '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 CustomerUser MAP array in Kernel/Config.pm like:

                # var, frontend, storage, shown, required, storage-type, http-link
                [ 'UserOrganisation', 'Organisation', 'ou', 1, 0, 'var' ],

MultiCustomerIDs: It's also possible to have more the one customer id for one customer. E. g. one customer needs to see all ticket from other customers.

Just find a field for the customer ids in your ldap tree and put the customer ids in it (like "CustomerID1, CustomerID2, CustomerID3").

And add your new column to your CustomerUser MAP array in Kernel/Config.pm like:

                # var, frontend, storage, shown, required, storage-type, http-link
                [ 'UserCustomerIDs', 'CustomerIDs', 'second_customer_ids', 1, 0, 'var' ],

Of course you will need to put the customer ids in it by your ldap admin.

Prev | Home | Next
Customer | Up | Customer Auth Backend