From 7f8a152909e3061e180c6a396eccb49c8bb23a41 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Thu, 20 Jul 2023 09:50:24 +0300 Subject: [PATCH] selectAccessControlDisabled --- application/Espo/Core/Record/Service.php | 13 ++++--------- schema/metadata/recordDefs.json | 6 +++++- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/application/Espo/Core/Record/Service.php b/application/Espo/Core/Record/Service.php index c8d2d87be8..c2a1a1b194 100644 --- a/application/Espo/Core/Record/Service.php +++ b/application/Espo/Core/Record/Service.php @@ -141,8 +141,6 @@ class Service implements Crud, protected $nonAdminReadOnlyLinkList = []; /** @var string[] */ protected $onlyAdminLinkList = []; - /** @var array> */ - protected $linkParams = []; /** @var array */ protected $linkMandatorySelectAttributeList = []; /** @var string[] */ @@ -966,14 +964,11 @@ class Service implements Crud, ->getRelation($link) ->getForeignEntityType(); - $linkParams = $this->linkParams[$link] ?? []; + $skipAcl = $this->metadata + ->get("recordDefs.$this->entityType.relationships.$link.selectAccessControlDisabled") ?? false; - $skipAcl = $linkParams['skipAcl'] ?? false; - - if (!$skipAcl) { - if (!$this->acl->check($foreignEntityType, AclTable::ACTION_READ)) { - throw new Forbidden(); - } + if (!$skipAcl && !$this->acl->check($foreignEntityType, AclTable::ACTION_READ)) { + throw new Forbidden(); } $recordService = $this->recordServiceContainer->get($foreignEntityType); diff --git a/schema/metadata/recordDefs.json b/schema/metadata/recordDefs.json index 427827440a..9f3f873247 100644 --- a/schema/metadata/recordDefs.json +++ b/schema/metadata/recordDefs.json @@ -101,6 +101,10 @@ "additionalProperties": { "type": "object", "properties": { + "selectAccessControlDisabled": { + "description": "Disable access control when listing related records; only access to a parent record will be checked.", + "type": "boolean" + }, "linkRequiredAccess": { "description": "Access to a current record that is needed to be able to link and unlink records.", "type": "string", @@ -116,7 +120,7 @@ "type": "boolean" }, "linkCheckDisabled": { - "description": "Disable a link-check functionallity linking through link-multiple field.", + "description": "Disable a link-check functionality when linking through link-multiple field.", "type": "boolean" } }