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

$GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"] = (@$GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"] ?: array()) + array("_6b33909de3b0ef9ff109f3c" . "f1bac1f2f" => base64_decode("VGhlIHdoZXJlQ2FuKCkgQUNMIG1hY3JvIGNhbiBvbmx5IGJlIHVzZWQgd2l0aCBlbnRpdHkgbWFwcyB0aGF0IGltcGxlbWVudCBBY2xFbnRpdHlNYXA" . "="), "_5a95e476a760c3d562e98c285e9aa15" . "8" => base64_decode("d2hlcmVQZXJtaXNz" . "aW9u"), "_49391035050d1" . "9ba9eaa2bb7e96" . "9cf75" => base64_decode("d2hlcmVDYW" . "4="));
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["__65da1b1ec2d6653e8a0ab7848e536" . "215"]["_49391035" . "050d19ba9" . "eaa2bb7e9" . "69cf75"], function (Query $_7f5aa4e96d4b415a86ed72ebff677cbe, SecurityContext $context, $rights = PERM_VIEW, $_f5ccc9e009e9c213fed012d6655c1325 = 'permissions', $_eb124d7808f9bc5b62b729ff27cc8272 = '') {
            
            
            $_a9930332dbb35bfb835571676fb76572 = $_7f5aa4e96d4b415a86ed72ebff677cbe->getMapper()->getEntityMap();
            if (!$_a9930332dbb35bfb835571676fb76572 instanceof AclEntityMap) {
                throw new MappingException($GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_6b33909de3b0ef" . "9ff109f3cf1bac1" . "f2f"]);
            }
            $_f48acc58bf4e08e63b1173fb1800d0f6 = $_a9930332dbb35bfb835571676fb76572->getPermissionClass();
            $_484615d0fb97152bbdc1f76242f21797 = $_a9930332dbb35bfb835571676fb76572->getKeyName();
            
            
            $this->applyPermissionCheck($_7f5aa4e96d4b415a86ed72ebff677cbe, $context, $_f48acc58bf4e08e63b1173fb1800d0f6, $rights, $_484615d0fb97152bbdc1f76242f21797, $_f5ccc9e009e9c213fed012d6655c1325, $_eb124d7808f9bc5b62b729ff27cc8272);
            return $_7f5aa4e96d4b415a86ed72ebff677cbe;
        });
        
        
        $_30f942154645a3deca356c5cbdef7313->macro($GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"]["_5a95e476a" . "760c3d562e" . "98c285e9aa" . "158"], 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)
    {
        
        
    }
}