select ref, docs

This commit is contained in:
Yuri Kuznetsov
2025-03-26 11:10:16 +02:00
parent 6cbf6cea73
commit c1ae7dff95
7 changed files with 35 additions and 0 deletions
@@ -31,6 +31,11 @@ namespace Espo\Core\Acl;
use Espo\Entities\User;
/**
* Bindings:
* - `$entityType` as of v9.1.0.
* - `Espo\Core\AclManager`
*/
interface AccessChecker
{
/**
@@ -29,4 +29,9 @@
namespace Espo\Core\Acl;
/**
* Bindings:
* - `$entityType` as of v9.1.0.
* - `Espo\Core\AclManager`
*/
interface OwnershipChecker {}
@@ -31,6 +31,15 @@ namespace Espo\Core\Select\AccessControl;
use Espo\ORM\Query\SelectBuilder as QueryBuilder;
/**
* An access filter.
*
* Bindings:
* - `$entityType`
* - `Espo\Entities\User`
* - `Espo\Core\AclManager` as of v9.1.
* - `Espo\Core\Acl`
*/
interface Filter
{
public function apply(QueryBuilder $queryBuilder): void;
@@ -35,6 +35,8 @@ use Espo\Core\Binding\Binder;
use Espo\Core\Binding\BindingContainer;
use Espo\Core\Binding\BindingData;
use Espo\Core\InjectableFactory;
use Espo\Core\Portal\Acl as PortalAcl;
use Espo\Core\Portal\AclManager as PortalAclManager;
use Espo\Core\Select\Helpers\FieldHelper;
use Espo\Core\Utils\Metadata;
use Espo\Entities\User;
@@ -66,6 +68,11 @@ class FilterFactory
->bindInstance(AclManager::class, $this->aclManager)
->bindInstance(Acl::class, $this->acl);
if ($user->isPortal()) {
$binder->bindInstance(PortalAcl::class, $this->acl);
$binder->bindInstance(PortalAclManager::class, $this->aclManager);
}
$binder
->for($className)
->bindValue('$entityType', $entityType);
@@ -31,6 +31,12 @@ namespace Espo\Core\Select\AccessControl;
/**
* Resolves an access filter. An entity type, acl and user to be passed to the constructor.
*
* Bindings:
* - `$entityType`
* - `Espo\Entities\User`
* - `Espo\Core\AclManager` as of v9.1.
* - `Espo\Core\Acl`
*/
interface FilterResolver
{
@@ -33,6 +33,7 @@ use Espo\Core\AclManager;
use Espo\Core\InjectableFactory;
use Espo\Core\Acl;
use Espo\Core\Portal\Acl as PortalAcl;
use Espo\Core\Portal\AclManager as PortalAclManager;
use Espo\Core\Utils\Metadata;
use Espo\Core\Binding\BindingContainer;
use Espo\Core\Binding\Binder;
@@ -65,6 +66,7 @@ class FilterResolverFactory
if ($user->isPortal()) {
$binder->bindInstance(PortalAcl::class, $this->acl);
$binder->bindInstance(PortalAclManager::class, $this->aclManager);
}
$binder
@@ -119,6 +119,7 @@ class FilterResolverFactoryTest extends TestCase
if ($this->user->isPortal()) {
$binder->bindInstance(PortalAcl::class, $this->acl);
$binder->bindInstance(PortalAclManager::class, $this->aclManager);
}
$binder