LAM - Account lists

# Account lists

The account lists are all built after the same schema. They provide a list of found accounts which can be restricted by LDAP filters and the LDAP OU (Organizational Unit).
The list of LDAP attributes and thus table columns is taken from the configuration profile (get_...listAttributes() in config.inc). Each account list has a separate list of attributes.
Only these attributes are given the LDAP search as attribute parameter.
There is also a predefined description list for the attributes in lists.inc. The user may use other values by setting them in the configuration profile.
The number of accounts per page is limited by a list option. There will be links at the beginning and end of the list if more accounts were found.
Several common helper functions for sorting and some page elements reside in lists.inc.

## 1. Getting accounts from LDAP

Each account list has its own LDAP suffix which is saved in the configuration profile. This is used as search base.
The account modules provide an LDAP filter (get_ldap_filter() in modules.inc) to get only accounts of a special type.
This list can be further reduced if the user provides an additional LDAP filter with the filter boxes or selects another LDAP OU with the drop-down-box.

## 2. Caching LDAP accounts

The lists usually do not ask the LDAP server for an account list every time the user changes the page. The accounts are cached in the session.
A new LDAP search is done if the user:

- changes to another account list or tool
- adds/modifies an account
- selects the "refresh" button
- adds additional LDAP filters or changes the LDAP OU

It is not done if the user:

- changes the list pages if there are more accounts than what can be shown
- sorts the list

## 3. Adding/Editing accounts

There are buttons at the end of the page to add/delete accounts. Adding accounts is done by account/edit.php and deleting by delete.php.
The user can use the link in each account row to modify (in accounts/edit.php) the account. This can also be done by double clicking the row if Java Script is enabled.

## 4. Export to PDF

The user can generate PDF files for the accounts. This is done by the createModulePDF() function from pdf.inc.

## 5. Special abilities of some lists

### 5.1. The user list

If the attribute gidNumber is shown as table column then there will be an additional checkbox to translate the GID to the group name.
This checkbox is hidden if gidNumber is not part of the attribute list.

### 5.2. The group list

If the attribute memberUID is shown as table column then all values of this attribute are shown as links.
These links redirect to userlink.php which tries to find the given user and redirects to account/edit.php for account modifying.