UserCustomerIDs generation based on multiple LDAP attributes

Moderator: crythias

Locked
Bazillus
Znuny newbie
Posts: 4
Joined: 29 Aug 2011, 12:54
Znuny Version: 3.0.10
Company: HSLU

UserCustomerIDs generation based on multiple LDAP attributes

Post by Bazillus »

Hello

I'd like to use Company ticket so I can allow certain people to view other's tickets.
I use LDAP auth for both customer and agent, but I don' have write access to the LDAP. My question is now, how can I generate secondary customerIDs based on the attributes of each customer.

With the config file, I can map the company ID from an attribute. How to do if I want to generate a secondary customer ID with if-else based on different attributes received from LDAP? Eg:
I have the attributes departement and eduPersonAffiliation. I can read and use them to identify people. I want the UserCustomerIDs set as follow:

Code: Select all

if departement=="inf" & eduPersonAffiliation=="staff"
 UserCustomerIDs = "staff;stud;"

if departement=="inf" & eduPersonAffiliation=="stud"
 UserCustomerIDs = "stud;"

else 
 UserCustomerIDs = ""

How can this be implemented with the map in Config.pm?
Last edited by Bazillus on 29 Aug 2011, 15:37, edited 1 time in total.
OTRS Help Desk 3.0.10
Solaris 10
MySQL DB
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: UserCustomerIDs generation based on multiple LDAP attrib

Post by crythias »

You might just use groups for that.
http://forums.otrs.org/viewtopic.php?f=60&t=7531

Basically, disable "Company Tickets" except for the users who would be of group managers. Then use CustomerID = department or what have you.
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
Bazillus
Znuny newbie
Posts: 4
Joined: 29 Aug 2011, 12:54
Znuny Version: 3.0.10
Company: HSLU

Re: UserCustomerIDs generation based on multiple LDAP attrib

Post by Bazillus »

Yeah, for agents this is good to sort the customers. But the problem is then that the customers of same group still don't see each others tickets, which is exactly what I want. If I could, I would set a new attribute in the LDAP, but I can't.

I'm looking for something like:

Code: Select all

sub Load {
  [...]
  
  my $compID = "";
  if departement=="inf" & eduPersonAffiliation=="staff"
    $compID = "staff;stud;"
  else if departement=="inf" & eduPersonAffiliation=="stud"
    $compID = "stud;"
  else
    $compID = ""
  $Self->{CustomerUser} = {
  
  [..]

  Map => [
            # note: Login, Email and CustomerID are mandatory!
            # 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', $compID, 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 ],
        ],

  };
  [..]
};
OTRS Help Desk 3.0.10
Solaris 10
MySQL DB
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: UserCustomerIDs generation based on multiple LDAP attrib

Post by crythias »

I'm not talking about agents. Customers with a CustomerID of the same department will see each other's tickets in Company Tickets of the Customer Interface.
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
Bazillus
Znuny newbie
Posts: 4
Joined: 29 Aug 2011, 12:54
Znuny Version: 3.0.10
Company: HSLU

Re: UserCustomerIDs generation based on multiple LDAP attrib

Post by Bazillus »

Yes, ok, but students have the department attribute too, so they would also see the ticket, what I want avoid. I only want the customers with the attributes department=inf and personAffiliation=staff seeing the ticket. As I showed in the pseudo-code example. How can I implement that, without writing to the ldap?
OTRS Help Desk 3.0.10
Solaris 10
MySQL DB
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: UserCustomerIDs generation based on multiple LDAP attrib

Post by crythias »

If you don't want them to see Company Tickets, apply permissions to the tab. Then assign the people you *want* to see that tab as members of the group that has permissions to the tab.
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
Bazillus
Znuny newbie
Posts: 4
Joined: 29 Aug 2011, 12:54
Znuny Version: 3.0.10
Company: HSLU

Re: UserCustomerIDs generation based on multiple LDAP attrib

Post by Bazillus »

Isn't it possible to map the two attributes coming from the LDAP to two self defined variable, then make an if-else on it which has the effect of assigning a string to the internal variable which is used by OTRS to store the secondary customer ID.

How can I read an LDAP attribute from inside the config file? How can I write in the secondary customer ID variable? Are if else statements allowed in the config file?
OTRS Help Desk 3.0.10
Solaris 10
MySQL DB
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: UserCustomerIDs generation based on multiple LDAP attrib

Post by crythias »

Bazillus wrote:How can I read an LDAP attribute from inside the config file?
You can't unless the LDAP attribute is assigned to a config parameter.
Bazillus wrote:How can I write in the secondary customer ID variable?
You can attempt concatenation.
Bazillus wrote:Isn't it possible to map the two attributes coming from the LDAP to two self defined variable, then make an if-else on it which has the effect of assigning a string to the internal variable which is used by OTRS to store the secondary customer ID.
It may or may not be possible to do that. It's not necessarily something that happens by default, but why is what I've proposed not a valid answer for you?
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