Try to fix contact sharing filemanager access

This commit is contained in:
nathan 2022-12-06 13:02:48 -07:00
parent c1182f13c0
commit 1e1090f0a1

View File

@ -143,6 +143,12 @@ class Link extends Link\Storage
* Turns on debug-messages * Turns on debug-messages
*/ */
const DEBUG = false; const DEBUG = false;
/**
* Flag to mark an app+id as not cacheable
*/
const NO_CACHE_FLAG = "NO CACHE";
/** /**
* other apps can participate in the linking by implementing a 'search_link' hook, which * other apps can participate in the linking by implementing a 'search_link' hook, which
* has to return an array in the format of an app_register entry below * has to return an array in the format of an app_register entry below
@ -156,7 +162,8 @@ class Link extends Link\Storage
'icon' => 'addressbook/accounts', 'icon' => 'addressbook/accounts',
'query' => 'EGroupware\\Api\\Accounts::link_query', 'query' => 'EGroupware\\Api\\Accounts::link_query',
'title' => 'EGroupware\\Api\\Accounts::title', 'title' => 'EGroupware\\Api\\Accounts::title',
'view' => array('menuaction'=>'addressbook.addressbook_ui.view','ajax'=>'true'), 'view' => array('menuaction' => 'addressbook.addressbook_ui.view',
'ajax' => 'true'),
'view_id' => 'account_id' 'view_id' => 'account_id'
), ),
'api' => array( 'api' => array(
@ -1788,16 +1795,21 @@ class Link extends Link\Storage
$ret = $cache =& self::get_cache($app, $id,'file_access'); $ret = $cache =& self::get_cache($app, $id,'file_access');
if (!isset($ret) || $required == Acl::EDIT && !($ret & $required)) if(!isset($ret) || $ret == self::NO_CACHE_FLAG || $required == Acl::EDIT && !($ret & $required))
{ {
if(($method = self::get_registry($app, 'file_access'))) if(($method = self::get_registry($app, 'file_access')))
{ {
$ret = self::exec($method, array($id, $required, $rel_path)); $ret = self::exec($method, array($id, $required, $rel_path));
// bool return value means cacheable, non-bool, means not cacheable, because of $rel_path // bool return value means cacheable, non-bool, means not cacheable, because of $rel_path
if (is_bool($ret)) if(is_bool($ret) && $cache !== self::NO_CACHE_FLAG)
{ {
$cache |= $ret ? $required | Acl::READ : 0; $cache |= $ret ? $required | Acl::READ : 0;
} }
else
{
// Do not cache anything for this app+id or any non boolean (false) will override
$cache = self::NO_CACHE_FLAG;
}
$ret = $ret ? $required|Acl::READ : 0; $ret = $ret ? $required|Acl::READ : 0;
} }
else else