How-to: Mail-Home-Server - create a user template for setting default mailHomeServer

How to:

It’s possible to create a user template so that a specific mail home server is set by default when a new user account is created in the UMC.

Step 1: Create an extended attribute for the new user template

You can accept the following complete UDM command or, if necessary, adapt it to your own requirements and then execute it as root in the shell.

udm settings/extended_attribute create --position "cn=custom attributes,cn=univention,$(ucr get ldap/base)" \
--set objectClass=univentionMailRouting \
--set module=settings/usertemplate \
--set translationTabName='"de_DE" "Mail"' \
--set shortDescription="Mail Home Server" \
--set groupName="Advanced settings" \
--set CLIName=mailHomeServer \
--set translationGroupName='"de_DE" "Erweiterte Einstellungen"' \
--set translationShortDescription='"de_DE" "Mail Home Server"' \
--set tabName="Mail" \
--set syntax=MailHomeServer \
--set tabAdvanced=1 \
--set name="mailHomeServer" \
--set mayChange=1 \
--set ldapMapping="univentionMailHomeServer"

Step 2: Create the user template

Use the following command to create a user template with the necessary attributes.

Hint

Please note that the command sets the mail home server following where the command is executed. If you want to define a different system as the Mail Home Server, you should adjust the value according to your wishes.

udm settings/usertemplate create --position "cn=templates,cn=univention,$(ucr get ldap/base)" \
--set name=Mail-Home-Server \
--set displayName="<firstname> <lastname><:strip>" \
--set primaryGroup="cn=Domain Users,cn=groups,$(ucr get ldap/base)" \
--set mailHomeServer="$(hostname -f)"

Investigation

You can then use the shell to check how the objects were created.

udm settings/extended_attribute list --filter cn=mailHomeServer

cn=mailHomeServer
DN: cn=mailHomeServer,cn=custom attributes,cn=univention,dc=miro,dc=intranet
  CLIName: mailHomeServer
  copyable: None
  default: None
  deleteObjectClass: None
  disableUDMWeb: None
  doNotSearch: None
  fullWidth: None
  groupName: Advanced settings
  groupPosition: None
  hook: None
  ldapMapping: univentionMailHomeServer
  longDescription: None
  mayChange: 1
  module: settings/usertemplate
  multivalue: None
  name: mailHomeServer
  notEditable: 0
  objectClass: univentionMailRouting
  overwritePosition: None
  overwriteTab: None
  preventUmcDefaultPopup: None
  shortDescription: Mail Home Server
  syntax: MailHomeServer
  tabAdvanced: 1
  tabName: Mail
  tabPosition: None
  translationGroupName: de_DE: Erweiterte Einstellungen
  translationShortDescription: de_DE: Mail Home Server
  translationTabName: de_DE: Mail
  valueRequired: None
  version: 2

udm settings/usertemplate list --filter cn=Mail-Home-Server

cn=Mail-Home-Server
DN: cn=Mail-Home-Server,cn=templates,cn=univention,dc=miro,dc=intranet
  city: None
  country: None
  description: None
  disabled: None
  displayName: <firstname> <lastname><:strip>
  employeeNumber: None
  employeeType: None
  homeShare: None
  homeSharePath: None
  homedrive: None
  initials: None
  lastbind: None
  mailHomeServer: ucs5primary.miro.intranet
  mailPrimaryAddress: None
  name: Mail-Home-Server
  organisation: None
  physicalDeliveryOfficeName: None
  postcode: None
  preferredDeliveryMethod: None
  preferredLanguage: None
  primaryGroup: cn=Domain Users,cn=groups,dc=miro,dc=intranet
  profilepath: None
  pwdChangeNextLogin: None
  roomNumber: None
  sambahome: None
  scriptpath: None
  shell: /bin/bash
  state: None
  street: None
  title: None
  unixhome: /home/

In the UMC you will find the created objects in the LDAP-Directory/univention/custom attributes and LDAP-Directory/univention/templates like in the following screenshosts.

Screenshot from 2024-12-17 13-25-59

Screenshot from 2024-12-17 13-26-54

Screenshot from 2024-12-17 13-27-28


You can then use the user template directly when you create a new user account via the UMC and then select it as follows.

Screenshot from 2024-12-17 13-31-04

Mastodon