2013-11-02 15:06:03 +00:00
< ? php
/*
This code is part of LDAP Account Manager ( http :// www . ldap - account - manager . org / )
2018-05-19 07:48:12 +00:00
Copyright ( C ) 2013 - 2018 Roland Gruber
2013-11-02 15:06:03 +00:00
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
*/
/**
* Manages Kolab shared folders .
*
* @ package modules
* @ author Roland Gruber
*/
/**
* Manages Kolab shared folders .
*
* @ package modules
*/
2017-09-17 07:59:21 +00:00
class kolabSharedFolder extends baseModule {
2015-08-15 18:11:54 +00:00
2013-11-03 17:17:47 +00:00
/** list of folder types (label => id) */
private $folderTypes = array ();
2015-08-15 18:11:54 +00:00
2013-11-02 15:06:03 +00:00
/**
* Creates a new kolabSharedFolder object .
*
* @ param string $scope account type ( user , group , host )
*/
function __construct ( $scope ) {
// call parent constructor
parent :: __construct ( $scope );
2013-11-03 17:17:47 +00:00
$this -> folderTypes = array (
2013-11-03 20:00:12 +00:00
_ ( 'Shared mail folder' ) => 'mail' ,
2013-11-03 17:17:47 +00:00
);
2013-11-02 15:06:03 +00:00
}
2014-04-20 13:00:42 +00:00
/**
* Returns true if this module can manage accounts of the current type , otherwise false .
2015-08-15 18:11:54 +00:00
*
2014-04-20 13:00:42 +00:00
* @ return boolean true if module fits
*/
public function can_manage () {
return in_array ( $this -> get_scope (), array ( 'kolabSharedFolderType' ));
}
2013-11-02 15:06:03 +00:00
/**
* Returns meta data that is interpreted by parent class
*
* @ return array array with meta data
2015-08-15 18:11:54 +00:00
*
2013-11-02 15:06:03 +00:00
* @ see baseModule :: get_metaData ()
*/
function get_metaData () {
$return = array ();
// icon
$return [ 'icon' ] = 'kolab.png' ;
// alias name
$return [ " alias " ] = _ ( " Kolab shared folder " );
2013-11-03 17:17:47 +00:00
// this is a base module
$return [ " is_base " ] = true ;
// RDN attribute
$return [ " RDN " ] = array ( " cn " => " normal " );
2013-11-02 15:06:03 +00:00
// module dependencies
$return [ 'dependencies' ] = array ( 'depends' => array (), 'conflicts' => array ());
2013-11-03 17:17:47 +00:00
// LDAP filter
$return [ " ldap_filter " ] = array ( 'or' => " (objectClass=kolabSharedFolder) " );
2013-11-02 15:06:03 +00:00
// managed object classes
2013-11-03 17:17:47 +00:00
$return [ 'objectClasses' ] = array ( 'kolabSharedFolder' , 'mailrecipient' );
2013-11-02 15:06:03 +00:00
// managed attributes
2018-07-14 14:23:35 +00:00
$return [ 'attributes' ] = array ( 'cn' , 'kolabAllowSMTPRecipient' , 'kolabAllowSMTPSender' , 'acl' ,
'alias' , 'kolabDelegate' , 'kolabFolderType' , 'kolabTargetFolder' , 'mail' );
2013-11-02 15:06:03 +00:00
// help Entries
$return [ 'help' ] = array (
2013-11-03 17:17:47 +00:00
'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. " )
),
2013-11-02 15:06:03 +00:00
'kolabAllowSMTPRecipient' => array (
2013-12-01 10:02:20 +00:00
" Headline " => _ ( 'Allowed recipients' ), 'attr' => 'kolabAllowSMTPRecipient' ,
2018-09-04 17:55:05 +00:00
" Text " => _ ( 'Describes the allowed or disallowed SMTP recipient addresses for mail sent by this account (e.g. "domain.tld" or "-user@domain.tld").' )
2013-11-02 15:06:03 +00:00
),
'kolabAllowSMTPRecipientList' => array (
2013-12-01 10:02:20 +00:00
" Headline " => _ ( 'Allowed recipients' ), 'attr' => 'kolabAllowSMTPRecipient' ,
2018-09-04 17:55:05 +00:00
" Text " => _ ( 'Describes the allowed or disallowed SMTP recipient addresses for mail sent by this account (e.g. "domain.tld" or "-user@domain.tld").' )
2013-11-02 15:06:03 +00:00
. ' ' . _ ( " Multiple values are separated by semicolon. " )
),
'kolabAllowSMTPSender' => array (
" Headline " => _ ( 'Allowed senders' ), 'attr' => 'kolabAllowSMTPSender' ,
2018-09-04 17:55:05 +00:00
" Text " => _ ( 'Describes the allowed or disallowed SMTP addresses sending mail to this account (e.g. "domain.tld" or "-user@domain.tld").' )
2013-11-02 15:06:03 +00:00
),
'kolabAllowSMTPSenderList' => array (
" Headline " => _ ( 'Allowed senders' ), 'attr' => 'kolabAllowSMTPSender' ,
2018-09-04 17:55:05 +00:00
" Text " => _ ( 'Describes the allowed or disallowed SMTP addresses sending mail to this account (e.g. "domain.tld" or "-user@domain.tld").' )
2013-11-02 15:06:03 +00:00
. ' ' . _ ( " Multiple values are separated by semicolon. " )
),
2013-11-03 17:17:47 +00:00
'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' ,
2018-07-14 14:23:35 +00:00
" Text " => _ ( " This is a semi-colon separated list of delegates. " )
2013-11-03 17:17:47 +00:00
),
'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. " )
),
2013-11-03 20:00:12 +00:00
'kolabTargetFolder' => array (
" Headline " => _ ( " Target IMAP folder " ), 'attr' => 'kolabTargetFolder' ,
2018-07-14 14:23:35 +00:00
" Text " => _ ( " The folder on the server where the shared folder is located (e.g. shared/myfolder@example.com). " )
2013-11-03 20:00:12 +00:00
),
'kolabFolderType' => array (
" Headline " => _ ( " Type " ), 'attr' => 'kolabFolderType' ,
" Text " => _ ( " Specifies the folder type (e.g. shared mail folder). " )
),
2013-11-02 15:06:03 +00:00
);
// upload fields
$return [ 'upload_columns' ] = array (
array (
2013-11-03 17:17:47 +00:00
'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
),
2013-11-03 20:00:12 +00:00
array (
'name' => 'kolabSharedFolder_kolabTargetFolder' ,
'description' => _ ( 'Target IMAP folder' ),
'help' => 'kolabTargetFolder' ,
2018-07-14 14:23:35 +00:00
'example' => 'shared/myfolder@example.com' ,
2013-11-03 20:00:12 +00:00
'required' => true
),
array (
'name' => 'kolabSharedFolder_kolabFolderType' ,
'description' => _ ( 'Type' ),
'help' => 'kolabFolderType' ,
'example' => 'mail' ,
2013-11-03 17:17:47 +00:00
'required' => true
2013-11-02 15:06:03 +00:00
),
array (
'name' => 'kolabSharedFolder_kolabAllowSMTPRecipient' ,
2013-12-01 10:02:20 +00:00
'description' => _ ( 'Allowed recipients' ),
2013-11-02 15:06:03 +00:00
'help' => 'kolabAllowSMTPRecipientList' ,
'example' => '.com; -.net' ,
),
array (
'name' => 'kolabSharedFolder_kolabAllowSMTPSender' ,
'description' => _ ( 'Allowed senders' ),
'help' => 'kolabAllowSMTPSenderList' ,
'example' => '.com; -.net' ,
),
2013-11-03 17:17:47 +00:00
array (
'name' => 'kolabSharedFolder_aliases' ,
'description' => _ ( 'Email aliases' ),
'help' => 'aliasList' ,
'example' => 'user@domain,user2@domain'
),
array (
'name' => 'kolabSharedFolder_delegates' ,
'description' => _ ( 'Delegates' ),
'help' => 'delegateList' ,
2018-07-14 14:23:35 +00:00
'example' => 'uid=user,ou=People,dc=example,dc=com;uid=user2,ou=People,dc=example,dc=com'
2013-11-03 17:17:47 +00:00
),
2013-11-02 15:06:03 +00:00
);
// available PDF fields
$return [ 'PDF_fields' ] = array (
2013-11-03 17:17:47 +00:00
'cn' => _ ( 'Name' ),
2013-12-01 10:02:20 +00:00
'kolabAllowSMTPRecipient' => _ ( 'Allowed recipients' ),
2013-11-02 15:06:03 +00:00
'kolabAllowSMTPSender' => _ ( 'Allowed senders' ),
2013-11-03 17:17:47 +00:00
'aliases' => _ ( 'Email aliases' ),
'delegate' => _ ( 'Delegates' ),
'mail' => _ ( 'Email address' ),
2013-11-03 20:00:12 +00:00
'kolabTargetFolder' => _ ( 'Target IMAP folder' ),
'kolabFolderType' => _ ( 'Type' ),
2013-11-02 15:06:03 +00:00
);
return $return ;
}
/**
* This function fills the $messages variable with output messages from this module .
*/
function load_Messages () {
2013-12-07 16:49:23 +00:00
$this -> messages [ 'kolabAllowSMTPRecipient' ][ 0 ] = array ( 'ERROR' , _ ( 'Allowed recipients' ), _ ( 'Please enter a valid recipient expression.' ));
$this -> messages [ 'kolabAllowSMTPRecipient' ][ 1 ] = array ( 'ERROR' , _ ( 'Account %s:' ) . ' kolabSharedFolder_kolabAllowSMTPRecipient' , _ ( 'Please enter a valid recipient expression.' ));
2013-11-02 15:06:03 +00:00
$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.' ));
2013-11-03 17:17:47 +00:00
$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!' ));
2018-07-14 14:23:35 +00:00
$this -> messages [ 'delegate' ][ 0 ] = array ( 'ERROR' , _ ( 'Account %s:' ) . ' kolabSharedFolder_delegates' , _ ( 'Unknown delegate: %s' ));
2013-11-03 17:17:47 +00:00
$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!' ));
2013-11-03 20:00:12 +00:00
$this -> messages [ 'cn' ][ 0 ] = array ( 'ERROR' , _ ( 'Name' ), _ ( 'Please enter a name.' ));
$this -> messages [ 'kolabTargetFolder' ][ 0 ] = array ( 'ERROR' , _ ( 'Target IMAP folder' ), _ ( 'Please enter a target folder.' ));
2013-11-02 15:06:03 +00:00
}
/**
* Returns the HTML meta data for the main account page .
2015-08-15 18:11:54 +00:00
*
2013-11-02 15:06:03 +00:00
* @ return htmlElement HTML meta data
*/
function display_html_attributes () {
$container = new htmlTable ();
2013-11-03 17:17:47 +00:00
$baseContainer = new htmlTable ();
// name
$this -> addSimpleInputTextField ( $baseContainer , 'cn' , _ ( 'Name' ), true );
// mail
$this -> addSimpleInputTextField ( $baseContainer , 'mail' , _ ( 'Email address' ), true );
2013-11-03 20:00:12 +00:00
// target folder
$this -> addSimpleInputTextField ( $baseContainer , 'kolabTargetFolder' , _ ( 'Target IMAP folder' ), true );
// folder type
$possibleTypes = $this -> folderTypes ;
$selectedTypes = array ( 'mail' );
if ( ! empty ( $this -> attributes [ 'kolabFolderType' ])) {
$selectedTypes = $this -> attributes [ 'kolabFolderType' ];
if ( ! in_array ( $this -> attributes [ 'kolabFolderType' ][ 0 ], $possibleTypes )) {
$possibleTypes [ $this -> attributes [ 'kolabFolderType' ][ 0 ]] = $this -> attributes [ 'kolabFolderType' ][ 0 ];
}
}
$typeSelect = new htmlTableExtendedSelect ( 'kolabFolderType' , $possibleTypes , $selectedTypes , _ ( 'Type' ), 'kolabFolderType' );
$typeSelect -> setHasDescriptiveElements ( true );
$baseContainer -> addElement ( $typeSelect , true );
$baseContainer -> addVerticalSpace ( '10px' );
2013-12-01 10:02:20 +00:00
// allowed recipients
$this -> addMultiValueInputTextField ( $baseContainer , 'kolabAllowSMTPRecipient' , _ ( 'Allowed recipients' ));
2013-11-03 17:17:47 +00:00
// allowed senders
$this -> addMultiValueInputTextField ( $baseContainer , 'kolabAllowSMTPSender' , _ ( 'Allowed senders' ));
$container -> addElement ( $baseContainer , true );
// mail aliases
$container -> addElement ( new htmlSubTitle ( _ ( 'Email aliases' )), true );
2013-12-17 20:24:13 +00:00
$this -> addMultiValueInputTextField ( $container , 'alias' , null );
2013-11-03 17:17:47 +00:00
// delegates
2018-07-14 14:23:35 +00:00
$delegatesData = searchLDAPByAttribute ( 'mail' , '*' , 'inetOrgPerson' , array ( 'dn' ), array ( 'user' ));
$delegates = array ();
for ( $i = 0 ; $i < sizeof ( $delegatesData ); $i ++ ) {
$delegates [ getAbstractDN ( $delegatesData [ $i ][ 'dn' ])] = $delegatesData [ $i ][ 'dn' ];
2013-11-03 17:17:47 +00:00
}
2018-07-14 14:23:35 +00:00
uksort ( $delegates , 'compareDN' );
2013-11-03 17:17:47 +00:00
$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 ++ ) {
2018-07-14 14:23:35 +00:00
$delegateSelect = new htmlSelect ( 'delegate' . $i , $delegates , array ( $this -> attributes [ 'kolabDelegate' ][ $i ]));
$delegateSelect -> setHasDescriptiveElements ( true );
$delegateSelect -> setSortElements ( false );
$delegatesContainer -> addElement ( $delegateSelect );
2013-11-03 17:17:47 +00:00
$delegatesContainer -> addElement ( new htmlButton ( 'delDelegate' . $i , 'del.png' , true ));
if ( $i == 0 ) {
$delegatesContainer -> addElement ( new htmlHelpLink ( 'delegate' ));
}
$delegatesContainer -> addNewLine ();
2013-11-02 15:06:03 +00:00
}
}
2013-11-03 17:17:47 +00:00
// 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 );
2013-11-02 15:06:03 +00:00
return $container ;
}
/**
* Processes user input of the primary module page .
* It checks if all input values are correct and updates the associated LDAP attributes .
*
* @ return array list of info / error messages
*/
function process_attributes () {
$errors = array ();
2013-11-03 17:17:47 +00:00
// cn
$this -> attributes [ 'cn' ][ 0 ] = $_POST [ 'cn' ];
2013-11-03 20:00:12 +00:00
if ( empty ( $_POST [ 'cn' ])) {
$errors [] = $this -> messages [ 'cn' ][ 0 ];
}
2013-11-03 17:17:47 +00:00
// mail
$this -> attributes [ 'mail' ][ 0 ] = $_POST [ 'mail' ];
if ( empty ( $_POST [ 'mail' ]) || ! get_preg ( $_POST [ 'mail' ], 'email' )) {
$errors [] = $this -> messages [ 'mail' ][ 0 ];
2013-11-02 15:06:03 +00:00
}
2013-11-03 20:00:12 +00:00
// target folder
$this -> attributes [ 'kolabTargetFolder' ][ 0 ] = $_POST [ 'kolabTargetFolder' ];
if ( empty ( $_POST [ 'kolabTargetFolder' ])) {
$errors [] = $this -> messages [ 'kolabTargetFolder' ][ 0 ];
}
// folder type
$this -> attributes [ 'kolabFolderType' ][ 0 ] = $_POST [ 'kolabFolderType' ];
2013-12-01 10:02:20 +00:00
// allowed recipients
2013-11-02 15:06:03 +00:00
$this -> processMultiValueInputTextField ( 'kolabAllowSMTPRecipient' , $errors , 'kolabEmailPrefix' );
// allowed senders
$this -> processMultiValueInputTextField ( 'kolabAllowSMTPSender' , $errors , 'kolabEmailPrefix' );
2013-11-03 17:17:47 +00:00
// 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' ]);
2013-11-02 15:06:03 +00:00
return $errors ;
}
/**
2017-05-20 09:46:49 +00:00
* { @ inheritDoc }
* @ see baseModule :: build_uploadAccounts ()
*/
function build_uploadAccounts ( $rawAccounts , $ids , & $partialAccounts , $selectedModules , & $type ) {
2013-11-02 15:06:03 +00:00
$messages = array ();
2018-07-14 14:23:35 +00:00
$delegates = searchLDAPByAttribute ( null , null , 'inetOrgPerson' , array ( 'dn' ), array ( 'user' ));
2013-11-03 17:17:47 +00:00
for ( $d = 0 ; $d < sizeof ( $delegates ); $d ++ ) {
2018-07-14 14:23:35 +00:00
if ( isset ( $delegates [ $d ][ 'dn' ])) {
$delegates [ $d ] = $delegates [ $d ][ 'dn' ];
2013-11-03 17:17:47 +00:00
}
}
2013-11-02 15:06:03 +00:00
for ( $i = 0 ; $i < sizeof ( $rawAccounts ); $i ++ ) {
2013-11-03 17:17:47 +00:00
// 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' ;
2013-11-02 15:06:03 +00:00
}
2013-11-03 17:17:47 +00:00
// cn
$partialAccounts [ $i ][ 'cn' ] = $rawAccounts [ $i ][ $ids [ 'kolabSharedFolder_cn' ]];
// mail
2014-04-13 16:59:56 +00:00
$this -> mapSimpleUploadField ( $rawAccounts , $ids , $partialAccounts , $i , 'kolabSharedFolder_mail' , 'mail' ,
'email' , $this -> messages [ 'mail' ][ 1 ], $messages );
2013-11-03 20:00:12 +00:00
// target folder
$partialAccounts [ $i ][ 'kolabTargetFolder' ] = $rawAccounts [ $i ][ $ids [ 'kolabSharedFolder_kolabTargetFolder' ]];
// folder type
$partialAccounts [ $i ][ 'kolabFolderType' ] = $rawAccounts [ $i ][ $ids [ 'kolabSharedFolder_kolabFolderType' ]];
2013-11-02 15:06:03 +00:00
// allowed recipients
2015-08-15 18:11:54 +00:00
$this -> mapSimpleUploadField ( $rawAccounts , $ids , $partialAccounts , $i , 'kolabSharedFolder_kolabAllowSMTPRecipient' , 'kolabAllowSMTPRecipient' , 'kolabEmailPrefix' , $this -> messages [ 'kolabAllowSMTPRecipient' ][ 1 ], $messages , '/;[ ]*/' );
2013-11-02 15:06:03 +00:00
// allowed senders
2015-08-15 18:11:54 +00:00
$this -> mapSimpleUploadField ( $rawAccounts , $ids , $partialAccounts , $i , 'kolabSharedFolder_kolabAllowSMTPSender' , 'kolabAllowSMTPSender' , 'kolabEmailPrefix' , $this -> messages [ 'kolabAllowSMTPSender' ][ 1 ], $messages , '/;[ ]*/' );
2013-11-03 17:17:47 +00:00
// add mail aliases
2015-08-15 18:11:54 +00:00
$this -> mapSimpleUploadField ( $rawAccounts , $ids , $partialAccounts , $i , 'kolabSharedFolder_aliases' , 'alias' , 'email' , $this -> messages [ 'alias' ][ 1 ], $messages , '/,[ ]*/' );
2013-11-03 17:17:47 +00:00
// add delegates
if ( $rawAccounts [ $i ][ $ids [ 'kolabSharedFolder_delegates' ]] != " " ) {
2018-07-14 14:23:35 +00:00
$newDelegates = explode ( ';' , $rawAccounts [ $i ][ $ids [ 'kolabSharedFolder_delegates' ]]);
2013-11-03 17:17:47 +00:00
// 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 ;
}
}
}
2013-11-02 15:06:03 +00:00
}
return $messages ;
}
2015-08-15 18:11:54 +00:00
2013-11-02 15:06:03 +00:00
/**
2017-02-19 08:14:11 +00:00
* { @ inheritDoc }
* @ see baseModule :: get_pdfEntries ()
2015-01-07 17:16:35 +00:00
*/
2017-04-01 07:57:03 +00:00
function get_pdfEntries ( $pdfKeys , $typeId ) {
2013-11-02 15:06:03 +00:00
$return = array ();
2013-11-03 17:17:47 +00:00
$this -> addSimplePDFField ( $return , 'cn' , _ ( 'Name' ));
$this -> addSimplePDFField ( $return , 'mail' , _ ( 'Email address' ));
2013-11-03 20:00:12 +00:00
$this -> addSimplePDFField ( $return , 'kolabTargetFolder' , _ ( 'Target IMAP folder' ));
2013-12-01 10:02:20 +00:00
$this -> addSimplePDFField ( $return , 'kolabAllowSMTPRecipient' , _ ( 'Allowed recipients' ));
2013-11-02 15:06:03 +00:00
$this -> addSimplePDFField ( $return , 'kolabAllowSMTPSender' , _ ( 'Allowed senders' ));
2013-11-03 17:17:47 +00:00
$this -> addSimplePDFField ( $return , 'aliases' , _ ( 'Email aliases' ), 'alias' );
2018-07-14 14:23:35 +00:00
$this -> addSimplePDFField ( $return , 'delegate' , _ ( 'Delegates' ), 'kolabDelegate' , '; ' );
2013-11-03 20:00:12 +00:00
if ( ! empty ( $this -> attributes [ 'kolabFolderType' ])) {
$type = $this -> attributes [ 'kolabFolderType' ][ 0 ];
$typeList = array_flip ( $this -> folderTypes );
if ( isset ( $typeList [ $type ])) {
$type = $typeList [ $type ];
}
2015-03-08 20:09:18 +00:00
$this -> addPDFKeyValue ( $return , 'kolabFolderType' , _ ( 'Type' ), $type );
2013-11-03 20:00:12 +00:00
}
2013-11-02 15:06:03 +00:00
return $return ;
}
2015-08-15 18:11:54 +00:00
2013-11-02 15:06:03 +00:00
}
?>