Update Custom Attributes to Extended Attributes/en

From Univention Wiki

Revision as of 14:27, 5 December 2011 by Gulden (talk | contribs) (Fixed wrong Link.)
Jump to: navigation, search
Note: Univention Corporate Server (UCS) 3.0 has been released.
Produktlogo UCS Version 3.0
Languages: Flag USA EnglishFlag Germany Deutsch

Up to UCS 2.4 custom attributes could be used to create new, non-standard attributes for Univention Directory Manager objects.

Note: These custom attributes are no longer supported with UCS 3.0 and must be converted to extended attributes before the upgrade.

Extended attributes encompass the complete scope of functions of the custom attributes and offer additional, more in-depth possibilities to extend the Univention Directory Manager with your own settings masks. The conversion of existing custom attributes to extended attributes will be illustrated by the following example:

A company wants to manage the number plates of staff cars at the user object in the Univention Directory Manager. This requirement was implemented with the following custom attribute:

-> univention-directory-manager settings/customattribute list
DN: cn=dienstwagen,cn=custom attributes,cn=univention,...
 ARG:  None 
 name: staff-cars
 default: None
 module: users/user
 syntax: None
 objectClass: univentionFreeAttributes
 tabName: Staff-Cars
 multivalue: None
 ldapMapping: univentionFreeAttribute1
 deleteObjectClass: None
 longDescription: Number plates of staff cars
 shortDescription: staff-cars
 tabPosition: 2

Now, this custom attribute allows to store the cars number plate at the user object in the Univention Directory Manager. A corresponding extended attribute can be created with the following command:

-> eval "$(univention-config-registry shell)"
-> univention-directory-manager settings/extended_attribute create \ 
   --position="cn=custom attributes,cn=univention,$ldap_base" \
   --set name=staff-cars-ext \
   --set module=users/user \
   --set tabName="Staff-Cars" \
   --set tabPosition=2 \
   --set ldapMapping="univentionFreeAttribute1" \
   --set objectClass="univentionFreeAttributes" \
   --set longDescription="Number plates of staff cars" \
   --set shortDescription="numbers plates" \
   --set CLIName=staff-cars \
   --set mayChange=1

The mandatory parameters for extended attribute (settings/extended_attribute) are nearly the same as for the existing custom attribute. Only the parameters CLIName and mayChange are new. CLIName defines the command line name of the extented attribute and mayChange (set to 1) allows to change the content of the attribute. The following command shows a full list of parameters for extented attributes.

-> univention-directory-manager settings/extended_attribute

Such an extended attribute can be used just like the old attribute. It can be set via the Univention Directory Manager's web interface or on the command line:

-> eval "$(univention-config-registry shell)"
-> univention-directory-manager users/user modify \
   --dn "uid=testuser,cn=users,$ldap_base" \
   --set staff-cars="HB-2412"

-> univention-directory-manager users/user list \
   --filter username=max.mustermann | grep staff-cars
  staff-cars: HB-2412

After creating the extended attribute, the custom attribute can be deleted:

-> eval "$(univention-config-registry shell)"
-> udm settings/customattribute remove --dn \
   "cn=dienstwagen,cn=custom attributes,cn=univention,$ldap_base"

Details on creating extended attributes, their parameters and usage can be found in the Template:Manual UCS.

Personal tools