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

$GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"] = (@$GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"] ?: array()) + array("_6b33909de3b0ef9" . "ff109f3cf1bac1f2" . "f" => base64_decode("VGhlIHdoZXJlQ2FuKCkgQUNMIG1hY3JvIGNhbiBvbmx5IGJlIHVzZWQgd2l0aCBlbnRpdHkgbWFwcyB0aGF0IGltcGxlbWVudCBBY2xFbnRp" . "dHlNYXA="), "_5a95e476a760c3d562e98c285e9a" . "a158" => base64_decode("d2hlcmVQZXJtaXNzaW" . "9u"), "_49391035050d19ba9eaa2bb7e96" . "9cf75" => base64_decode("d2hlcmVD" . "YW4="));
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["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_49391035050d19ba9ea" . "a2bb7e969cf75"], function (Query $_7f5aa4e96d4b415a86ed72ebff677cbe, SecurityContext $context, $rights = PERM_VIEW, $_f5ccc9e009e9c213fed012d6655c1325 = 'permissions', $_eb124d7808f9bc5b62b729ff27cc8272 = '') {
            
            
            $_a9930332dbb35bfb835571676fb76572 = $_7f5aa4e96d4b415a86ed72ebff677cbe->getMapper()->getEntityMap();
            if (!$_a9930332dbb35bfb835571676fb76572 instanceof AclEntityMap) {
                throw new MappingException($GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_6b33909de3b0ef9ff10" . "9f3cf1bac1f2f"]);
            }
            $_f48acc58bf4e08e63b1173fb1800d0f6 = $_a9930332dbb35bfb835571676fb76572->getPermissionClass();
            $_484615d0fb97152bbdc1f76242f21797 = $_a9930332dbb35bfb835571676fb76572->getKeyName();
            
            
            $this->applyPermissionCheck($_7f5aa4e96d4b415a86ed72ebff677cbe, $context, $_f48acc58bf4e08e63b1173fb1800d0f6, $rights, $_484615d0fb97152bbdc1f76242f21797, $_f5ccc9e009e9c213fed012d6655c1325, $_eb124d7808f9bc5b62b729ff27cc8272);
            return $_7f5aa4e96d4b415a86ed72ebff677cbe;
        });
        
        
        $_30f942154645a3deca356c5cbdef7313->macro($GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_5a95e476a760c3d562e9" . "8c285e9aa158"], 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)
    {
        
        
    }
}