How-to: Configure Default Mail Quota and Pager Attributes Using User Templates in UCS

How to: Configure Default Mail Quota and Pager Attributes Using User Templates in UCS

Summary

In UCS administrators may want to define default values for certain user attributes when creating new accounts. Typical examples are a default pager number or a mail quota.

This can be achieved by using Extended Attributes and enabling them for the User Template module. Once configured, these attributes can be set in a User Template and automatically applied when creating new users.

This article explains how to:

  • Create an Extended Attribute for the pager LDAP attribute
  • Use it in a User Template
  • Configure a default mail quota using the existing Dovecot Extended Attribute

Step 1: Create an Extended Attribute for the Pager field

The LDAP attribute pager exists in the inetOrgPerson object class, but it is not available in user templates by default. To make it usable in user templates, an Extended Attribute must be created.

Run the following command on a UCS system:

udm settings/extended_attribute create \
    --position "cn=custom attributes,cn=univention,$(ucr get ldap/base)" \
    --set name="CustomPagerNumberAttribute" \
    --set CLIName="pagerTelephoneNumber" \
    --set ldapMapping="pager" \
    --set objectClass="inetOrgPerson" \
    --set groupName="Private" \
    --set shortDescription="Pager Number" \
    --set longDescription="Set the pager telephone number" \
    --set tabAdvanced=0 \
    --set tabName="Contact" \
    --set tabPosition=4 \
    --set translationGroupName='"de_DE" "Privat"' \
    --set translationLongDescription='"de_DE" "Ermöglicht das Setzen der Pager-Nummer"' \
    --set translationShortDescription='"de_DE" "Rufnummer Pager"' \
    --set translationTabName='"de_DE" "Kontakt"' \
    --set module="settings/usertemplate" \
    --set module="users/user" \
    --set syntax="string" \
    --set mayChange=1 \
    --set copyable=1 \
    --set default="0175/00000" \
    --set fullWidth=1

This command creates a new Extended Attribute that:

  • Maps to the LDAP attribute pager

  • Appears in the Contact tab

  • Is available in both

    • users/user
    • settings/usertemplate
  • Defines the default value 0175/00000


Step 2: Create a User Template

Next, create a user template that administrators can select when creating new users.

udm settings/usertemplate create \
    --position "cn=templates,cn=univention,$(ucr get ldap/base)" \
    --set name="NewUserTemplate" \
    --set displayName="<firstname> <lastname>" \
    --set primaryGroup="cn=Domain Users,cn=groups,$(ucr get ldap/base)"

When creating a new user in the UCS management interface, this template can be selected.

The pager attribute will automatically be pre-filled with the default value:

0175/00000

Administrators can change this value during user creation if necessary.


Step 3: Use the Mail User Quota

For the mail quota, an Extended Attribute already exists. It is provided by the Dovecot integration and is called:

UniventionDovecotUserQuota

You can verify its presence with:

udm settings/extended_attribute list --filter cn=UniventionDovecotUserQuota

Example output:

cn=UniventionDovecotUserQuota
DN: cn=UniventionDovecotUserQuota,cn=custom attributes,cn=univention,dc=univention,dc=intranet
  CLIName: mailUserQuota
  copyable: None
  default: 0
  deleteObjectClass: 0
  disableUDMWeb: None
  doNotSearch: 0
  fullWidth: 1
  groupName: Advanced settings
  groupPosition: None
  hook: None
  ldapMapping: univentionMailUserQuota
  longDescription: Mail quota for the user in megabytes (0=no quota)
  mayChange: 1
  module: users/user
  multivalue: 0
  name: UniventionDovecotUserQuota
  notEditable: 0
  objectClass: univentionMail
  overwritePosition: None
  overwriteTab: 0
  preventUmcDefaultPopup: None
  shortDescription: Mail quota (MB)
  syntax: integer
  tabAdvanced: 1
  tabName: Mail
  tabPosition: 4
  translationGroupName: de_DE: Erweiterte Einstellungen
  translationGroupName: fr_FR: Réglages avancés
  translationLongDescription: de_DE: E-Mail-Quota des Benutzers in Megabytes (0=kein Quota)
  translationLongDescription: fr_FR: Quota de courrier pour l’utilisateur ou utilisatrice, en mégaoctets (0 = pas de quota)
  translationShortDescription: de_DE: E-Mail-Quota (MB)
  translationShortDescription: fr_FR: Quota de courrier (Mo)
  translationTabName: de_DE: Mail
  translationTabName: fr_FR: Courrier
  univentionObjectIdentifier: bf23fa2b-5090-4a4e-9428-d0eec84f22b7
  valueRequired: 0
  version: 2

This attribute stores the mail quota in megabytes.


Step 4: Modify the default Mail Quota and enable it for User Templates

To make the mail quota configurable through User Templates and set a default value, modify the Extended Attribute:

udm settings/extended_attribute modify \
  --dn "cn=UniventionDovecotUserQuota,cn=custom attributes,cn=univention,$(ucr get ldap/base)" \
  --set default=5 \
  --append "module=settings/usertemplate"

This modification:

  • Sets the default mail quota to 5 MB
  • Makes the attribute available in the User Template module

Result

After completing these steps:

  • Pager numbers can be predefined through a User Template
  • Mail quotas can also be configured and applied automatically
  • Administrators only need to select the desired template when creating new users

This helps standardize user provisioning and ensures that required attributes are set consistently across all newly created accounts.