mirror of
https://github.com/farmOS/farmOS.git
synced 2024-02-23 11:37:38 +01:00
Add the log_list:bundle cache tag to the access result.
This commit is contained in:
parent
838cd33c15
commit
a2cb3b26ab
1 changed files with 8 additions and 1 deletions
|
@ -56,7 +56,14 @@ class FarmAssetLogViewsAccessCheck implements AccessInterface {
|
|||
->condition('asset.entity.id', $asset_id)
|
||||
->aggregate('id', 'COUNT')
|
||||
->execute();
|
||||
return (!empty((int) $result[0]['id_count'] ?? 0)) ? AccessResult::allowed() : AccessResult::forbidden();
|
||||
|
||||
// Determine access based on the log count.
|
||||
$log_count = (int) $result[0]['id_count'] ?? 0;
|
||||
$access = empty($log_count) ? AccessResult::forbidden() : AccessResult::allowed();
|
||||
|
||||
// Invalidate the access result when logs of this bundle are changed.
|
||||
$access->addCacheTags(["log_list:$log_type"]);
|
||||
return $access;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue