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

$GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"] = (@$GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"] ?: array()) + array("_49391035050d19ba9eaa2bb" . "7e969cf75" => base64_decode("d2hlcmVDYW" . "4="), "_5a95e47" . "6a760c3d" . "562e98c2" . "85e9aa15" . "8" => base64_decode("d2hlcmV" . "QZXJtaX" . "NzaW9u"), "_6b33909de3b0ef9ff109f" . "3cf1bac1f2f" => base64_decode("VGhlIHdoZXJlQ2FuKCkgQUNMIG1hY3JvIGNhbiBvbmx5IGJlIHVzZWQgd2l0aCBlb" . "nRpdHkgbWFwcyB0aGF0IGltcGxlbWVudCBBY2xFbnRpdHlNYXA="));
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["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["_49391035050" . "d19ba9eaa2bb" . "7e969cf75"], function (Query $_7f5aa4e96d4b415a86ed72ebff677cbe, SecurityContext $context, $rights = PERM_VIEW, $_f5ccc9e009e9c213fed012d6655c1325 = 'permissions', $_eb124d7808f9bc5b62b729ff27cc8272 = '') {
            
            
            $_a9930332dbb35bfb835571676fb76572 = $_7f5aa4e96d4b415a86ed72ebff677cbe->getMapper()->getEntityMap();
            if (!$_a9930332dbb35bfb835571676fb76572 instanceof AclEntityMap) {
                throw new MappingException($GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["_6b33909de3b0ef9f" . "f109f3cf1bac1f2f"]);
            }
            $_f48acc58bf4e08e63b1173fb1800d0f6 = $_a9930332dbb35bfb835571676fb76572->getPermissionClass();
            $_484615d0fb97152bbdc1f76242f21797 = $_a9930332dbb35bfb835571676fb76572->getKeyName();
            
            
            $this->applyPermissionCheck($_7f5aa4e96d4b415a86ed72ebff677cbe, $context, $_f48acc58bf4e08e63b1173fb1800d0f6, $rights, $_484615d0fb97152bbdc1f76242f21797, $_f5ccc9e009e9c213fed012d6655c1325, $_eb124d7808f9bc5b62b729ff27cc8272);
            return $_7f5aa4e96d4b415a86ed72ebff677cbe;
        });
        
        
        $_30f942154645a3deca356c5cbdef7313->macro($GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_5a95e476a760c3d" . "562e98c285e9aa15" . "8"], 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)
    {
        
        
    }
}