<?php
namespace Claromentis\Core\ORM\Plugins\Acl;

$GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"] = (@$GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"] ?: array()) + array("_6b33909de3b0ef9ff109f3cf" . "1bac1f2f" => base64_decode("VGhlIHdoZXJlQ2FuKCkgQUNMIG1hY3JvIGNhbiBvbmx5IGJlIHVzZWQgd2l0aCBlbnRpdHkgbWFwcyB0aGF0IGltcGxlbWVudCBB" . "Y2xFbnRpdHlNYXA="), "_49391035050d19ba9eaa2bb7e9" . "69cf75" => base64_decode("d2hlcmVD" . "YW4="), "_5a95e476a760c3d562e" . "98c285e9aa158" => base64_decode("d2hlcmV" . "QZXJtaX" . "NzaW9u"));
use Analogue\ORM\Exceptions\MappingException;
use Analogue\ORM\System\Query;
use Analogue\ORM\System\ScopeInterface;
use Claromentis\Core\Acl\AclQueryUtil;
use Claromentis\Core\Security\SecurityContext;
use Claromentis\Core\Services;




class AclScope implements ScopeInterface
{
    
    
    
    
    private $acl_query_util;
    public function __construct()
    {
        $this->acl_query_util = Services::I()->{AclQueryUtil::class};
    }
    
    
    
    
    
    
    
    public function apply(Query $_30f942154645a3deca356c5cbdef7313)
    {
        
        
        $_30f942154645a3deca356c5cbdef7313->macro($GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_49391035050d19ba9eaa2bb7e969" . "cf75"], function (Query $_7f5aa4e96d4b415a86ed72ebff677cbe, SecurityContext $context, $rights = PERM_VIEW, $_f5ccc9e009e9c213fed012d6655c1325 = 'permissions', $_eb124d7808f9bc5b62b729ff27cc8272 = '') {
            
            
            $_a9930332dbb35bfb835571676fb76572 = $_7f5aa4e96d4b415a86ed72ebff677cbe->getMapper()->getEntityMap();
            if (!$_a9930332dbb35bfb835571676fb76572 instanceof AclEntityMap) {
                throw new MappingException($GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_6b33909de3b0ef9f" . "f109f3cf1bac1f2f"]);
            }
            $_f48acc58bf4e08e63b1173fb1800d0f6 = $_a9930332dbb35bfb835571676fb76572->getPermissionClass();
            $_484615d0fb97152bbdc1f76242f21797 = $_a9930332dbb35bfb835571676fb76572->getKeyName();
            
            
            $this->applyPermissionCheck($_7f5aa4e96d4b415a86ed72ebff677cbe, $context, $_f48acc58bf4e08e63b1173fb1800d0f6, $rights, $_484615d0fb97152bbdc1f76242f21797, $_f5ccc9e009e9c213fed012d6655c1325, $_eb124d7808f9bc5b62b729ff27cc8272);
            return $_7f5aa4e96d4b415a86ed72ebff677cbe;
        });
        
        
        $_30f942154645a3deca356c5cbdef7313->macro($GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["_5a95e476a760c3d56" . "2e98c285e9aa158"], function (Query $_7f5aa4e96d4b415a86ed72ebff677cbe, SecurityContext $context, $_f48acc58bf4e08e63b1173fb1800d0f6, $rights = PERM_VIEW, $_f5ccc9e009e9c213fed012d6655c1325 = 'permissions', $_eb124d7808f9bc5b62b729ff27cc8272 = '') {
            
            
            $_a9930332dbb35bfb835571676fb76572 = $_7f5aa4e96d4b415a86ed72ebff677cbe->getMapper()->getEntityMap();
            $_484615d0fb97152bbdc1f76242f21797 = $_a9930332dbb35bfb835571676fb76572->getKeyName();
            
            
            $this->applyPermissionCheck($_7f5aa4e96d4b415a86ed72ebff677cbe, $context, $_f48acc58bf4e08e63b1173fb1800d0f6, $rights, $_484615d0fb97152bbdc1f76242f21797, $_f5ccc9e009e9c213fed012d6655c1325, $_eb124d7808f9bc5b62b729ff27cc8272);
            return $_7f5aa4e96d4b415a86ed72ebff677cbe;
        });
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    protected function applyPermissionCheck(Query $_7f5aa4e96d4b415a86ed72ebff677cbe, SecurityContext $context, $_f48acc58bf4e08e63b1173fb1800d0f6, $rights = PERM_VIEW, $_484615d0fb97152bbdc1f76242f21797 = 'id', $_f5ccc9e009e9c213fed012d6655c1325 = 'permissions', $_eb124d7808f9bc5b62b729ff27cc8272 = '')
    {
        $this->acl_query_util->applyPermissionCheck($_7f5aa4e96d4b415a86ed72ebff677cbe, $context, (int) $_f48acc58bf4e08e63b1173fb1800d0f6, (int) $rights, (string) $_484615d0fb97152bbdc1f76242f21797, (string) $_f5ccc9e009e9c213fed012d6655c1325, (string) $_eb124d7808f9bc5b62b729ff27cc8272);
        return $_7f5aa4e96d4b415a86ed72ebff677cbe;
    }
    
    
    
    
    
    
    
    public function remove(Query $_30f942154645a3deca356c5cbdef7313)
    {
        
        
    }
}