added mail aliases

This commit is contained in:
Roland Gruber 2013-04-27 17:38:01 +00:00
parent 99119ea96b
commit 26b6505be7
2 changed files with 83 additions and 5 deletions

View File

@ -95,7 +95,7 @@ class windowsGroup extends baseModule {
// managed object classes
$return['objectClasses'] = array('group', 'securityPrincipal', 'mailRecipient');
// managed attributes
$return['attributes'] = array('cn', 'description', 'info', 'mail', 'member', 'sAMAccountName', 'groupType');
$return['attributes'] = array('cn', 'description', 'info', 'mail', 'member', 'sAMAccountName', 'groupType', 'otherMailbox');
// help Entries
$return['help'] = array(
'hiddenOptions' => array(
@ -118,6 +118,14 @@ class windowsGroup extends baseModule {
"Headline" => _('Email address'), 'attr' => 'mail',
"Text" => _('The list\'s email address.')
),
'otherMailbox' => array(
"Headline" => _("Email alias"), 'attr' => 'otherMailbox',
"Text" => _("Email alias for this account.")
),
'otherMailboxList' => array(
"Headline" => _("Email alias"), 'attr' => 'otherMailbox',
"Text" => _("Email alias for this account.") . ' ' . _("Multiple values are separated by semicolon.")
),
'member' => array(
"Headline" => _('Members'), 'attr' => 'member',
"Text" => _('This is a list of members of this group.')
@ -143,6 +151,8 @@ class windowsGroup extends baseModule {
$configContainerOptions = new htmlTable();
$configContainer->addElement($configContainerHead, true);
$configContainerOptions->addElement(new htmlTableExtendedInputCheckbox('windowsGroup_hidemail', false, _('Email address'), null, false));
$configContainerOptions->addElement(new htmlOutputText(' '));
$configContainerOptions->addElement(new htmlTableExtendedInputCheckbox('windowsGroup_hideotherMailbox', false, _('Email alias'), null, false));
$configContainer->addElement($configContainerOptions, true);
$return['config_options']['all'] = $configContainer;
// upload fields
@ -197,6 +207,14 @@ class windowsGroup extends baseModule {
'example' => _('group@company.com'),
);
}
if (!$this->isBooleanConfigOptionSet('windowsGroup_hideotherMailbox')) {
$return['upload_columns'][] = array(
'name' => 'windowsGroup_otherMailbox',
'description' => _('Email alias'),
'help' => 'otherMailboxList',
'example' => _('group@company.com'),
);
}
// available PDF fields
$return['PDF_fields'] = array(
'cn' => _('Group name'),
@ -209,6 +227,9 @@ class windowsGroup extends baseModule {
if (!$this->isBooleanConfigOptionSet('windowsGroup_hidemail')) {
$return['PDF_fields']['mail'] = _('Email address');
}
if (!$this->isBooleanConfigOptionSet('windowsGroup_hideotherMailbox')) {
$return['PDF_fields']['otherMailbox'] = _('Email alias');
}
return $return;
}
@ -220,6 +241,8 @@ class windowsGroup extends baseModule {
$this->messages['cn'][1] = array('ERROR', _('Account %s:') . ' windowsGroup_cn', _('Group name contains invalid characters. Valid characters are: a-z, A-Z, 0-9 and .-_ !'));
$this->messages['mail'][0] = array('ERROR', _('Email address'), _('Please enter a valid email address!'));
$this->messages['mail'][1] = array('ERROR', _('Account %s:') . ' windowsGroup_mail', _('Please enter a valid email address!'));
$this->messages['otherMailbox'][0] = array('ERROR', _('Email alias'), _('Email alias is invalid!'));
$this->messages['otherMailbox'][1] = array('ERROR', _('Account %s:') . ' windowsGroup_otherMailbox', _('Email alias is invalid!'));
$this->messages['groupScope'][0] = array('ERROR', _('Account %s:') . ' windowsGroup_groupScope', _('Please enter a valid group scope.'));
$this->messages['groupType'][0] = array('ERROR', _('Account %s:') . ' windowsGroup_groupType', _('Please enter a valid group type.'));
}
@ -236,6 +259,9 @@ class windowsGroup extends baseModule {
if (!$this->isBooleanConfigOptionSet('windowsGroup_hidemail')) {
$this->addSimpleInputTextField($container, 'mail', _('Email address'), false);
}
if (!$this->isBooleanConfigOptionSet('windowsGroup_hideotherMailbox')) {
$this->addMultiValueInputTextField($container, 'otherMailbox', _('Email alias'));
}
// group type
$groupType = windowsGroup::TYPE_SECURITY;
$groupScope = windowsGroup::SCOPE_GLOBAL;
@ -330,6 +356,10 @@ class windowsGroup extends baseModule {
$return[] = $this->messages['mail'][0];
}
}
// email aliases
if (!$this->isBooleanConfigOptionSet('windowsGroup_hideotherMailbox')) {
$this->processMultiValueInputTextField('otherMailbox', $return, 'email');
}
// group scope
switch ($_POST['groupScope']) {
case windowsGroup::SCOPE_DOMAIN_LOCAL:
@ -506,7 +536,7 @@ class windowsGroup extends baseModule {
$partialAccounts[$i]['info'] = $rawAccounts[$i][$ids['windowsGroup_notes']];
}
// email
if ($rawAccounts[$i][$ids['windowsGroup_mail']] != "") {
if (!$this->isBooleanConfigOptionSet('windowsGroup_hidemail') && ($rawAccounts[$i][$ids['windowsGroup_mail']] != "")) {
if (get_preg($rawAccounts[$i][$ids['windowsGroup_mail']], 'email')) {
$partialAccounts[$i]['mail'] = $rawAccounts[$i][$ids['windowsGroup_mail']];
}
@ -516,6 +546,19 @@ class windowsGroup extends baseModule {
$errors[] = $errMsg;
}
}
// email aliases
if (!$this->isBooleanConfigOptionSet('windowsGroup_hideotherMailbox') && isset($ids['windowsGroup_otherMailbox']) && ($rawAccounts[$i][$ids['windowsGroup_otherMailbox']] != "")) {
$valueList = preg_split('/;[ ]*/', $rawAccounts[$i][$ids['windowsGroup_otherMailbox']]);
$partialAccounts[$i]['otherMailbox'] = $valueList;
for ($x = 0; $x < sizeof($valueList); $x++) {
if (!get_preg($valueList[$x], 'email')) {
$errMsg = $this->messages['otherMailbox'][1];
array_push($errMsg, array($i));
$errors[] = $errMsg;
break;
}
}
}
// add members
if ($rawAccounts[$i][$ids['windowsGroup_members']] != "") {
$partialAccounts[$i]['member'] = explode(";", $rawAccounts[$i][$ids['windowsGroup_members']]);
@ -573,6 +616,7 @@ class windowsGroup extends baseModule {
$this->addSimplePDFField($return, 'description', _('Description'));
$this->addSimplePDFField($return, 'info', _('Notes'));
$this->addSimplePDFField($return, 'mail', _('Email address'));
$this->addSimplePDFField($return, 'otherMailbox', _('Email alias'));
// group type
$groupType = windowsGroup::TYPE_SECURITY;
$groupScope = windowsGroup::SCOPE_GLOBAL;

View File

@ -88,7 +88,7 @@ class windowsUser extends baseModule implements passwordService {
$return['attributes'] = array('cn', 'sAMAccountName', 'description', 'displayName', 'givenName', 'initials',
'l', 'mail', 'otherTelephone', 'physicalDeliveryOfficeName', 'postalCode', 'postOfficeBox', 'sn', 'st',
'streetAddress', 'telephoneNumber', 'url', 'wWWHomePage', 'userAccountControl', 'profilePath', 'scriptPath',
'pwdLastSet');
'pwdLastSet', 'otherMailbox');
// help Entries
$return['help'] = array(
'cn' => array(
@ -197,8 +197,16 @@ class windowsUser extends baseModule implements passwordService {
'password' => array(
"Headline" => _("Password"),
"Text" => _("Please enter the password which you want to set for this account.")
),
);
),
'otherMailbox' => array(
"Headline" => _("Email alias"), 'attr' => 'otherMailbox',
"Text" => _("Email alias for this account.")
),
'otherMailboxList' => array(
"Headline" => _("Email alias"), 'attr' => 'otherMailbox',
"Text" => _("Email alias for this account.") . ' ' . _("Multiple values are separated by semicolon.")
),
);
// upload fields
$return['upload_columns'] = array(
array(
@ -287,6 +295,12 @@ class windowsUser extends baseModule implements passwordService {
'help' => 'mail',
'example' => _('user@company.com'),
),
array(
'name' => 'windowsUser_otherMailbox',
'description' => _('Email alias'),
'help' => 'otherMailboxList',
'example' => _('user@company.com'),
),
array(
'name' => 'windowsUser_telephoneNumber',
'description' => _('Telephone number'),
@ -370,6 +384,7 @@ class windowsUser extends baseModule implements passwordService {
'initials' => _('Initials'),
'l' => _('Location'),
'mail' => _('Email address'),
'otherMailbox' => _('Email alias'),
'otherTelephone' => _('Other telephone numbers'),
'physicalDeliveryOfficeName' => _('Office name'),
'postalCode' => _('Postal code'),
@ -441,6 +456,8 @@ class windowsUser extends baseModule implements passwordService {
$this->messages['postalCode'][1] = array('ERROR', _('Account %s:') . ' windowsUser_postalCode', _('Please enter a valid postal code!'));
$this->messages['mail'][0] = array('ERROR', _('Email address'), _('Please enter a valid email address!'));
$this->messages['mail'][1] = array('ERROR', _('Account %s:') . ' windowsUser_mail', _('Please enter a valid email address!'));
$this->messages['otherMailbox'][0] = array('ERROR', _('Email alias'), _('Email alias is invalid!'));
$this->messages['otherMailbox'][1] = array('ERROR', _('Account %s:') . ' windowsUser_otherMailbox', _('Email alias is invalid!'));
$this->messages['profilePath'][0] = array('ERROR', _('Profile path'), _('Profile path is invalid!'));
$this->messages['profilePath'][1] = array('ERROR', _('Account %s:') . ' windowsUser_profilePath', _('Profile path is invalid!'));
$this->messages['scriptPath'][0] = array('ERROR', _('Logon script'), _('Logon script is invalid!'));
@ -516,6 +533,7 @@ class windowsUser extends baseModule implements passwordService {
$containerLeft->addElement(new htmlSubTitle(_('Contact data')), true);
$this->addSimpleInputTextField($containerLeft, 'mail', _('Email address'));
$this->addMultiValueInputTextField($containerLeft, 'otherMailbox', _('Email alias'));
$this->addSimpleInputTextField($containerLeft, 'telephoneNumber', _('Telephone number'));
$this->addMultiValueInputTextField($containerLeft, 'otherTelephone', _('Other telephone numbers'));
$this->addSimpleInputTextField($containerLeft, 'wWWHomePage', _('Web site'));
@ -617,6 +635,8 @@ class windowsUser extends baseModule implements passwordService {
if (!empty($this->attributes['mail'][0]) && !get_preg($_POST['mail'], 'email')) {
$return[] = $this->messages['mail'][0];
}
// email aliases
$this->processMultiValueInputTextField('otherMailbox', $return, 'email');
// other telephones
$this->processMultiValueInputTextField('otherTelephone', $return, 'telephone');
// office name
@ -948,6 +968,19 @@ class windowsUser extends baseModule implements passwordService {
$errors[] = $errMsg;
}
}
// mail aliases
if (isset($ids['windowsUser_otherMailbox']) && ($rawAccounts[$i][$ids['windowsUser_otherMailbox']] != "")) {
$valueList = preg_split('/;[ ]*/', $rawAccounts[$i][$ids['windowsUser_otherMailbox']]);
$partialAccounts[$i]['otherMailbox'] = $valueList;
for ($x = 0; $x < sizeof($valueList); $x++) {
if (!get_preg($valueList[$x], 'email')) {
$errMsg = $this->messages['otherMailbox'][1];
array_push($errMsg, array($i));
$errors[] = $errMsg;
break;
}
}
}
// telephone
if ($rawAccounts[$i][$ids['windowsUser_telephoneNumber']] != "") {
if (get_preg($rawAccounts[$i][$ids['windowsUser_telephoneNumber']], 'telephone')) {
@ -1186,6 +1219,7 @@ class windowsUser extends baseModule implements passwordService {
$this->addSimplePDFField($return, 'initials', _('Initials'));
$this->addSimplePDFField($return, 'l', _('Location'));
$this->addSimplePDFField($return, 'mail', _('Email address'));
$this->addSimplePDFField($return, 'otherMailbox', _('Email alias'));
$this->addSimplePDFField($return, 'otherTelephone', _('Other telephone numbers'));
$this->addSimplePDFField($return, 'physicalDeliveryOfficeName', _('Office name'));
$this->addSimplePDFField($return, 'postalCode', _('Postal code'));