diff --git a/lam/lib/modules/inetOrgPerson.inc b/lam/lib/modules/inetOrgPerson.inc
index 74b1bedd..65136919 100644
--- a/lam/lib/modules/inetOrgPerson.inc
+++ b/lam/lib/modules/inetOrgPerson.inc
@@ -112,12 +112,12 @@ class inetOrgPerson extends baseModule implements passwordService {
// LDAP aliases
$return['LDAPaliases'] = array('commonName' => 'cn', 'surname' => 'sn', 'streetAddress' => 'street',
'fax' => 'facsimileTelephoneNumber', 'gn' => 'givenName', 'userid' => 'uid', 'rfc822Mailbox' => 'mail',
- 'mobileTelephoneNumber' => 'mobile', 'organizationName' => 'o');
+ 'mobileTelephoneNumber' => 'mobile', 'organizationName' => 'o', 'organizationalUnitName' => 'ou');
// managed attributes
$return['attributes'] = array('uid', 'cn', 'employeeType', 'givenName', 'jpegPhoto', 'mail', 'manager', 'mobile',
'title', 'telephoneNumber', 'facsimileTelephoneNumber', 'street', 'postOfficeBox', 'postalCode', 'postalAddress',
'sn', 'userPassword', 'description', 'homePhone', 'roomNumber', 'businessCategory', 'l', 'st', 'physicalDeliveryOfficeName',
- 'carLicense', 'departmentNumber', 'o', 'employeeNumber', 'initials', 'registeredAddress', 'labeledURI');
+ 'carLicense', 'departmentNumber', 'o', 'employeeNumber', 'initials', 'registeredAddress', 'labeledURI', 'ou');
// self service search attributes
$return['selfServiceSearchAttributes'] = array('uid', 'mail', 'cn', 'surname', 'givenName', 'employeeNumber');
// self service field settings
@@ -182,6 +182,9 @@ class inetOrgPerson extends baseModule implements passwordService {
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideDepartments')) {
$profileElements[] = new htmlTableExtendedInputField(_('Department'), 'inetOrgPerson_departmentNumber', null, 'departmentNumberList');
}
+ if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideOu')) {
+ $profileElements[] = new htmlTableExtendedInputField(_('Organisational unit'), 'inetOrgPerson_ou', null, 'ouList');
+ }
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideO')) {
$profileElements[] = new htmlTableExtendedInputField(_('Organisation'), 'inetOrgPerson_o', null, 'oList');
}
@@ -301,12 +304,14 @@ class inetOrgPerson extends baseModule implements passwordService {
$configContainerOptions->addNewLine();
$configContainerOptions->addElement(new htmlTableExtendedInputCheckbox('inetOrgPerson_hideManager', false, _('Manager'), null, false));
$configContainerOptions->addElement(new htmlOutputText(' '));
+ $configContainerOptions->addElement(new htmlTableExtendedInputCheckbox('inetOrgPerson_hideOu', false, _('Organisational unit'), null, false));
+ $configContainerOptions->addElement(new htmlOutputText(' '));
$configContainerOptions->addElement(new htmlTableExtendedInputCheckbox('inetOrgPerson_hideO', false, _('Organisation'), null, false));
$configContainerOptions->addElement(new htmlOutputText(' '));
$configContainerOptions->addElement(new htmlTableExtendedInputCheckbox('inetOrgPerson_hideEmployeeNumber', false, _('Employee number'), null, false));
$configContainerOptions->addElement(new htmlOutputText(' '));
$configContainerOptions->addElement(new htmlTableExtendedInputCheckbox('inetOrgPerson_hideInitials', false, _('Initials'), null, false));
- $configContainerOptions->addElement(new htmlOutputText(' '));
+ $configContainerOptions->addNewLine();
$configContainerOptions->addElement(new htmlTableExtendedInputCheckbox('inetOrgPerson_hideLabeledURI', false, _('Web site'), null, false));
$configContainer->addElement($configContainerOptions, true);
if (isset($_SESSION['conf_config'])) {
@@ -496,6 +501,14 @@ class inetOrgPerson extends baseModule implements passwordService {
'example' => _('Administration')
);
}
+ if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideOu')) {
+ $return['upload_columns'][] = array(
+ 'name' => 'inetOrgPerson_ou',
+ 'description' => _('Organisational unit'),
+ 'help' => 'ouList',
+ 'example' => _('Administration')
+ );
+ }
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideO')) {
$return['upload_columns'][] = array(
'name' => 'inetOrgPerson_o',
@@ -610,6 +623,9 @@ class inetOrgPerson extends baseModule implements passwordService {
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideO')) {
$return['PDF_fields']['o'] = _('Organisation');
}
+ if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideOu')) {
+ $return['PDF_fields']['ou'] = _('Organisational unit');
+ }
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideEmployeeNumber')) {
$return['PDF_fields']['employeeNumber'] = _('Employee number');
}
@@ -798,6 +814,14 @@ class inetOrgPerson extends baseModule implements passwordService {
"Headline" => _("Password hash type"),
"Text" => _("LAM supports CRYPT, CRYPT-SHA512, SHA, SSHA, MD5 and SMD5 to generate the hash value of passwords. SSHA and CRYPT are the most common but CRYPT does not support passwords greater than 8 letters. We do not recommend to use plain text passwords.")
),
+ 'ou' => array(
+ "Headline" => _("Organisational unit"), 'attr' => 'ou',
+ "Text" => _("The user's organisational unit.")
+ ),
+ 'ouList' => array(
+ "Headline" => _("Organisational unit"), 'attr' => 'ou',
+ "Text" => _("The user's organisational unit.") . ' ' . _('Multiple values are separated by semicolon.')
+ ),
'o' => array(
"Headline" => _("Organisation"), 'attr' => 'o',
"Text" => _("The user's organisation name.")
@@ -1185,6 +1209,20 @@ class inetOrgPerson extends baseModule implements passwordService {
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideEmployeeNumber')) {
$this->attributes['employeeNumber'][0] = $_POST['employeeNumber'];
}
+ if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideOu')) {
+ $ouCounter = 0;
+ while (isset($_POST['ou' . $ouCounter])) {
+ $this->attributes['ou'][$ouCounter] = $_POST['ou' . $ouCounter];
+ if ($this->attributes['ou'][$ouCounter] == '') {
+ unset($this->attributes['ou'][$ouCounter]);
+ }
+ $ouCounter++;
+ }
+ if (isset($_POST['addOu'])) {
+ $this->attributes['ou'][] = '';
+ }
+ $this->attributes['ou'] = array_values($this->attributes['ou']);
+ }
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideO')) {
$oCounter = 0;
while (isset($_POST['o' . $oCounter])) {
@@ -1760,6 +1798,34 @@ class inetOrgPerson extends baseModule implements passwordService {
$departmentNumberHelp->alignment = htmlElement::ALIGN_TOP;
$fieldContainer->addElement($departmentNumberHelp, true);
}
+ // organisational unit
+ if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideOu')) {
+ $ous = array();
+ if (isset($this->attributes['ou'][0])) {
+ $ous = $this->attributes['ou'];
+ }
+ if (sizeof($ous) == 0) {
+ $ous[] = '';
+ }
+ $ouLabel = new htmlOutputText(_('Organisational unit'));
+ $ouLabel->alignment = htmlElement::ALIGN_TOP;
+ $fieldContainer->addElement($ouLabel);
+ $ouContainer = new htmlGroup();
+ for ($i = 0; $i < sizeof($ous); $i++) {
+ $ouContainer->addElement(new htmlInputField('ou' . $i, $ous[$i]));
+ if ($i < (sizeof($ous) - 1)) {
+ $ouContainer->addElement(new htmlOutputText('
', false));
+ }
+ else {
+ $ouContainer->addElement(new htmlButton('addOu', 'add.png', true));
+ }
+ }
+ $fieldContainer->addElement($ouContainer);
+ $ouHelp = new htmlHelpLink('ou');
+ $ouHelp->alignment = htmlElement::ALIGN_TOP;
+ $fieldContainer->addElement($ouHelp, true);
+ }
+ // organisation
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideO')) {
$os = array();
if (isset($this->attributes['o'][0])) {
@@ -2076,6 +2142,10 @@ class inetOrgPerson extends baseModule implements passwordService {
if (isset($this->attributes['employeeNumber'][0])) {
$employeeNumber = $this->attributes['employeeNumber'][0];
}
+ $ou = '';
+ if (isset($this->attributes['ou'][0])) {
+ $ou = implode(', ', $this->attributes['ou']);
+ }
$o = '';
if (isset($this->attributes['o'][0])) {
$o = implode(', ', $this->attributes['o']);
@@ -2114,6 +2184,7 @@ class inetOrgPerson extends baseModule implements passwordService {
get_class($this) . '_location' => array('' . _('Location') . '' . $l . ''),
get_class($this) . '_state' => array('' . _('State') . '' . $st . ''),
get_class($this) . '_officeName' => array('' . _('Office name') . '' . $physicalDeliveryOfficeName . ''),
+ get_class($this) . '_ou' => array('' . _('Organisational unit') . '' . $ou . ''),
get_class($this) . '_o' => array('' . _('Organisation') . '' . $o . ''),
get_class($this) . '_employeeNumber' => array('' . _('Employee number') . '' . $employeeNumber . ''),
get_class($this) . '_initials' => array('' . _('Initials') . '' . $initials . ''),
@@ -2141,6 +2212,10 @@ class inetOrgPerson extends baseModule implements passwordService {
$this->attributes['departmentNumber'] = array_map('trim', $departments);
}
}
+ if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideOu') && isset($profile['inetOrgPerson_ou'][0])) {
+ $oList = preg_split('/;[ ]*/', $profile['inetOrgPerson_ou'][0]);
+ $this->attributes['ou'] = $oList;
+ }
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideO') && isset($profile['inetOrgPerson_o'][0])) {
$oList = preg_split('/;[ ]*/', $profile['inetOrgPerson_o'][0]);
$this->attributes['o'] = $oList;
@@ -2387,6 +2462,10 @@ class inetOrgPerson extends baseModule implements passwordService {
// remove extra spaces
$partialAccounts[$i]['departmentNumber'] = array_map('trim', $partialAccounts[$i]['departmentNumber']);
}
+ // organisational unit
+ if (isset($ids['inetOrgPerson_ou']) && ($rawAccounts[$i][$ids['inetOrgPerson_ou']] != "")) {
+ $partialAccounts[$i]['ou'] = preg_split('/;[ ]*/', $rawAccounts[$i][$ids['inetOrgPerson_ou']]);
+ }
// organisation
if (isset($ids['inetOrgPerson_o']) && ($rawAccounts[$i][$ids['inetOrgPerson_o']] != "")) {
$partialAccounts[$i]['o'] = preg_split('/;[ ]*/', $rawAccounts[$i][$ids['inetOrgPerson_o']]);