How-to: Create own directory reports

How to Create own directory reports

Environment

  1. UCS 4.4-x (should work also on lower versions)

Preparing

Step 1: Create a directory for own report templates

root@ucs:~# mkdir /etc/univention/directory/reports/custom/

Step 2: Create a template file

root@ucs:~# vi /etc/univention/directory/reports/custom/expire.csv

You could use subfolder de_DE or en_US if you want to create mutlilingual versions of the report.

In the header you can write anything you want; it should describe the column. You can define the seperator; I use a semicolon, you can use TAB or comma.
The attributes must match the udm property name. Here is an example:

<@header@>
User name;Last name;First name;Password expiry date
<@/header@>
<@attribute name="username"@>;<@attribute name="lastname"@>;<@attribute name="firstname"@>;<@attribute name="passwordexpiry" default="Not set"@>
<@footer@>
<@/footer@>>

Step 3: Define the configuration via UCR variable

root@ucs:~# ucr set directory/reports/templates/csv/userexpire='users/user "EXPIRE" /etc/univention/directory/reports/custom/expire.csv'

Important: The name (here EXPIRE) must be unique.

Step 3: Run the report via command line

This command will generate a report of all Users in the domain:

root@ucs:~# univention-directory-reports -m users/user -r "EXPIRE" $(udm users/user list | sed -ne 's/^DN: //p')

You can also run it via Webinterface UMC → Users → User → Select users → more → create report → choose Report (in this example EXPIRE)

Have fun with your own reports.

Thanks to Moritz_Bunkus who explained that in this help discussion (german language):

3 Likes