Different imaplogin OX attributes for different users

In this post it is described how to change the imaplogin OX attribute on a Univention server.

We have users of two mail domains (external, no UCS) in the same OX context. Users one mail domain require the username as imaplogin and users of the other mail domain require the email address as imaplogin. I cannot change this easily right now, so I added something like this to our update-script (so it’s run after every update):

if ! grep -q "example.com" /usr/share/univention-ox/listener/ox-user.py ; then
  cp -a /usr/share/univention-ox/listener/ox-user.py /usr/share/univention-ox/listener/ox-user.bak
  sed -i "/imaplogin = imaplogin.format(email)/ a \\\t\t\t\tif not 'example.com' in email:\n\t\t\t\t\timaplogin = username" /usr/share/univention-ox/listener/ox-user.py
  systemctl restart univention-directory-listener.service

No need to tell me, that this is really terrible. :wink:

It would be nice if this could be a policy that can be applied to a user or a group or even a textfield in the user object allowing any text as imaplogin.