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 // managed object classes
$return['objectClasses'] = array('group', 'securityPrincipal', 'mailRecipient'); $return['objectClasses'] = array('group', 'securityPrincipal', 'mailRecipient');
// managed attributes // 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 // help Entries
$return['help'] = array( $return['help'] = array(
'hiddenOptions' => array( 'hiddenOptions' => array(
@ -118,6 +118,14 @@ class windowsGroup extends baseModule {
"Headline" => _('Email address'), 'attr' => 'mail', "Headline" => _('Email address'), 'attr' => 'mail',
"Text" => _('The list\'s email address.') "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( 'member' => array(
"Headline" => _('Members'), 'attr' => 'member', "Headline" => _('Members'), 'attr' => 'member',
"Text" => _('This is a list of members of this group.') "Text" => _('This is a list of members of this group.')
@ -143,6 +151,8 @@ class windowsGroup extends baseModule {
$configContainerOptions = new htmlTable(); $configContainerOptions = new htmlTable();
$configContainer->addElement($configContainerHead, true); $configContainer->addElement($configContainerHead, true);
$configContainerOptions->addElement(new htmlTableExtendedInputCheckbox('windowsGroup_hidemail', false, _('Email address'), null, false)); $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); $configContainer->addElement($configContainerOptions, true);
$return['config_options']['all'] = $configContainer; $return['config_options']['all'] = $configContainer;
// upload fields // upload fields
@ -197,6 +207,14 @@ class windowsGroup extends baseModule {
'example' => _('group@company.com'), '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 // available PDF fields
$return['PDF_fields'] = array( $return['PDF_fields'] = array(
'cn' => _('Group name'), 'cn' => _('Group name'),
@ -209,6 +227,9 @@ class windowsGroup extends baseModule {
if (!$this->isBooleanConfigOptionSet('windowsGroup_hidemail')) { if (!$this->isBooleanConfigOptionSet('windowsGroup_hidemail')) {
$return['PDF_fields']['mail'] = _('Email address'); $return['PDF_fields']['mail'] = _('Email address');
} }
if (!$this->isBooleanConfigOptionSet('windowsGroup_hideotherMailbox')) {
$return['PDF_fields']['otherMailbox'] = _('Email alias');
}
return $return; 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['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'][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['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['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.')); $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')) { if (!$this->isBooleanConfigOptionSet('windowsGroup_hidemail')) {
$this->addSimpleInputTextField($container, 'mail', _('Email address'), false); $this->addSimpleInputTextField($container, 'mail', _('Email address'), false);
} }
if (!$this->isBooleanConfigOptionSet('windowsGroup_hideotherMailbox')) {
$this->addMultiValueInputTextField($container, 'otherMailbox', _('Email alias'));
}
// group type // group type
$groupType = windowsGroup::TYPE_SECURITY; $groupType = windowsGroup::TYPE_SECURITY;
$groupScope = windowsGroup::SCOPE_GLOBAL; $groupScope = windowsGroup::SCOPE_GLOBAL;
@ -330,6 +356,10 @@ class windowsGroup extends baseModule {
$return[] = $this->messages['mail'][0]; $return[] = $this->messages['mail'][0];
} }
} }
// email aliases
if (!$this->isBooleanConfigOptionSet('windowsGroup_hideotherMailbox')) {
$this->processMultiValueInputTextField('otherMailbox', $return, 'email');
}
// group scope // group scope
switch ($_POST['groupScope']) { switch ($_POST['groupScope']) {
case windowsGroup::SCOPE_DOMAIN_LOCAL: case windowsGroup::SCOPE_DOMAIN_LOCAL:
@ -506,7 +536,7 @@ class windowsGroup extends baseModule {
$partialAccounts[$i]['info'] = $rawAccounts[$i][$ids['windowsGroup_notes']]; $partialAccounts[$i]['info'] = $rawAccounts[$i][$ids['windowsGroup_notes']];
} }
// email // 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')) { if (get_preg($rawAccounts[$i][$ids['windowsGroup_mail']], 'email')) {
$partialAccounts[$i]['mail'] = $rawAccounts[$i][$ids['windowsGroup_mail']]; $partialAccounts[$i]['mail'] = $rawAccounts[$i][$ids['windowsGroup_mail']];
} }
@ -516,6 +546,19 @@ class windowsGroup extends baseModule {
$errors[] = $errMsg; $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 // add members
if ($rawAccounts[$i][$ids['windowsGroup_members']] != "") { if ($rawAccounts[$i][$ids['windowsGroup_members']] != "") {
$partialAccounts[$i]['member'] = explode(";", $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, 'description', _('Description'));
$this->addSimplePDFField($return, 'info', _('Notes')); $this->addSimplePDFField($return, 'info', _('Notes'));
$this->addSimplePDFField($return, 'mail', _('Email address')); $this->addSimplePDFField($return, 'mail', _('Email address'));
$this->addSimplePDFField($return, 'otherMailbox', _('Email alias'));
// group type // group type
$groupType = windowsGroup::TYPE_SECURITY; $groupType = windowsGroup::TYPE_SECURITY;
$groupScope = windowsGroup::SCOPE_GLOBAL; $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', $return['attributes'] = array('cn', 'sAMAccountName', 'description', 'displayName', 'givenName', 'initials',
'l', 'mail', 'otherTelephone', 'physicalDeliveryOfficeName', 'postalCode', 'postOfficeBox', 'sn', 'st', 'l', 'mail', 'otherTelephone', 'physicalDeliveryOfficeName', 'postalCode', 'postOfficeBox', 'sn', 'st',
'streetAddress', 'telephoneNumber', 'url', 'wWWHomePage', 'userAccountControl', 'profilePath', 'scriptPath', 'streetAddress', 'telephoneNumber', 'url', 'wWWHomePage', 'userAccountControl', 'profilePath', 'scriptPath',
'pwdLastSet'); 'pwdLastSet', 'otherMailbox');
// help Entries // help Entries
$return['help'] = array( $return['help'] = array(
'cn' => array( 'cn' => array(
@ -197,8 +197,16 @@ class windowsUser extends baseModule implements passwordService {
'password' => array( 'password' => array(
"Headline" => _("Password"), "Headline" => _("Password"),
"Text" => _("Please enter the password which you want to set for this account.") "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 // upload fields
$return['upload_columns'] = array( $return['upload_columns'] = array(
array( array(
@ -287,6 +295,12 @@ class windowsUser extends baseModule implements passwordService {
'help' => 'mail', 'help' => 'mail',
'example' => _('user@company.com'), 'example' => _('user@company.com'),
), ),
array(
'name' => 'windowsUser_otherMailbox',
'description' => _('Email alias'),
'help' => 'otherMailboxList',
'example' => _('user@company.com'),
),
array( array(
'name' => 'windowsUser_telephoneNumber', 'name' => 'windowsUser_telephoneNumber',
'description' => _('Telephone number'), 'description' => _('Telephone number'),
@ -370,6 +384,7 @@ class windowsUser extends baseModule implements passwordService {
'initials' => _('Initials'), 'initials' => _('Initials'),
'l' => _('Location'), 'l' => _('Location'),
'mail' => _('Email address'), 'mail' => _('Email address'),
'otherMailbox' => _('Email alias'),
'otherTelephone' => _('Other telephone numbers'), 'otherTelephone' => _('Other telephone numbers'),
'physicalDeliveryOfficeName' => _('Office name'), 'physicalDeliveryOfficeName' => _('Office name'),
'postalCode' => _('Postal code'), '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['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'][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['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'][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['profilePath'][1] = array('ERROR', _('Account %s:') . ' windowsUser_profilePath', _('Profile path is invalid!'));
$this->messages['scriptPath'][0] = array('ERROR', _('Logon script'), _('Logon script 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); $containerLeft->addElement(new htmlSubTitle(_('Contact data')), true);
$this->addSimpleInputTextField($containerLeft, 'mail', _('Email address')); $this->addSimpleInputTextField($containerLeft, 'mail', _('Email address'));
$this->addMultiValueInputTextField($containerLeft, 'otherMailbox', _('Email alias'));
$this->addSimpleInputTextField($containerLeft, 'telephoneNumber', _('Telephone number')); $this->addSimpleInputTextField($containerLeft, 'telephoneNumber', _('Telephone number'));
$this->addMultiValueInputTextField($containerLeft, 'otherTelephone', _('Other telephone numbers')); $this->addMultiValueInputTextField($containerLeft, 'otherTelephone', _('Other telephone numbers'));
$this->addSimpleInputTextField($containerLeft, 'wWWHomePage', _('Web site')); $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')) { if (!empty($this->attributes['mail'][0]) && !get_preg($_POST['mail'], 'email')) {
$return[] = $this->messages['mail'][0]; $return[] = $this->messages['mail'][0];
} }
// email aliases
$this->processMultiValueInputTextField('otherMailbox', $return, 'email');
// other telephones // other telephones
$this->processMultiValueInputTextField('otherTelephone', $return, 'telephone'); $this->processMultiValueInputTextField('otherTelephone', $return, 'telephone');
// office name // office name
@ -948,6 +968,19 @@ class windowsUser extends baseModule implements passwordService {
$errors[] = $errMsg; $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 // telephone
if ($rawAccounts[$i][$ids['windowsUser_telephoneNumber']] != "") { if ($rawAccounts[$i][$ids['windowsUser_telephoneNumber']] != "") {
if (get_preg($rawAccounts[$i][$ids['windowsUser_telephoneNumber']], 'telephone')) { 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, 'initials', _('Initials'));
$this->addSimplePDFField($return, 'l', _('Location')); $this->addSimplePDFField($return, 'l', _('Location'));
$this->addSimplePDFField($return, 'mail', _('Email address')); $this->addSimplePDFField($return, 'mail', _('Email address'));
$this->addSimplePDFField($return, 'otherMailbox', _('Email alias'));
$this->addSimplePDFField($return, 'otherTelephone', _('Other telephone numbers')); $this->addSimplePDFField($return, 'otherTelephone', _('Other telephone numbers'));
$this->addSimplePDFField($return, 'physicalDeliveryOfficeName', _('Office name')); $this->addSimplePDFField($return, 'physicalDeliveryOfficeName', _('Office name'));
$this->addSimplePDFField($return, 'postalCode', _('Postal code')); $this->addSimplePDFField($return, 'postalCode', _('Postal code'));