Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OTRS Import after LDAP import capitalization problem #1674

Closed
smalchow opened this issue Nov 23, 2017 · 8 comments
Closed

OTRS Import after LDAP import capitalization problem #1674

smalchow opened this issue Nov 23, 2017 · 8 comments
Assignees
Milestone

Comments

@smalchow
Copy link

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.Familyname@mail.com" are created, whereas "givenname.familyname@mail.com" 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: Givenname.Familyname@mail.com -> zammad: givenname.familyname@mail.com123

This behaviour is the same for all users.

Steps to reproduce the behavior:

thread#-: add User.find_by(login: Ggggg.Fffff@mail.com)

the users with all lowercase are like this

thread#-: update User.find_by(login: ggggg.fffff@mail.com)

when i search for the first user in zammad using

User.find_by(email: 'Ggggg.Fffff@mail.com')

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

User.find_by(email: 'ggggg.fffff@mail.com')

i find him, but the login is like this

login: "ggggg.fffff@mail.com507"

@smalchow
Copy link
Author

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 ?

@thorsteneckel
Copy link
Contributor

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!

@monotek
Copy link
Member

monotek commented Nov 24, 2017

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

@muhammadn
Copy link
Contributor

Ok nevermind. got it. hints. :)

@thorsteneckel
Copy link
Contributor

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

@muhammadn
Copy link
Contributor

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

@thorsteneckel
Copy link
Contributor

Yes 🎉

@thorsteneckel
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants