Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

Commit

Permalink
fix(Admin/EmailAccounts): make acl filter ignoring work in Admin
Browse files Browse the repository at this point in the history
- add test for search TYPE_SYSTEM email account

Change-Id: Ic8f43df796ad6d0b9a04a794f0727d149cdae235
Reviewed-on: http://gerrit.tine20.com/customers/14071
Tested-by: Jenkins CI (http://ci.tine20.com/) <tine20-jenkins@metaways.de>
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
  • Loading branch information
pschuele committed Sep 17, 2019
1 parent e1d3b40 commit b512142
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
52 changes: 52 additions & 0 deletions tests/tine20/Admin/JsonTest.php
Expand Up @@ -1670,6 +1670,58 @@ public static function getSharedAccountData()
return $accountdata;
}

public function testSearchUserEmailAccounts()
{
if (! TestServer::isEmailSystemAccountConfigured()) {
self::markTestSkipped('imap systemaccount config required');
}

// we should already have some "SYSTEM" accounts for the persona users
$filter = [[
'field' => 'type',
'operator' => 'equals',
'value' => Felamimail_Model_Account::TYPE_SYSTEM,
]];
$result = $this->_json->searchEmailAccounts($filter, []);
self::assertGreaterThan(1, $result['totalcount'], 'system accounts of other users not found');

// client sends some strange filters ...
$filter = array (
0 =>
array (
'condition' => 'OR',
'filters' =>
array (
0 =>
array (
'condition' => 'AND',
'filters' =>
array (
0 =>
array (
'field' => 'query',
'operator' => 'contains',
'value' => '',
'id' => 'ext-record-23',
),
),
'id' => 'ext-comp-1189',
'label' => 'Konten',
),
),
'id' => 'FilterPanel',
),
1 =>
array (
'field' => 'query',
'operator' => 'contains',
'value' => '',
'id' => 'quickFilter',
));
$result = $this->_json->searchEmailAccounts($filter, []);
self::assertGreaterThan(1, $result['totalcount'], 'system accounts of other users not found');
}

public function testEmailAccountApiSharedAccount($delete = true)
{
if (! TestServer::isEmailSystemAccountConfigured()) {
Expand Down
5 changes: 5 additions & 0 deletions tine20/Tinebase/Model/Filter/FilterGroup.php
Expand Up @@ -251,6 +251,11 @@ public function doIgnoreAcl($bool = null)
{
$oldValue = $this->_ignoreAcl;
if (null !== $bool) {
foreach ($this->_filterObjects as $filter) {
if ($filter instanceof Tinebase_Model_Filter_FilterGroup) {
$filter->doIgnoreAcl($bool);
}
}
$this->_ignoreAcl = (bool)$bool;
}
return $oldValue;
Expand Down

0 comments on commit b512142

Please sign in to comment.