Organization based on user custom attribute (patch)


  • Used Zammad version: 3.3
  • Used Zammad installation source: package
  • Operating system: CentOs
  • Browser + version: firefox 78.5 est

Expected behavior:

  • When LDAP syncs users in Zammad it should assign the right organization based on a custom fields. We have hundreds of users and they are all under the same email domain. We have a custom, ldap-populated user attribute (“department”) that would allow us to assign the user to the right organization. I created a patch (applied it, recompiled assets, reloaded zammad service).

Actual behavior:

  • The code in the patch doesn’t seem to be activated nor to leave traces in the log files. Could you please help me understand why the patch does not work as expected? Thanks!

Steps to reproduce the behavior:

  • Here is the patch (changing only the “domain_based_assignment” method in “app/models/user.rb”):
    $ diff ./app/models/user.rb.orig ./app/models/user.rb
    < domain =

      # LD 12/12/2020 change next lines to use custom fields instead of domain
      #domain =
      return true if !UserInfo.current_user_id
      user = User.find_by(id: UserInfo.current_user_id)
      return true if !user
      return true if !user.attributes[:department]
      domain = user.attributes[:department]

    < "LD organization found: " + + " from domain:" + domain

Any help would be more than appreciated, best regards

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.