mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-23 00:13:35 +01:00
* eMail: allow recursive setting of ACL; beware you should know what you do, when activating. When activated, the chosen acl-changess will be applied to the rest of the folder tree beneath the current folder; Use ARRIVAL (internal message date) as default sort criteria now instead of DATE, as sorting by date presented weird results depending on date/time formats of the send date of the message; Using ARRIVAL date in message list (for the same reason);
This commit is contained in:
parent
be7ad8ec50
commit
db2d505a1b
@ -48,14 +48,14 @@ class ajaxfelamimail
|
|||||||
$this->icServer = $this->bofelamimail->mailPreferences->getIncomingServer($this->imapServerID);
|
$this->icServer = $this->bofelamimail->mailPreferences->getIncomingServer($this->imapServerID);
|
||||||
}
|
}
|
||||||
|
|
||||||
function addACL($_accountName, $_aclData)
|
function addACL($_accountName, $_aclData, $_recursive=false)
|
||||||
{
|
{
|
||||||
if($this->_debug) error_log("ajaxfelamimail::addACL for ".$_accountName."->".array2string($_aclData));
|
if($this->_debug) error_log("ajaxfelamimail::addACL for ".$_accountName."->".array2string($_aclData));
|
||||||
$response = new xajaxResponse();
|
$response = new xajaxResponse();
|
||||||
|
//$_recursive=false;
|
||||||
if(!empty($_accountName)) {
|
if(!empty($_accountName)) {
|
||||||
$acl = implode('',(array)$_aclData['acl']);
|
$acl = implode('',(array)$_aclData['acl']);
|
||||||
$data = $this->bofelamimail->setACL($this->sessionDataAjax['folderName'], $_accountName, $acl);
|
$data = $this->bofelamimail->setACL($this->sessionDataAjax['folderName'], $_accountName, $acl, $_recursive);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $response->getXML();
|
return $response->getXML();
|
||||||
@ -199,7 +199,7 @@ class ajaxfelamimail
|
|||||||
foreach($aclList as $acl) {
|
foreach($aclList as $acl) {
|
||||||
$row .= "<td><input type=\"checkbox\" name=\"acl[$accountName][$acl]\" id=\"acl_$accountName_$acl\"".
|
$row .= "<td><input type=\"checkbox\" name=\"acl[$accountName][$acl]\" id=\"acl_$accountName_$acl\"".
|
||||||
(strpos($accountAcl['RIGHTS'],$acl) !== false ? 'checked' : '') .
|
(strpos($accountAcl['RIGHTS'],$acl) !== false ? 'checked' : '') .
|
||||||
" onclick=\"xajax_doXMLHTTP('felamimail.ajaxfelamimail.updateSingleACL','$accountName','$acl',this.checked); document.getElementById('predefinedFor_$accountName').options[0].selected=true\"</td>";
|
" onclick=\"xajax_doXMLHTTP('felamimail.ajaxfelamimail.updateSingleACL','$accountName','$acl',this.checked,document.getElementById('recursive').checked); document.getElementById('recursive').checked=false; document.getElementById('predefinedFor_$accountName').options[0].selected=true\"</td>";
|
||||||
}
|
}
|
||||||
|
|
||||||
$selectFrom = html::select('identity', $accountAcl['RIGHTS'], $aclShortCuts, false, "id=\"predefinedFor_$accountName\" style='width: 100px;' onChange=\"xajax_doXMLHTTP('felamimail.ajaxfelamimail.updateACL','$accountName',this.value)\"");
|
$selectFrom = html::select('identity', $accountAcl['RIGHTS'], $aclShortCuts, false, "id=\"predefinedFor_$accountName\" style='width: 100px;' onChange=\"xajax_doXMLHTTP('felamimail.ajaxfelamimail.updateACL','$accountName',this.value)\"");
|
||||||
@ -212,13 +212,13 @@ class ajaxfelamimail
|
|||||||
return "<table border=\"0\" style=\"width: 100%;\"><tr class=\"th\"><th> </th><th style=\"width:100px;\">Name</th><th>L</th><th>R</th><th>S</th><th>W</th><th>I</th><th>P</th><th>C</th><th>D</th><th>A</th><th> </th></tr>$row</table>";
|
return "<table border=\"0\" style=\"width: 100%;\"><tr class=\"th\"><th> </th><th style=\"width:100px;\">Name</th><th>L</th><th>R</th><th>S</th><th>W</th><th>I</th><th>P</th><th>C</th><th>D</th><th>A</th><th> </th></tr>$row</table>";
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteACL($_aclData)
|
function deleteACL($_aclData,$_recursive=false)
|
||||||
{
|
{
|
||||||
if($this->_debug) error_log("ajaxfelamimail::deleteACL");
|
if($this->_debug) error_log("ajaxfelamimail::deleteACL".array2string($_aclData).' Recursively:'.array2string($_recursive));
|
||||||
$response = new xajaxResponse();
|
$response = new xajaxResponse();
|
||||||
if(is_array($_aclData)) {
|
if(is_array($_aclData)) {
|
||||||
foreach($_aclData['accountName'] as $accountName) {
|
foreach($_aclData['accountName'] as $accountName) {
|
||||||
$data = $this->bofelamimail->deleteACL($this->sessionDataAjax['folderName'], $accountName);
|
$data = $this->bofelamimail->deleteACL($this->sessionDataAjax['folderName'], $accountName, $_recursive);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($folderACL = $this->bofelamimail->getIMAPACL($this->sessionDataAjax['folderName'])) {
|
if ($folderACL = $this->bofelamimail->getIMAPACL($this->sessionDataAjax['folderName'])) {
|
||||||
@ -1225,13 +1225,14 @@ class ajaxfelamimail
|
|||||||
*/
|
*/
|
||||||
function updateACL($_user, $_acl)
|
function updateACL($_user, $_acl)
|
||||||
{
|
{
|
||||||
|
// not sure this one is used / called anymore
|
||||||
if ($_acl == 'custom') {
|
if ($_acl == 'custom') {
|
||||||
$response = new xajaxResponse();
|
$response = new xajaxResponse();
|
||||||
return $response->getXML();
|
return $response->getXML();
|
||||||
}
|
}
|
||||||
|
$_recursive=false;
|
||||||
$_folderName = $this->sessionDataAjax['folderName'];
|
$_folderName = $this->sessionDataAjax['folderName'];
|
||||||
$result = $this->bofelamimail->setACL($_folderName, $_user, $_acl);
|
$result = $this->bofelamimail->setACL($_folderName, $_user, $_acl, $_recursive);
|
||||||
if ($result && $folderACL = $this->bofelamimail->getIMAPACL($_folderName)) {
|
if ($result && $folderACL = $this->bofelamimail->getIMAPACL($_folderName)) {
|
||||||
return $this->updateACLView();
|
return $this->updateACLView();
|
||||||
}
|
}
|
||||||
@ -1251,7 +1252,6 @@ class ajaxfelamimail
|
|||||||
*/
|
*/
|
||||||
function updateACLView()
|
function updateACLView()
|
||||||
{
|
{
|
||||||
|
|
||||||
$response = new xajaxResponse();
|
$response = new xajaxResponse();
|
||||||
if($folderACL = $this->bofelamimail->getIMAPACL($this->sessionDataAjax['folderName'])) {
|
if($folderACL = $this->bofelamimail->getIMAPACL($this->sessionDataAjax['folderName'])) {
|
||||||
$response->addAssign("aclTable", "innerHTML", $this->createACLTable($folderACL));
|
$response->addAssign("aclTable", "innerHTML", $this->createACLTable($folderACL));
|
||||||
@ -1295,10 +1295,11 @@ class ajaxfelamimail
|
|||||||
return $messageList;
|
return $messageList;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateSingleACL($_accountName, $_aclType, $_aclStatus)
|
function updateSingleACL($_accountName, $_aclType, $_aclStatus, $_recursive=false)
|
||||||
{
|
{
|
||||||
$response = new xajaxResponse();
|
$response = new xajaxResponse();
|
||||||
$data = $this->bofelamimail->updateSingleACL($this->sessionDataAjax['folderName'], $_accountName, $_aclType, $_aclStatus);
|
//$_recursive=false;
|
||||||
|
$data = $this->bofelamimail->updateSingleACL($this->sessionDataAjax['folderName'], $_accountName, $_aclType, $_aclStatus, $_recursive);
|
||||||
return $response->getXML();
|
return $response->getXML();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,21 +199,69 @@
|
|||||||
$GLOBALS['egw']->session->appsession('session_data','emailadmin',serialize(array()));
|
$GLOBALS['egw']->session->appsession('session_data','emailadmin',serialize(array()));
|
||||||
}
|
}
|
||||||
|
|
||||||
function setACL($_folderName, $_accountName, $_acl)
|
function getFolderPrefixFromNamespace($nameSpace, $folderName)
|
||||||
{
|
{
|
||||||
|
foreach($nameSpace as $type => $singleNameSpace)
|
||||||
|
{
|
||||||
|
if($type == 'personal' && substr($singleNameSpace[2]['name'],0,strlen($folderName))==$folderName && ($singleNameSpace[2]['name'] == '#mh/' || count($nameSpace) == 1) && $this->icServer->mailboxExist('Mail')) {
|
||||||
|
// uw-imap server with mailbox prefix or dovecot maybe
|
||||||
|
return 'Mail';
|
||||||
|
} elseif($type == 'personal' && substr($singleNameSpace[2]['name'],0,strlen($folderName))==$folderName && ($singleNameSpace[2]['name'] == '#mh/' || count($nameSpace) == 1) && $this->icServer->mailboxExist('mail')) {
|
||||||
|
// uw-imap server with mailbox prefix or dovecot maybe
|
||||||
|
return 'mail';
|
||||||
|
} else {
|
||||||
|
return (substr($singleNameSpace[0]['name'],0,strlen($folderName))==$folderName ? $singleNameSpace[0]['name'] : '');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setACL($_folderName, $_accountName, $_acl, $_recursive=false)
|
||||||
|
{
|
||||||
|
//$_recursive=true;
|
||||||
|
//error_log(__METHOD__.__LINE__.'-> called with:'."$_folderName, $_accountName, $_acl, $_recursive");
|
||||||
if ( PEAR::isError($this->icServer->setACL($_folderName, $_accountName, $_acl)) ) {
|
if ( PEAR::isError($this->icServer->setACL($_folderName, $_accountName, $_acl)) ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if ($_recursive)
|
||||||
|
{
|
||||||
|
$delimiter = $this->getHierarchyDelimiter();
|
||||||
|
$nameSpace = $this->icServer->getNameSpaces();
|
||||||
|
$prefix = $this->getFolderPrefixFromNamespace($nameSpace, $_folderName);
|
||||||
|
//error_log(__METHOD__.__LINE__.'->'."$_folderName, $delimiter, $prefix");
|
||||||
|
|
||||||
|
$subFolders = $this->getMailBoxesRecursive($_folderName, $delimiter, $prefix);
|
||||||
|
//error_log(__METHOD__.__LINE__.' Fetched Subfolders->'.array2string($subFolders));
|
||||||
|
foreach ($subFolders as $k => $folder)
|
||||||
|
{
|
||||||
|
// we do not monitor failure or success on subfolders
|
||||||
|
if ($folder <> $_folderName) $this->icServer->setACL($folder, $_accountName, $_acl);
|
||||||
|
}
|
||||||
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteACL($_folderName, $_accountName)
|
function deleteACL($_folderName, $_accountName, $_recursive=false)
|
||||||
{
|
{
|
||||||
|
//$_recursive=true;
|
||||||
|
//error_log(__METHOD__.__LINE__." calledv with: $_folderName, $_accountName, $_recursive");
|
||||||
if ( PEAR::isError($this->icServer->deleteACL($_folderName, $_accountName)) ) {
|
if ( PEAR::isError($this->icServer->deleteACL($_folderName, $_accountName)) ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if ($_recursive)
|
||||||
|
{
|
||||||
|
$delimiter = $this->getHierarchyDelimiter();
|
||||||
|
$nameSpace = $this->icServer->getNameSpaces();
|
||||||
|
$prefix = $this->getFolderPrefixFromNamespace($nameSpace, $_folderName);
|
||||||
|
//error_log(__METHOD__.__LINE__.'->'."$_folderName, $delimiter, $prefix");
|
||||||
|
|
||||||
|
$subFolders = $this->getMailBoxesRecursive($_folderName, $delimiter, $prefix);
|
||||||
|
//error_log(__METHOD__.__LINE__.' Fetched Subfolders->'.array2string($subFolders));
|
||||||
|
foreach ($subFolders as $k => $folder)
|
||||||
|
{
|
||||||
|
// we do not monitor failure or success on subfolders
|
||||||
|
if ($folder <> $_folderName) $this->icServer->deleteACL($folder, $_accountName);
|
||||||
|
}
|
||||||
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2227,10 +2275,14 @@
|
|||||||
if(substr($headerObject['DATE'],-2) === 'UT') {
|
if(substr($headerObject['DATE'],-2) === 'UT') {
|
||||||
$headerObject['DATE'] .= 'C';
|
$headerObject['DATE'] .= 'C';
|
||||||
}
|
}
|
||||||
|
if(substr($headerObject['INTERNALDATE'],-2) === 'UT') {
|
||||||
|
$headerObject['INTERNALDATE'] .= 'C';
|
||||||
|
}
|
||||||
|
|
||||||
$retValue['header'][$sortOrder[$uid]]['subject'] = $this->decode_subject($headerObject['SUBJECT']);
|
$retValue['header'][$sortOrder[$uid]]['subject'] = $this->decode_subject($headerObject['SUBJECT']);
|
||||||
$retValue['header'][$sortOrder[$uid]]['size'] = $headerObject['SIZE'];
|
$retValue['header'][$sortOrder[$uid]]['size'] = $headerObject['SIZE'];
|
||||||
$retValue['header'][$sortOrder[$uid]]['date'] = self::_strtotime($headerObject['DATE'],'ts',true);
|
//$retValue['header'][$sortOrder[$uid]]['date'] = self::_strtotime($headerObject['DATE'],'ts',true);
|
||||||
|
$retValue['header'][$sortOrder[$uid]]['date'] = self::_strtotime($headerObject['INTERNALDATE'],'ts',true);
|
||||||
$retValue['header'][$sortOrder[$uid]]['mimetype'] = $headerObject['MIMETYPE'];
|
$retValue['header'][$sortOrder[$uid]]['mimetype'] = $headerObject['MIMETYPE'];
|
||||||
$retValue['header'][$sortOrder[$uid]]['id'] = $headerObject['MSG_NUM'];
|
$retValue['header'][$sortOrder[$uid]]['id'] = $headerObject['MSG_NUM'];
|
||||||
$retValue['header'][$sortOrder[$uid]]['uid'] = $headerObject['UID'];
|
$retValue['header'][$sortOrder[$uid]]['uid'] = $headerObject['UID'];
|
||||||
@ -2986,19 +3038,20 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateSingleACL($_folderName, $_accountName, $_aclType, $_aclStatus)
|
function updateSingleACL($_folderName, $_accountName, $_aclType, $_aclStatus,$_recursive=false)
|
||||||
{
|
{
|
||||||
|
//error_log(__METHOD__.__LINE__." $_folderName, $_accountName, $_aclType, $_aclStatus,$_recursive");
|
||||||
$userACL = $this->getIMAPACL($_folderName, $_accountName);
|
$userACL = $this->getIMAPACL($_folderName, $_accountName);
|
||||||
|
|
||||||
if($_aclStatus == 'true') {
|
if($_aclStatus == 'true' || $_aclStatus == 1) {
|
||||||
if(strpos($userACL, $_aclType) === false) {
|
if(strpos($userACL, $_aclType) === false) {
|
||||||
$userACL .= $_aclType;
|
$userACL .= $_aclType;
|
||||||
$this->setACL($_folderName, $_accountName, $userACL);
|
$this->setACL($_folderName, $_accountName, $userACL, $_recursive);
|
||||||
}
|
}
|
||||||
} elseif($_aclStatus == 'false') {
|
} elseif($_aclStatus == 'false' || empty($_aclStatus)) {
|
||||||
if(strpos($userACL, $_aclType) !== false) {
|
if(strpos($userACL, $_aclType) !== false) {
|
||||||
$userACL = str_replace($_aclType,'',$userACL);
|
$userACL = str_replace($_aclType,'',$userACL);
|
||||||
$this->setACL($_folderName, $_accountName, $userACL);
|
$this->setACL($_folderName, $_accountName, $userACL, $_recursive);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3093,7 +3146,8 @@
|
|||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
default:
|
default:
|
||||||
$retValue = 'DATE';
|
//$retValue = 'DATE';
|
||||||
|
$retValue = 'ARRIVAL';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -757,6 +757,7 @@ require_once(EGW_INCLUDE_ROOT.'/felamimail/inc/class.felamimail_bosignatures.inc
|
|||||||
$this->t->set_var('lang_ACL',lang('ACL'));
|
$this->t->set_var('lang_ACL',lang('ACL'));
|
||||||
$this->t->set_var('lang_save',lang('save'));
|
$this->t->set_var('lang_save',lang('save'));
|
||||||
$this->t->set_var('lang_cancel',lang('cancel'));
|
$this->t->set_var('lang_cancel',lang('cancel'));
|
||||||
|
$this->t->set_var('lang_setrecursively',lANG('apply recursively?'));
|
||||||
$this->t->set_var('lang_Overview',lang('Overview'));
|
$this->t->set_var('lang_Overview',lang('Overview'));
|
||||||
$this->t->set_var('lang_edit_forwarding_address',lang('edit email forwarding address'));
|
$this->t->set_var('lang_edit_forwarding_address',lang('edit email forwarding address'));
|
||||||
$this->t->set_var('lang_forwarding_address',lang('email forwarding address'));
|
$this->t->set_var('lang_forwarding_address',lang('email forwarding address'));
|
||||||
|
@ -19,7 +19,8 @@ function onNodeSelect(_nodeID)
|
|||||||
|
|
||||||
function resetACLAddView()
|
function resetACLAddView()
|
||||||
{
|
{
|
||||||
window.xajax_doXMLHTTP('felamimail.ajaxfelamimail.addACL', document.getElementById('accountName').value, window.xajax.getFormValues('formAddACL') );
|
window.xajax_doXMLHTTP('felamimail.ajaxfelamimail.addACL', document.getElementById('accountName').value, window.xajax.getFormValues('formAddACL'),document.getElementById('recursive').checked );
|
||||||
|
document.getElementById('recursive').checked = false;
|
||||||
document.getElementById('accountName').value = '';
|
document.getElementById('accountName').value = '';
|
||||||
document.getElementById('acl_l').checked = false;
|
document.getElementById('acl_l').checked = false;
|
||||||
document.getElementById('acl_r').checked = false;
|
document.getElementById('acl_r').checked = false;
|
||||||
|
@ -110,7 +110,8 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td align="left" colspan="3">
|
<td align="left" colspan="3">
|
||||||
<button type="button" onclick="javascript:egw_openWindowCentered('{url_addACL}','felamiMailACL','400','200');">{lang_add_acl}</button>
|
<button type="button" onclick="javascript:egw_openWindowCentered('{url_addACL}','felamiMailACL','400','200');">{lang_add_acl}</button>
|
||||||
<button type="button" onClick="javascript:xajax_doXMLHTTP('felamimail.ajaxfelamimail.deleteACL', xajax.getFormValues('editACL'));">{lang_delete}</button>
|
<button type="button" onClick="javascript:xajax_doXMLHTTP('felamimail.ajaxfelamimail.deleteACL', xajax.getFormValues('editACL'),document.getElementById('recursive').checked);document.getElementById('recursive').checked=false;">{lang_delete}</button>
|
||||||
|
<input type="checkbox" name="recursive" value="1" id="recursive"> {lang_setrecursively}
|
||||||
</form>
|
</form>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -442,12 +443,13 @@
|
|||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="4">
|
<td colspan="2">
|
||||||
<button onClick="javascript:window.close();">
|
<button onClick="javascript:window.close();">
|
||||||
{lang_cancel}
|
{lang_cancel}
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
<td colspan="6" align="right">
|
<td colspan="8" align="right">
|
||||||
|
{lang_setrecursively} <input type="checkbox" name="recursive" value="1" id="recursive">
|
||||||
<button type="button" ddisabled="disabled" sstyle="color:silver;" onClick="resetACLAddView();">
|
<button type="button" ddisabled="disabled" sstyle="color:silver;" onClick="resetACLAddView();">
|
||||||
{lang_add}
|
{lang_add}
|
||||||
</button>
|
</button>
|
||||||
|
Loading…
Reference in New Issue
Block a user