Kolab update
This commit is contained in:
parent
599db388f0
commit
819384f1cb
|
@ -692,6 +692,14 @@ Have fun!
|
|||
<section id="a_versUpgrade">
|
||||
<title>Version specific upgrade instructions</title>
|
||||
|
||||
<section>
|
||||
<title>4.3 -> 4.4</title>
|
||||
|
||||
<para>Kolab: User accounts get the object class "mailrecipient" by
|
||||
default. You can change this behaviour in the module settings
|
||||
section of your LAM server profile.</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>4.2.1 -> 4.3</title>
|
||||
|
||||
|
@ -2522,6 +2530,20 @@ Have fun!
|
|||
</mediaobject>
|
||||
</screenshot>
|
||||
|
||||
<para>Attention: LAM will add the object class "mailrecipient" by
|
||||
default. This object class is available on 389 directory server but
|
||||
may not be present on e.g. OpenLDAP. Please deactivate the following
|
||||
setting (LAM server profile, module settings) if you do not use this
|
||||
object class.</para>
|
||||
|
||||
<screenshot>
|
||||
<mediaobject>
|
||||
<imageobject>
|
||||
<imagedata fileref="images/mod_kolab5.png" />
|
||||
</imageobject>
|
||||
</mediaobject>
|
||||
</screenshot>
|
||||
|
||||
<para>Please enter an email address at the Personal page and set a
|
||||
Unix password first. Both are required that Kolab accepts the
|
||||
accounts. The email address ("Personal" page) must match your Kolab
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 5.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 867 B |
|
@ -469,42 +469,6 @@ class kolabGroup extends baseModule {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Controls if the module button the account page is visible and activated.
|
||||
*
|
||||
* Calling this method requires the existence of an enclosing {@link accountContainer}.<br>
|
||||
* <br>
|
||||
* <b>Possible return values:</b>
|
||||
* <ul>
|
||||
* <li><b>enabled:</b> button is visible and active</li>
|
||||
* <li><b>disabled:</b> button is visible and deactivated (greyed)</li>
|
||||
* <li><b>hidden:</b> no button will be shown</li>
|
||||
* </ul>
|
||||
*
|
||||
* @return string status ("enabled", "disabled", "hidden")
|
||||
*/
|
||||
public function getButtonStatus() {
|
||||
$module = $this->getAccountContainer()->getAccountModule('kolabSharedFolder');
|
||||
if ($module != null) {
|
||||
if ($module->extensionIsEnabled()) {
|
||||
return 'disabled';
|
||||
}
|
||||
}
|
||||
return "enabled";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if the extension is enabled for this LDAP entry.
|
||||
*
|
||||
* @return boolean enabled (= object class added to entry)
|
||||
*/
|
||||
public function extensionIsEnabled() {
|
||||
if (isset($this->attributes['objectClass']) && in_array('kolabGroupOfUniqueNames', $this->attributes['objectClass'])) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -32,11 +32,14 @@ $Id$
|
|||
*
|
||||
* @package modules
|
||||
*/
|
||||
class kolabSharedFolder extends baseModule {
|
||||
class kolabSharedFolder extends baseModule { // TODO folder type + kolabTargetFolder
|
||||
|
||||
/** cache for mailHost values */
|
||||
private $mailHostCache = null;
|
||||
|
||||
/** list of folder types (label => id) */
|
||||
private $folderTypes = array();
|
||||
|
||||
/**
|
||||
* Creates a new kolabSharedFolder object.
|
||||
*
|
||||
|
@ -45,7 +48,14 @@ class kolabSharedFolder extends baseModule {
|
|||
function __construct($scope) {
|
||||
// call parent constructor
|
||||
parent::__construct($scope);
|
||||
$this->autoAddObjectClasses = false;
|
||||
$this->folderTypes = array(
|
||||
// TODO reactivate types when stable 3.1 is released
|
||||
/*_('Shared Address Book') => 'addressbook',
|
||||
_('Shared Calendar') => 'calendar',
|
||||
_('Shared Journal') => 'journal',
|
||||
_('Shared Tasks') => 'task',*/
|
||||
_('Shared Mail Folder') => 'mail',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -60,18 +70,45 @@ class kolabSharedFolder extends baseModule {
|
|||
// icon
|
||||
$return['icon'] = 'kolab.png';
|
||||
// manages host accounts
|
||||
$return["account_types"] = array('group');
|
||||
$return["account_types"] = array('kolabSharedFolderType');
|
||||
// alias name
|
||||
$return["alias"] = _("Kolab shared folder");
|
||||
// this is a base module
|
||||
$return["is_base"] = true;
|
||||
// RDN attribute
|
||||
$return["RDN"] = array("cn" => "normal");
|
||||
// module dependencies
|
||||
$return['dependencies'] = array('depends' => array(), 'conflicts' => array());
|
||||
// LDAP filter
|
||||
$return["ldap_filter"] = array('or' => "(objectClass=kolabSharedFolder)");
|
||||
// managed object classes
|
||||
$return['objectClasses'] = array('kolabSharedFolder');
|
||||
$return['objectClasses'] = array('kolabSharedFolder', 'mailrecipient');
|
||||
// managed attributes
|
||||
$return['attributes'] = array('kolabAllowSMTPRecipient', 'kolabAllowSMTPSender', 'kolabDeleteflag', 'acl',
|
||||
'alias', 'kolabDelegate', 'kolabFolderType', 'kolabTargetFolder', 'mailHost');
|
||||
$return['attributes'] = array('cn', 'kolabAllowSMTPRecipient', 'kolabAllowSMTPSender', 'kolabDeleteflag', 'acl',
|
||||
'alias', 'kolabDelegate', 'kolabFolderType', 'kolabTargetFolder', 'mailHost', 'mail');
|
||||
// profile options
|
||||
$profileContainer = new htmlTable();
|
||||
$profileContainer->addElement(new htmlTableExtendedInputField(_('Mail server'), 'kolab_mailHost', null, 'mailHost'), true);
|
||||
$return['profile_options'] = $profileContainer;
|
||||
// profile checks
|
||||
$return['profile_checks']['kolab_mailHost'] = array(
|
||||
'type' => 'ext_preg',
|
||||
'regex' => 'DNSname',
|
||||
'error_message' => $this->messages['mailHost'][0]);
|
||||
// profile mappings
|
||||
$return['profile_mappings'] = array(
|
||||
'kolab_mailHost' => 'mailHost',
|
||||
);
|
||||
// help Entries
|
||||
$return['help'] = array(
|
||||
'cn' => array(
|
||||
"Headline" => _("Name"), 'attr' => 'cn',
|
||||
"Text" => _("Please enter a name for this folder.")
|
||||
),
|
||||
'mail' => array (
|
||||
"Headline" => _("Email address"), 'attr' => 'mail',
|
||||
"Text" => _("The folder's email address.")
|
||||
),
|
||||
'kolabAllowSMTPRecipient' => array (
|
||||
"Headline" => _('Allowed recepients'), 'attr' => 'kolabAllowSMTPRecipient',
|
||||
"Text" => _('Describes the allowed or disallowed SMTP recipient addresses for mail sent by this account (e.g. "domain.tld" or "-user@domain.tld").')
|
||||
|
@ -90,24 +127,53 @@ class kolabSharedFolder extends baseModule {
|
|||
"Text" => _('Describes the allowed or disallowed SMTP addresses sending mail to this account (e.g. "domain.tld" or "-user@domain.tld").')
|
||||
. ' ' . _("Multiple values are separated by semicolon.")
|
||||
),
|
||||
'delegate' => array(
|
||||
"Headline" => _("Delegates"), 'attr' => 'kolabDelegate',
|
||||
"Text" => _("Delegates are allowed to act on behalf of the shared folder. This property is checked when using the Kolab smtp daemon (Postfix) to send emails.")
|
||||
),
|
||||
'delegateList' => array(
|
||||
"Headline" => _("Delegates"), 'attr' => 'kolabDelegate',
|
||||
"Text" => _("This is a comma separated list of delegates.")
|
||||
),
|
||||
'alias' => array(
|
||||
"Headline" => _("Email alias"), 'attr' => 'alias',
|
||||
"Text" => _("Email alias for this account.")
|
||||
),
|
||||
'aliasList' => array(
|
||||
"Headline" => _("Email alias list"), 'attr' => 'alias',
|
||||
"Text" => _("This is a comma separated list of eMail aliases.")
|
||||
),
|
||||
'mailHost' => array(
|
||||
"Headline" => _("Mailbox home server"), 'attr' => 'mailHost',
|
||||
"Text" => _("The name of the server where the mailbox is located.")
|
||||
),
|
||||
'deleteFlag' => array(
|
||||
"Headline" => _("Mark for deletion"), 'attr' => 'kolabDeleteflag',
|
||||
"Text" => _("This will set a special flag on the account which tells Kolabd to remove it. Use this to cleanly delete Kolab accounts (e.g. this removes mail boxes).")
|
||||
),
|
||||
'addExtension' => array(
|
||||
"Headline" => _("Add Kolab extension"),
|
||||
"Text" => _("Adds this Kolab extension.")
|
||||
),
|
||||
);
|
||||
// upload fields
|
||||
$return['upload_columns'] = array(
|
||||
array(
|
||||
'name' => 'kolabSharedFolder_addExtension',
|
||||
'description' => _('Add Kolab extension'),
|
||||
'help' => 'addExtension',
|
||||
'example' => 'false',
|
||||
'default' => 'false',
|
||||
'values' => 'true, false'
|
||||
'name' => 'kolabSharedFolder_cn',
|
||||
'description' => _('Name'),
|
||||
'help' => 'cn',
|
||||
'example' => 'folder',
|
||||
'required' => true
|
||||
),
|
||||
array(
|
||||
'name' => 'kolabSharedFolder_mail',
|
||||
'description' => _('Email address'),
|
||||
'help' => 'mail',
|
||||
'example' => _('user@company.com'),
|
||||
'required' => true
|
||||
),
|
||||
array(
|
||||
'name' => 'kolabSharedFolder_mailHost',
|
||||
'description' => _('Mailbox home server'),
|
||||
'help' => 'mailHost',
|
||||
'example' => 'localhost',
|
||||
'required' => true
|
||||
),
|
||||
array(
|
||||
'name' => 'kolabSharedFolder_kolabAllowSMTPRecipient',
|
||||
|
@ -121,11 +187,28 @@ class kolabSharedFolder extends baseModule {
|
|||
'help' => 'kolabAllowSMTPSenderList',
|
||||
'example' => '.com; -.net',
|
||||
),
|
||||
array(
|
||||
'name' => 'kolabSharedFolder_aliases',
|
||||
'description' => _('Email aliases'),
|
||||
'help' => 'aliasList',
|
||||
'example' => 'user@domain,user2@domain'
|
||||
),
|
||||
array(
|
||||
'name' => 'kolabSharedFolder_delegates',
|
||||
'description' => _('Delegates'),
|
||||
'help' => 'delegateList',
|
||||
'example' => 'user@domain,user2@domain'
|
||||
),
|
||||
);
|
||||
// available PDF fields
|
||||
$return['PDF_fields'] = array(
|
||||
'cn' => _('Name'),
|
||||
'kolabAllowSMTPRecipient' => _('Allowed recepients'),
|
||||
'kolabAllowSMTPSender' => _('Allowed senders'),
|
||||
'aliases' => _('Email aliases'),
|
||||
'delegate' => _('Delegates'),
|
||||
'mailHost' => _('Mailbox home server'),
|
||||
'mail' => _('Email address'),
|
||||
);
|
||||
return $return;
|
||||
}
|
||||
|
@ -139,6 +222,14 @@ class kolabSharedFolder extends baseModule {
|
|||
$this->messages['kolabAllowSMTPSender'][0] = array('ERROR', _('Allowed senders'), _('Please enter a valid sender expression.'));
|
||||
$this->messages['kolabAllowSMTPSender'][1] = array('ERROR', _('Account %s:') . ' kolabSharedFolder_kolabAllowSMTPSender', _('Please enter a valid sender expression.'));
|
||||
$this->messages['extension'][1] = array('ERROR', _('Account %s:') . ' kolabSharedFolder_addExtension', _('You cannot add the Kolab group and shared folder extension at the same time.'));
|
||||
$this->messages['alias'][0] = array('ERROR', _('Email alias is invalid!')); // third array value is set dynamically
|
||||
$this->messages['alias'][1] = array('ERROR', _('Account %s:') . ' kolabSharedFolder_aliases', _('Email alias list has invalid format!'));
|
||||
$this->messages['delegate'][0] = array('ERROR', _('Account %s:') . ' kolabSharedFolder_delegates', _('Unknown delegate address: %s'));
|
||||
$this->messages['mailHost'][0] = array('ERROR', _('Mailbox home server name is invalid!')); // third array value is set dynamically
|
||||
$this->messages['mailHost'][1] = array('ERROR', _('Account %s:') . ' kolabSharedFolder_mailHost', _('Mailbox home server name is invalid!'));
|
||||
$this->messages['mailHost'][2] = array('ERROR', _('Mailbox home server name is empty!'));
|
||||
$this->messages['mail'][0] = array('ERROR', _('Email address'), _('Please enter a valid email address!'));
|
||||
$this->messages['mail'][1] = array('ERROR', _('Account %s:') . ' kolabSharedFolder_mail', _('Please enter a valid email address!'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -148,16 +239,59 @@ class kolabSharedFolder extends baseModule {
|
|||
*/
|
||||
function display_html_attributes() {
|
||||
$container = new htmlTable();
|
||||
if (isset($this->attributes['objectClass']) && in_array('kolabSharedFolder', $this->attributes['objectClass'])) {
|
||||
// check if account is marked for deletion
|
||||
if (isset($this->attributes['kolabDeleteflag'])) {
|
||||
$container->addElement(new htmlOutputText(_('This account is marked for deletion.')));
|
||||
return $container;
|
||||
}
|
||||
$baseContainer = new htmlTable();
|
||||
// name
|
||||
$this->addSimpleInputTextField($baseContainer, 'cn', _('Name'), true);
|
||||
// mail
|
||||
$this->addSimpleInputTextField($baseContainer, 'mail', _('Email address'), true);
|
||||
// mailbox server
|
||||
if (!isset($this->orig['mailHost'][0])) { // value currently not set
|
||||
$this->addSimpleInputTextField($baseContainer, 'mailHost', _('Mailbox home server'), true);
|
||||
}
|
||||
else { // input is unchangable when set
|
||||
$baseContainer->addElement(new htmlOutputText(_('Mailbox home server')));
|
||||
$baseContainer->addElement(new htmlOutputText($this->attributes['mailHost'][0]));
|
||||
$baseContainer->addElement(new htmlHelpLink('mailHost'), true);
|
||||
}
|
||||
// allowed recepients
|
||||
$this->addMultiValueInputTextField($container, 'kolabAllowSMTPRecipient', _('Allowed recepients'));
|
||||
$this->addMultiValueInputTextField($baseContainer, 'kolabAllowSMTPRecipient', _('Allowed recepients'));
|
||||
// allowed senders
|
||||
$this->addMultiValueInputTextField($container, 'kolabAllowSMTPSender', _('Allowed senders'));
|
||||
$this->addMultiValueInputTextField($baseContainer, 'kolabAllowSMTPSender', _('Allowed senders'));
|
||||
$container->addElement($baseContainer, true);
|
||||
// mail aliases
|
||||
$container->addElement(new htmlSubTitle(_('Email aliases')), true);
|
||||
$this->addMultiValueInputTextField($container, 'alias');
|
||||
// delegates
|
||||
$delegates = searchLDAPByAttribute('mail', '*', 'inetOrgPerson', array('mail'), array('user'));
|
||||
for ($i = 0; $i < sizeof($delegates); $i++) {
|
||||
$delegates[$i] = $delegates[$i]['mail'][0];
|
||||
}
|
||||
sort($delegates);
|
||||
$container->addElement(new htmlSubTitle(_('Delegates')), true);
|
||||
$delegatesContainer = new htmlTable();
|
||||
$delegatesContainer->colspan = 3;
|
||||
if (isset($this->attributes['kolabDelegate'])) {
|
||||
for ($i = 0; $i < sizeof($this->attributes['kolabDelegate']); $i++) {
|
||||
$delegatesContainer->addElement(new htmlSelect('delegate' . $i, $delegates, array($this->attributes['kolabDelegate'][$i])));
|
||||
$delegatesContainer->addElement(new htmlButton('delDelegate' . $i, 'del.png', true));
|
||||
if ($i == 0) {
|
||||
$delegatesContainer->addElement(new htmlHelpLink('delegate'));
|
||||
}
|
||||
$delegatesContainer->addNewLine();
|
||||
}
|
||||
}
|
||||
// input box for new delegate
|
||||
$delegatesContainer->addElement(new htmlSelect('delegate', $delegates));
|
||||
$delegatesContainer->addElement(new htmlButton('addDelegate', 'add.png', true));
|
||||
if (empty($this->attributes['kolabDelegate'])) {
|
||||
$delegatesContainer->addElement(new htmlHelpLink('delegate'));
|
||||
}
|
||||
$container->addElement($delegatesContainer, true);
|
||||
// delete flag
|
||||
$this->loadMailHostCache();
|
||||
if (!$this->getAccountContainer()->isNewAccount && (sizeof($this->mailHostCache) > 0)) {
|
||||
|
@ -167,11 +301,6 @@ class kolabSharedFolder extends baseModule {
|
|||
$deleteContainer->addElement(new htmlHelpLink('deleteFlag'));
|
||||
$container->addElement($deleteContainer);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// add button
|
||||
$container->addElement(new htmlButton('addObjectClass', _('Add Kolab extension')));
|
||||
}
|
||||
return $container;
|
||||
}
|
||||
|
||||
|
@ -183,28 +312,49 @@ class kolabSharedFolder extends baseModule {
|
|||
*/
|
||||
function process_attributes() {
|
||||
$errors = array();
|
||||
if (isset($_POST['addObjectClass'])) {
|
||||
$this->attributes['objectClass'][] = 'kolabSharedFolder';
|
||||
return $errors;
|
||||
// cn
|
||||
$this->attributes['cn'][0] = $_POST['cn'];
|
||||
// mail
|
||||
$this->attributes['mail'][0] = $_POST['mail'];
|
||||
if (empty($_POST['mail']) || !get_preg($_POST['mail'], 'email')) {
|
||||
$errors[] = $this->messages['mail'][0];
|
||||
}
|
||||
if (isset($_POST['remObjectClass'])) {
|
||||
$this->attributes['objectClass'] = array_delete(array('kolabSharedFolder'), $this->attributes['objectClass']);
|
||||
$attrs = $this->meta['attributes'];
|
||||
foreach ($attrs as $name) {
|
||||
if (isset($this->attributes[$name])) {
|
||||
unset($this->attributes[$name]);
|
||||
// mailbox server
|
||||
if (isset($_POST['mailHost'])) {
|
||||
if ($_POST['mailHost'] == "") {
|
||||
$errors[] = $this->messages['mailHost'][2];
|
||||
}
|
||||
elseif (get_preg($_POST['mailHost'], 'DNSname')) {
|
||||
$this->attributes['mailHost'][0] = $_POST['mailHost'];
|
||||
}
|
||||
return $errors;
|
||||
else {
|
||||
$message = $this->messages['mailHost'][0];
|
||||
$message[] = $_POST['mailHost'];
|
||||
$errors[] = $message;
|
||||
}
|
||||
// skip processing if object class is not set
|
||||
if (!isset($this->attributes['objectClass']) || !in_array('kolabSharedFolder', $this->attributes['objectClass'])) {
|
||||
return $errors;
|
||||
}
|
||||
// allowed recepients
|
||||
$this->processMultiValueInputTextField('kolabAllowSMTPRecipient', $errors, 'kolabEmailPrefix');
|
||||
// allowed senders
|
||||
$this->processMultiValueInputTextField('kolabAllowSMTPSender', $errors, 'kolabEmailPrefix');
|
||||
// mail aliases
|
||||
$this->processMultiValueInputTextField('alias', $errors, 'email');
|
||||
// check old delegates
|
||||
$this->attributes['kolabDelegate'] = array();
|
||||
$i = 0;
|
||||
while (isset($_POST['delegate' . $i])) {
|
||||
if (isset($_POST['delDelegate' . $i])) {
|
||||
$i++;
|
||||
continue;
|
||||
}
|
||||
$this->attributes['kolabDelegate'][] = $_POST['delegate' . $i];
|
||||
$i++;
|
||||
}
|
||||
// check new delegate
|
||||
if (isset($_POST['addDelegate']) && ($_POST['delegate'] != "")) {
|
||||
$this->attributes['kolabDelegate'][] = $_POST['delegate'];
|
||||
}
|
||||
$this->attributes['kolabDelegate'] = array_unique($this->attributes['kolabDelegate']);
|
||||
return $errors;
|
||||
}
|
||||
|
||||
|
@ -239,26 +389,6 @@ class kolabSharedFolder extends baseModule {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of modifications which have to be made to the LDAP account.
|
||||
*
|
||||
* @return array list of modifications
|
||||
* <br>This function returns an array with 3 entries:
|
||||
* <br>array( DN1 ('add' => array($attr), 'remove' => array($attr), 'modify' => array($attr)), DN2 .... )
|
||||
* <br>DN is the DN to change. It may be possible to change several DNs (e.g. create a new user and add him to some groups via attribute memberUid)
|
||||
* <br>"add" are attributes which have to be added to LDAP entry
|
||||
* <br>"remove" are attributes which have to be removed from LDAP entry
|
||||
* <br>"modify" are attributes which have to been modified in LDAP entry
|
||||
* <br>"info" are values with informational value (e.g. to be used later by pre/postModify actions)
|
||||
*/
|
||||
function save_attributes() {
|
||||
if (!in_array('kolabSharedFolder', $this->attributes['objectClass']) && !in_array('kolabSharedFolder', $this->orig['objectClass'])) {
|
||||
// skip saving if the extension was not added/modified
|
||||
return array();
|
||||
}
|
||||
return parent::save_attributes();
|
||||
}
|
||||
|
||||
/**
|
||||
* In this function the LDAP account is built up.
|
||||
*
|
||||
|
@ -270,23 +400,42 @@ class kolabSharedFolder extends baseModule {
|
|||
*/
|
||||
function build_uploadAccounts($rawAccounts, $ids, &$partialAccounts, $selectedModules) {
|
||||
$messages = array();
|
||||
$delegates = searchLDAPByAttribute(null, null, 'inetOrgPerson', array('mail'), array('user'));
|
||||
for ($d = 0; $d < sizeof($delegates); $d++) {
|
||||
if (isset($delegates[$d]['mail'][0])) {
|
||||
$delegates[$d] = $delegates[$d]['mail'][0];
|
||||
}
|
||||
}
|
||||
for ($i = 0; $i < sizeof($rawAccounts); $i++) {
|
||||
// check if extension should be added
|
||||
if (isset($rawAccounts[$i][$ids['kolabSharedFolder_addExtension']]) && ($rawAccounts[$i][$ids['kolabSharedFolder_addExtension']] != 'true')) {
|
||||
continue;
|
||||
}
|
||||
// check if both group and shared folder enxtension should be added
|
||||
if (isset($rawAccounts[$i][$ids['kolabSharedFolder_addExtension']]) && ($rawAccounts[$i][$ids['kolabSharedFolder_addExtension']] == 'true')
|
||||
&& isset($rawAccounts[$i][$ids['kolabGroup_addExtension']]) && ($rawAccounts[$i][$ids['kolabGroup_addExtension']] == 'true')) {
|
||||
$errMsg = $this->messages['extension'][1];
|
||||
array_push($errMsg, array($i));
|
||||
$messages[] = $errMsg;
|
||||
continue;
|
||||
}
|
||||
// add object classes
|
||||
if (!in_array('kolabSharedFolder', $partialAccounts[$i]['objectClass'])) {
|
||||
$partialAccounts[$i]['objectClass'][] = 'kolabSharedFolder';
|
||||
}
|
||||
if (!in_array('mailrecipient', $partialAccounts[$i]['objectClass'])) {
|
||||
$partialAccounts[$i]['objectClass'][] = 'mailrecipient';
|
||||
}
|
||||
// cn
|
||||
$partialAccounts[$i]['cn'] = $rawAccounts[$i][$ids['kolabSharedFolder_cn']];
|
||||
// mail
|
||||
if (!get_preg($rawAccounts[$i][$ids['kolabSharedFolder_mail']], 'email')) {
|
||||
$errMsg = $this->messages['mail'][1];
|
||||
array_push($errMsg, array($i));
|
||||
$messages[] = $errMsg;
|
||||
}
|
||||
else {
|
||||
$partialAccounts[$i]['mail'] = $rawAccounts[$i][$ids['kolabSharedFolder_mail']];
|
||||
}
|
||||
// mailbox server
|
||||
if ($rawAccounts[$i][$ids['kolabSharedFolder_mailHost']] != "") {
|
||||
if (get_preg($rawAccounts[$i][$ids['kolabSharedFolder_mailHost']], 'DNSname')) {
|
||||
$partialAccounts[$i]['mailHost'] = $rawAccounts[$i][$ids['kolabSharedFolder_mailHost']];
|
||||
}
|
||||
else {
|
||||
$errMsg = $this->messages['mailHost'][1];
|
||||
array_push($errMsg, array($i));
|
||||
$messages[] = $errMsg;
|
||||
}
|
||||
}
|
||||
// allowed recipients
|
||||
if (!empty($rawAccounts[$i][$ids['kolabSharedFolder_kolabAllowSMTPRecipient']])) {
|
||||
$mails = preg_split('/;[ ]*/', $rawAccounts[$i][$ids['kolabSharedFolder_kolabAllowSMTPRecipient']]);
|
||||
|
@ -317,6 +466,38 @@ class kolabSharedFolder extends baseModule {
|
|||
}
|
||||
}
|
||||
}
|
||||
// add mail aliases
|
||||
if ($rawAccounts[$i][$ids['kolabSharedFolder_aliases']] != "") {
|
||||
$aliases = explode(',', $rawAccounts[$i][$ids['kolabSharedFolder_aliases']]);
|
||||
// check format
|
||||
for ($a = 0; $a < sizeof($aliases); $a++) {
|
||||
if (get_preg($aliases[$a], 'email')) {
|
||||
$partialAccounts[$i]['alias'][] = $aliases[$a];
|
||||
}
|
||||
// invalid format
|
||||
else {
|
||||
$errMsg = $this->messages['alias'][1];
|
||||
array_push($errMsg, array($i));
|
||||
$messages[] = $errMsg;
|
||||
}
|
||||
}
|
||||
}
|
||||
// add delegates
|
||||
if ($rawAccounts[$i][$ids['kolabSharedFolder_delegates']] != "") {
|
||||
$newDelegates = explode(',', $rawAccounts[$i][$ids['kolabSharedFolder_delegates']]);
|
||||
// check format
|
||||
for ($d = 0; $d < sizeof($newDelegates); $d++) {
|
||||
if (in_array($newDelegates[$d], $delegates)) {
|
||||
$partialAccounts[$i]['kolabDelegate'][] = $newDelegates[$d];
|
||||
}
|
||||
// invalid format
|
||||
else {
|
||||
$errMsg = $this->messages['delegate'][0];
|
||||
array_push($errMsg, array($i, $newDelegates[$d]));
|
||||
$messages[] = $errMsg;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $messages;
|
||||
}
|
||||
|
@ -326,8 +507,13 @@ class kolabSharedFolder extends baseModule {
|
|||
*/
|
||||
function get_pdfEntries() {
|
||||
$return = array();
|
||||
$this->addSimplePDFField($return, 'cn', _('Name'));
|
||||
$this->addSimplePDFField($return, 'mail', _('Email address'));
|
||||
$this->addSimplePDFField($return, 'mailHost', _('Mailbox home server'));
|
||||
$this->addSimplePDFField($return, 'kolabAllowSMTPRecipient', _('Allowed recepients'));
|
||||
$this->addSimplePDFField($return, 'kolabAllowSMTPSender', _('Allowed senders'));
|
||||
$this->addSimplePDFField($return, 'aliases', _('Email aliases'), 'alias');
|
||||
$this->addSimplePDFField($return, 'delegate', _('Delegates'), 'kolabDelegate');
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
@ -347,42 +533,6 @@ class kolabSharedFolder extends baseModule {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Controls if the module button the account page is visible and activated.
|
||||
*
|
||||
* Calling this method requires the existence of an enclosing {@link accountContainer}.<br>
|
||||
* <br>
|
||||
* <b>Possible return values:</b>
|
||||
* <ul>
|
||||
* <li><b>enabled:</b> button is visible and active</li>
|
||||
* <li><b>disabled:</b> button is visible and deactivated (greyed)</li>
|
||||
* <li><b>hidden:</b> no button will be shown</li>
|
||||
* </ul>
|
||||
*
|
||||
* @return string status ("enabled", "disabled", "hidden")
|
||||
*/
|
||||
public function getButtonStatus() {
|
||||
$module = $this->getAccountContainer()->getAccountModule('kolabGroup');
|
||||
if ($module != null) {
|
||||
if ($module->extensionIsEnabled()) {
|
||||
return 'disabled';
|
||||
}
|
||||
}
|
||||
return "enabled";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if the extension is enabled for this LDAP entry.
|
||||
*
|
||||
* @return boolean enabled (= object class added to entry)
|
||||
*/
|
||||
public function extensionIsEnabled() {
|
||||
if (isset($this->attributes['objectClass']) && in_array('kolabSharedFolder', $this->attributes['objectClass'])) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -77,9 +77,15 @@ class kolabUser extends baseModule {
|
|||
$return["ldap_filter"] = array('or' => "(objectClass=kolabInetOrgPerson)");
|
||||
// managed object classes
|
||||
$return['objectClasses'] = array('kolabInetOrgPerson');
|
||||
if ($this->manageMailrecipient()) {
|
||||
$return['objectClasses'][] = 'mailrecipient';
|
||||
}
|
||||
// managed attributes
|
||||
$return['attributes'] = array('alias', 'mailHost', 'kolabDelegate', 'kolabInvitationPolicy', 'kolabDeleteflag',
|
||||
'kolabAllowSMTPRecipient', 'kolabAllowSMTPSender');
|
||||
if ($this->manageMailrecipient()) {
|
||||
$return['attributes'][] = 'mailQuota';
|
||||
}
|
||||
// profile options
|
||||
$profileContainer = new htmlTable();
|
||||
$profileContainer->addElement(new htmlTableExtendedInputField(_('Mail server'), 'kolab_mailHost', null, 'mailHost'), true);
|
||||
|
@ -93,6 +99,10 @@ class kolabUser extends baseModule {
|
|||
$return['profile_mappings'] = array(
|
||||
'kolab_mailHost' => 'mailHost',
|
||||
);
|
||||
// config options
|
||||
$configContainer = new htmlTable();
|
||||
$configContainer->addElement(new htmlTableExtendedInputCheckbox('kolabUser_mailrecipient', true, _('Manage object class "mailrecipient"'), 'mailrecipient'), true);
|
||||
$return['config_options']['all'] = $configContainer;
|
||||
// self service field settings
|
||||
$return['selfServiceFieldSettings'] = array(
|
||||
'kolabDelegate' => _('Delegates'),
|
||||
|
@ -148,10 +158,15 @@ class kolabUser extends baseModule {
|
|||
"Text" => _('Describes the allowed or disallowed SMTP addresses sending mail to this account (e.g. "domain.tld" or "-user@domain.tld").')
|
||||
. ' ' . _("Multiple values are separated by semicolon.")
|
||||
),
|
||||
'mailrecipient' => array(
|
||||
"Headline" => _('Manage object class "mailrecipient"'),
|
||||
"Text" => _('Adds the object class "mailrecipient" to all user accounts.')
|
||||
),
|
||||
'deleteFlag' => array(
|
||||
"Headline" => _("Mark for deletion"), 'attr' => 'kolabDeleteflag',
|
||||
"Text" => _("This will set a special flag on the account which tells Kolabd to remove it. Use this to cleanly delete Kolab accounts (e.g. this removes mail boxes).")
|
||||
));
|
||||
),
|
||||
);
|
||||
// upload fields
|
||||
$return['upload_columns'] = array(
|
||||
array(
|
||||
|
@ -215,7 +230,7 @@ class kolabUser extends baseModule {
|
|||
$this->messages['mailHost'][0] = array('ERROR', _('Mailbox home server name is invalid!')); // third array value is set dynamically
|
||||
$this->messages['mailHost'][1] = array('ERROR', _('Account %s:') . ' kolabUser_mailHost', _('Mailbox home server name is invalid!'));
|
||||
$this->messages['mailHost'][2] = array('ERROR', _('Mailbox home server name is empty!'));
|
||||
$this->messages['delegate'][0] = array('ERROR', _('Account %s:') . ' kolabUser_delegate', _('Unknown delegate address: %s'));
|
||||
$this->messages['delegate'][0] = array('ERROR', _('Account %s:') . ' kolabUser_delegates', _('Unknown delegate address: %s'));
|
||||
$this->messages['kolabAllowSMTPRecipient'][0] = array('ERROR', _('Allowed recepients'), _('Please enter a valid recepient expression.'));
|
||||
$this->messages['kolabAllowSMTPRecipient'][1] = array('ERROR', _('Account %s:') . ' kolabUser_kolabAllowSMTPRecipient', _('Please enter a valid recepient expression.'));
|
||||
$this->messages['kolabAllowSMTPSender'][0] = array('ERROR', _('Allowed senders'), _('Please enter a valid sender expression.'));
|
||||
|
@ -317,13 +332,18 @@ class kolabUser extends baseModule {
|
|||
for ($i = 0; $i < sizeof($this->attributes['kolabDelegate']); $i++) {
|
||||
$delegatesContainer->addElement(new htmlSelect('delegate' . $i, $delegates, array($this->attributes['kolabDelegate'][$i])));
|
||||
$delegatesContainer->addElement(new htmlButton('delDelegate' . $i, 'del.png', true));
|
||||
$delegatesContainer->addElement(new htmlHelpLink('delegate'), true);
|
||||
if ($i == 0) {
|
||||
$delegatesContainer->addElement(new htmlHelpLink('delegate'));
|
||||
}
|
||||
$delegatesContainer->addNewLine();
|
||||
}
|
||||
}
|
||||
// input box for new delegate
|
||||
$delegatesContainer->addElement(new htmlSelect('delegate', $delegates));
|
||||
$delegatesContainer->addElement(new htmlButton('addDelegate', 'add.png', true));
|
||||
$delegatesContainer->addElement(new htmlHelpLink('delegate'), true);
|
||||
if (empty($this->attributes['kolabDelegate'])) {
|
||||
$delegatesContainer->addElement(new htmlHelpLink('delegate'));
|
||||
}
|
||||
$return->addElement($delegatesContainer, true);
|
||||
$return->addElement(new htmlSubTitle(_('Options')), true);
|
||||
// allowed recepients
|
||||
|
@ -355,6 +375,9 @@ class kolabUser extends baseModule {
|
|||
$errors = array();
|
||||
if (isset($_POST['addObjectClass'])) {
|
||||
$this->attributes['objectClass'][] = 'kolabInetOrgPerson';
|
||||
if ($this->manageMailrecipient()) {
|
||||
$this->attributes['objectClass'][] = 'mailrecipient';
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (isset($_POST['form_subpage_kolabUser_deleteUser_open'])) return array();
|
||||
|
@ -525,7 +548,12 @@ class kolabUser extends baseModule {
|
|||
}
|
||||
for ($i = 0; $i < sizeof($rawAccounts); $i++) {
|
||||
// add object class
|
||||
if (!in_array("kolabInetOrgPerson", $partialAccounts[$i]['objectClass'])) $partialAccounts[$i]['objectClass'][] = "kolabInetOrgPerson";
|
||||
if (!in_array("kolabInetOrgPerson", $partialAccounts[$i]['objectClass'])) {
|
||||
$partialAccounts[$i]['objectClass'][] = "kolabInetOrgPerson";
|
||||
}
|
||||
if ($this->manageMailrecipient() && !in_array("mailrecipient", $partialAccounts[$i]['objectClass'])) {
|
||||
$partialAccounts[$i]['objectClass'][] = "mailrecipient";
|
||||
}
|
||||
// mailbox server
|
||||
if ($rawAccounts[$i][$ids['kolabUser_mailHost']] != "") {
|
||||
if (get_preg($rawAccounts[$i][$ids['kolabUser_mailHost']], 'DNSname')) {
|
||||
|
@ -915,6 +943,23 @@ class kolabUser extends baseModule {
|
|||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if the object class "mailrecipient" is managed by this module.
|
||||
*
|
||||
* @return boolean manage mailrecipient object class
|
||||
*/
|
||||
private function manageMailrecipient() {
|
||||
// abort if configuration is not available
|
||||
if (!isset($this->moduleSettings) || !is_array($this->moduleSettings)) {
|
||||
return true;
|
||||
}
|
||||
if (isset($this->moduleSettings['kolabUser_mailrecipient'][0]) && ($this->moduleSettings['kolabUser_mailrecipient'][0] == 'false')) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,150 @@
|
|||
<?php
|
||||
/*
|
||||
$Id$
|
||||
|
||||
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
||||
Copyright (C) 2013 Roland Gruber
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* The account type for Kolab shared folders.
|
||||
*
|
||||
* @package types
|
||||
* @author Roland Gruber
|
||||
*/
|
||||
|
||||
/**
|
||||
* The account type for Kolab shared folders.
|
||||
*
|
||||
* @package types
|
||||
*/
|
||||
class kolabSharedFolderType extends baseType {
|
||||
|
||||
/**
|
||||
* Constructs a new shared folder object.
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
$this->LABEL_CREATE_ANOTHER_ACCOUNT = _('Create another shared folder');
|
||||
$this->LABEL_BACK_TO_ACCOUNT_LIST = _('Back to shared folder list');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the alias name of this account type.
|
||||
*
|
||||
* @return string alias name
|
||||
*/
|
||||
function getAlias() {
|
||||
return _("Kolab shared folders");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of this account type.
|
||||
*
|
||||
* @return string description
|
||||
*/
|
||||
function getDescription() {
|
||||
return _("Kolab shared folders (e.g. mail folders)");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the class name for the list object.
|
||||
*
|
||||
* @return string class name
|
||||
*/
|
||||
function getListClassName() {
|
||||
return "kolabSharedFolderTypeList";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default attribute list for this account type.
|
||||
*
|
||||
* @return string attribute list
|
||||
*/
|
||||
function getDefaultListAttributes() {
|
||||
return "#cn;#kolabDelegate;#alias";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of attributes which have a translated description.
|
||||
* This is used for the head row in the list view.
|
||||
*
|
||||
* @return array list of descriptions
|
||||
*/
|
||||
function getListAttributeDescriptions() {
|
||||
return array (
|
||||
"kolabDelegate" => _('Delegates'),
|
||||
'alias' => _('Email aliases'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the the title text for the title bar on the new/edit page.
|
||||
*
|
||||
* @param accountContainer $container account container
|
||||
* @return String title text
|
||||
*/
|
||||
public function getTitleBarTitle($container) {
|
||||
// get attributes
|
||||
$attributes = array();
|
||||
if ($container->getAccountModule('kolabSharedFolder') != null) {
|
||||
$attributes = $container->getAccountModule('kolabSharedFolder')->getAttributes();
|
||||
}
|
||||
// check if cn is set
|
||||
if (isset($attributes['cn'][0])) {
|
||||
return htmlspecialchars($attributes['cn'][0]);
|
||||
}
|
||||
// show new label
|
||||
if ($container->isNewAccount) {
|
||||
return _("New shared folder");
|
||||
}
|
||||
// fall back to default
|
||||
return parent::getTitleBarTitle($container);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates the list view.
|
||||
*
|
||||
* @package lists
|
||||
* @author Roland Gruber
|
||||
*
|
||||
*/
|
||||
class kolabSharedFolderTypeList extends lamList {
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $type account type
|
||||
* @return lamList list object
|
||||
*/
|
||||
function __construct($type) {
|
||||
parent::__construct($type);
|
||||
$this->labels = array(
|
||||
'nav' => _("Shared folder count: %s"),
|
||||
'error_noneFound' => _("No shared folders found!"),
|
||||
'newEntry' => _("New shared folder"),
|
||||
'deleteEntry' => _("Delete selected shared folders"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
|
@ -569,3 +569,7 @@ h4.schema_oclass_sub {
|
|||
.bind-bright { background:#b6eeff !important; }
|
||||
.bind-dark { background-color:#80e0e1 !important; }
|
||||
|
||||
.kolabSharedFolderType-border { border-color:#32768b; }
|
||||
.kolabSharedFolderType-bright { background:#b6eeff !important; }
|
||||
.kolabSharedFolderType-dark { background-color:#80e0e1 !important; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue