Zammad: OTRS Import after LDAP import capitalization problem

Created on 23 Nov 2017  ·  8Comments  ·  Source: zammad/zammad

Infos:

  • Used Zammad version: zammad-2.1.0
  • Used Zammad installation source: rpm package
  • Operating system: CentOS 7
  • Browser + version:

Expected behavior:

Users from an OTRS import should be merged with a previous LDAP import.

Actual behavior:

The users seem to be partly updated, but not all, specifically it looks as if the LDAP import converts everything to lowercase, where as the OTRS import keeps the login as is.

We can see that users with userPrincipalName such as "Givenname.[email protected]" are created, whereas "givenname.[email protected]" is updated. The OTRS user in the first however is still created with a lowercase login.

Also i can see that in the first case there is a 3 digit number appended to the login, such as

OTRS: [email protected] -> zammad: givenname.[email protected]

This behaviour is the same for all users.

Steps to reproduce the behavior:

  • Use one directory with a few users like Givenname.[email protected] and some like givenname.[email protected]
  • import LDAP users first (in our case with changed order of "samaccountname" and "userprincipalname" in "lib/ldap/user.rb:61"
  • then import the tickets and users from OTRS as described in the documentation.
  • check the logfiles, the users with Givenname.[email protected] are like this

_thread#-: add User.find_by(login: [email protected])_

the users with all lowercase are like this

_thread#-: update User.find_by(login: [email protected])_

when i search for the first user in zammad using

_User.find_by(email: '[email protected]')_

i do not find the user, if i search with lowercase

_User.find_by(email: '[email protected]')_

i find him, but the login is like this

login: "ggggg.[email protected]"

bug import verified

Most helpful comment

@thorsteneckel so no more minitests and all new tests would be rspec?

All 8 comments

Maybe i solved the problem, (at least for me)

I changed 2 files in lib/import/otrs

user.rb
customer_user.rb

in each of the files I added this

    _mapped[:login].downcase!_

below line 70. (stricly not neccessary in the user.rb i think, but i am not a developer)

This should not be a problem with ldap backed installations, with other backends this could mean that the user has to login as "donald duck" instead of "Donald Duck" if i see this correctly.

so for now this is more of a dirty fix, but maybe someone with more development skills can make this better ?

Hi @smalchow - Thanks for your comprehensive analysis of the issue. In fact Zammad (tries to as we can see) downcases all identifiers (like e.g. the email) to avoid exactly this issue. So your solution is correct. This is a workaround for case sensitive databases to avoid custom / inperformant queries.

Would be great if you could create a pull request for this!

Ahhrrg.... This bugged me already 7 years ago :D
https://bugs.otrs.org/show_bug.cgi?id=4732

Ok nevermind. got it. hints. :)

Hi @muhammadn - Great to have you back 👋 You can check our RSpec tests for OTRS here: https://github.com/zammad/zammad/blob/develop/spec/lib/import/otrs/user_spec.rb

@thorsteneckel so no more minitests and all new tests would be rspec?

Yes 🎉

Fixed thanks to the pull request #1677 by @muhammadn 🚀

Was this page helpful?
0 / 5 - 0 ratings

Related issues

robwilc picture robwilc  ·  3Comments

jaykijay picture jaykijay  ·  3Comments

metasnw picture metasnw  ·  3Comments

adonno picture adonno  ·  3Comments

strey picture strey  ·  3Comments