--- expressoAdmin1_2/inc/class.shared_accounts.inc.php 2019-11-29 13:32:52.123157969 -0300 +++ /tmp/expressoAdmin1_2/inc/class.shared_accounts.inc.php 2019-11-29 13:29:45.000000000 -0300 @@ -12,12 +12,14 @@ include_once('class.functions.inc.php'); include_once('class.ldap_functions.inc.php'); include_once('class.imap.inc.php'); +include_once('class.db_functions.inc.php'); include_once(PHPGW_API_INC.'/class.aclmanagers.inc.php'); class shared_accounts { var $functions; var $ldap_functions; + var $db_functions; var $boemailadmin = null; var $imap = null; @@ -26,6 +28,7 @@ $this->ldap_functions = new ldap_functions; $this->functions = new functions; $this->boemailadmin = CreateObject('emailadmin.bo'); + $this->db_functions = new db_functions; } private function get_imap( $_profile, $_user) @@ -99,12 +103,13 @@ { if( isset($params['owners_acl']) && count($params['owners_acl']) > 0 ) { - $_result['status'] &= $this->setACLMailbox( $_imap, $params, "SAVE" ); + $_result['status'] &= $this->setACLMailbox( $_imap, $params, "SAVE", $params['uid'] ); } } else { - $_result['status'] &= $this->setACLMailbox( $_imap, array( "owners_acl" => "", "uid" => $params['uid'] ), "SAVE" ); + $_result['status'] &= $this->setACLMailbox( $_imap, array( "owners_acl" => "", "uid" => $params['uid'] ), "SAVE", $params['uid'] ); + } } else @@ -132,9 +137,13 @@ $_result['status'] &= $_imap->create_mailbox( 'INBOX' . $_profile['imapDelimiter'] . $_profile['imapDefaultSentFolder'] ); + $this->db_functions->write_log( 'created shared account', $params['uid'] ); + + if( isset($params['owners_acl']) && count($params['owners_acl']) > 0 ) { - $_result['status'] &= $this->setACLMailbox( $_imap, $params['owners_acl'], "CREATE" ); + $_result['status'] &= $this->setACLMailbox( $_imap, $params['owners_acl'], "CREATE", $params['uid'] ); + } } else @@ -147,8 +156,9 @@ return $_result; } - private function setACLMailbox( $imap, $params, $type ) + private function setACLMailbox( $imap, $params, $type, $uid ) { + $_result = true; $owners_acl = ( isset( $params['owners_acl'] ) ? $params['owners_acl'] : $params ); @@ -158,6 +168,8 @@ foreach( $owners_acl as $value ) { $_result &= $imap->set_acl( 'INBOX', array( trim($value['user']) => trim($value['acl']) ) ); + $this->db_functions->write_log( 'created: acl shared account',$uid.": ".trim($value['user'])."=>".trim($value['acl']) ); + } } else @@ -181,12 +193,14 @@ foreach( $_acls_remove as $owner => $acl ) { $_result &= $imap->set_acl( 'INBOX', array( trim($owner) => '' ) ); + $this->db_functions->write_log( 'removed: acl shared account',$uid.": ".trim($owner)."=>".trim($acl) ); } /* Add ACLs */ foreach( $_acls_new as $owner => $acl ) { $_result &= $imap->set_acl( 'INBOX', array( trim($owner) => trim($acl) ) ); + $this->db_functions->write_log( 'added: acl shared account',$uid.": ".trim($owner)."=>".trim($acl) ); } } else @@ -197,6 +211,7 @@ foreach( $_acls_old as $owner => $acl ) { $_result &= $imap->set_acl( 'INBOX', array( trim($owner) => '' ) ); + $this->db_functions->write_log( 'removed: acl shared account',$uid.": ".trim($owner)."=>".trim($acl) ); } /* Add ACL only owner*/ @@ -297,7 +314,11 @@ $_result = $this->ldap_functions->delete_shared_account_data($params); - if( $_result['status'] ){ $_result['status'] &= $_imap->delete_inbox(); } + if( $_result['status'] ) + { + $_result['status'] &= $_imap->delete_inbox(); + $this->db_functions->write_log( 'deleted shared account', $params['uid'] ); + } return $_result; } @@ -341,8 +362,8 @@ try { $_imap = $this->get_imap( $_profile, $_uid ); - $_imap->empty_inbox(); + $this->db_functions->write_log("inbox emptied", $params['uid']); } catch( Exception $e ) {