changing customer id ldap

Moderator: crythias

Locked
ricardobarrosozcr
Znuny newbie
Posts: 13
Joined: 19 Jul 2013, 20:25
Znuny Version: 3.2.9
Real Name: Ricardo Barroso
Company: ZCR

changing customer id ldap

Post by ricardobarrosozcr »

Gentlemen, I have a question regarding the CustomerID field via LDAP.

By default configuration feeds the CustomerID field with the attribute 'mail' LDAP.

I would like this field was fed with the attribute 'Company' LDAP. Just in time to send relarórios I do filtering by Customer ID.

I changed the field (CustomerID => 'mail') to (CustomerID => 'company') in OTRS Config.pm but still feeding the CustomerID field with the attribute 'mail' LDAP.

I hope to enlist the help of lords.

Sincerely.

Code: Select all

# --
# Kernel/Config.pm - Config file for OTRS kernel
# Copyright (C) 2001-2013 xxx, http://otrs.org/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --
# Note:
#
# -->> Most OTRS configuration should be done via the OTRS web interface
# and the SysConfig. Only for some configuration, such as database
# credentials and customer data source changes, you should edit this
# file. For changes do customer data sources you can copy the definitions
# from Kernel/Config/Defaults.pm and paste them in this file.
# Config.pm will not be overwritten when updating OTRS.
# --

package Kernel::Config;

use strict;
use warnings;
use utf8;

sub Load {
 my $Self = shift;

 # ---------------------------------------------------- #
 # database settings #
 # ---------------------------------------------------- #

 # The database host
 $Self->{'DatabaseHost'} = 'localhost';

 # The database name
 $Self->{'Database'} = 'otrs';

 # The database user
 $Self->{'DatabaseUser'} = 'otrs';

 # The password of database user. You also can use bin/otrs.CryptPassword.pl
 # for crypted passwords
 $Self->{'DatabasePw'} = 'it@c@re43@';

 # The database DSN for MySQL ==> more: "perldoc DBD::mysql"
 $Self->{DatabaseDSN} = "DBI:mysql:database=$Self->{Database};host=$Self->{DatabaseHost};";

 # The database DSN for PostgreSQL ==> more: "perldoc DBD::Pg"
 # if you want to use a local socket connection
# $Self->{DatabaseDSN} = "DBI:Pg:dbname=$Self->{Database};";
 # if you want to use a TCP/IP connection
# $Self->{DatabaseDSN} = "DBI:Pg:dbname=$Self->{Database};host=$Self->{DatabaseHost};";
 # if you have PostgresSQL 8.1 or earlier, activate the legacy driver with this line:
# $Self->{DatabasePostgresqlBefore82} = 1;

 # The database DSN for Microsoft SQL Server - only supported if OTRS is
 # installed on Windows as well
# $Self->{DatabaseDSN} = "DBI:ODBC:driver={SQL Server};Database=$Self->{Database};Server=$Self->{DatabaseHost},1433";

 # The database DSN for Oracle ==> more: "perldoc DBD::oracle"
# $ENV{ORACLE_HOME} = '/u01/app/oracle/product/10.2.0/client_1';
# $ENV{NLS_DATE_FORMAT} = 'YYYY-MM-DD HH24:MI:SS';
# $ENV{NLS_LANG} = "american_america.utf8";

# $Self->{DatabaseDSN} = "DBI:Oracle:sid=OTRS;host=$Self->{DatabaseHost};port=1522;";

 # ---------------------------------------------------- #
 # fs root directory
 # ---------------------------------------------------- #
 $Self->{Home} = '/opt/otrs';


 
# ---------------------------------------------------- #
 # insert your own config settings "here" #
 # config settings taken from Kernel/Config/Defaults.pm #
 # ---------------------------------------------------- #
 # $Self->{SessionUseCookie} = 0;
 # $Self->{CheckMXRecord} = 0;

 # ---------------------------------------------------- #

 # ---------------------------------------------------- #
 # data inserted by installer #
 # ---------------------------------------------------- #
 # $DIBI$

 # ---------------------------------------------------- #
 # ---------------------------------------------------- #
 # #
 # end of your own config options!!! #
 # #
 # ---------------------------------------------------- #
 # ---------------------------------------------------- #
 

#Autenticação LDAP #Enable para os clientes / usuários
 $Self->{'Customer::AuthModule'} = 'Kernel::System::CustomerAuth::LDAP';
 $Self->{'Customer::AuthModule::LDAP::Host'} = 'srv-dc00.zcr.com.br';
 $Self->{'Customer::AuthModule::LDAP::BaseDN'} = 'ou=SEDE,dc=zcr,dc=com,dc=br';
 $Self->{'Customer::AuthModule::LDAP::UID'} = 'sAMAccountName';

# O seguinte é válido, mas somente seria necessário se o
# usuário anônimo não tem permissão para ler da árvore LDAP
 $Self->{'Customer::AuthModule::LDAP::SearchUserDN'} = 'otrs';
 $Self->{'Customer::AuthModule::LDAP::SearchUserPw'} = 'senha;

#CustomerUser
 #(cliente backend de banco de dados de usuário e configurações)
 $Self->{CustomerUser} = {
 Module => 'Kernel::System::CustomerUser::LDAP',
 Params => {
 port => '389',
 timeout => '120',
 async => '0',
 version => '3',
 Host => 'srv-dc00.zcr.com.br',
 BaseDN => 'ou=SEDE,dc=zcr,dc=com,dc=br',
 SSCOPE => 'sub',
 UserDN =>'otrs',
 UserPw => 'senha',
 },
 # customer unique id
 CustomerKey => 'sAMAccountName',
 # customer #
 CustomerID => 'company',
 CustomerUserListFields => ['sAMAccountName', 'cn', 'mail' , 'company'],
 CustomerUserSearchFields => ['sAMAccountName', 'cn', 'mail' , 'company'],
 CustomerUserSearchPrefix => '',
 CustomerUserSearchSuffix => '*',
 CustomerUserSearchListLimit => 250,
 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', 'sAMAccountName', 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' ],
 ],
 };

 #Add the following lines when only users are allowed to login if they reside in the spicified security group
 #Remove these lines if you want to provide login to all users specified in the User Base DN
 #example: $Self->{'Customer::AuthModule::LDAP::BaseDN'} = 'ou=BaseOU, dc=example, dc=com';
 $Self->{'Customer::AuthModule::LDAP::GroupDN'} = 'CN=GR-ZCR-OTRS-Clientes,OU=Grupos,OU=SEDE,DC=zcr,DC=com,DC=br';
 $Self->{'Customer::AuthModule::LDAP::AccessAttr'} = 'member';
 $Self->{'Customer::AuthModule::LDAP::UserAttr'} = 'DN'
}

# ---------------------------------------------------- #
# needed system stuff (don't edit this) #
# ---------------------------------------------------- #
use strict;
use warnings;

use vars qw(@ISA);

use Kernel::Config::Defaults;
push (@ISA, 'Kernel::Config::Defaults');

# -----------------------------------------------------#
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: changing customer id ldap

Post by crythias »

ricardobarrosozcr wrote:[ 'UserCustomerID', 'CustomerID', 'mail', 0, 1, 'var' ],

Code: Select all

[ 'UserCustomerID', 'CustomerID', 'company', 0, 1, 'var' ],
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
Locked