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

$GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"] = (@$GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"] ?: array()) + array("_5a95e476a760c3d5" . "62e98c285e9aa158" => base64_decode("d2hlcmVQ" . "ZXJtaXNz" . "aW9u"), "_49391035050d" . "19ba9eaa2bb7e" . "969cf75" => base64_decode("d2hlc" . "mVDYW" . "4="), "_6b33909de3b0ef9ff109f3c" . "f1bac1f2f" => base64_decode("VGhlIHdoZXJlQ2FuKCkgQUNMIG1hY3JvIGNhbiBvbmx5IGJlIHVzZWQgd2l0aCBlbnRpdHkgbWFwcyB0aGF0IGltcGxlbWVu" . "dCBBY2xFbnRpdHlNYXA="));
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["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_4939103505" . "0d19ba9eaa2" . "bb7e969cf75"], function (Query $_7f5aa4e96d4b415a86ed72ebff677cbe, SecurityContext $context, $rights = PERM_VIEW, $_f5ccc9e009e9c213fed012d6655c1325 = 'permissions', $_eb124d7808f9bc5b62b729ff27cc8272 = '') {
            
            
            $_a9930332dbb35bfb835571676fb76572 = $_7f5aa4e96d4b415a86ed72ebff677cbe->getMapper()->getEntityMap();
            if (!$_a9930332dbb35bfb835571676fb76572 instanceof AclEntityMap) {
                throw new MappingException($GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"]["_6b33909de3b0ef9ff109f3cf1bac1" . "f2f"]);
            }
            $_f48acc58bf4e08e63b1173fb1800d0f6 = $_a9930332dbb35bfb835571676fb76572->getPermissionClass();
            $_484615d0fb97152bbdc1f76242f21797 = $_a9930332dbb35bfb835571676fb76572->getKeyName();
            
            
            $this->applyPermissionCheck($_7f5aa4e96d4b415a86ed72ebff677cbe, $context, $_f48acc58bf4e08e63b1173fb1800d0f6, $rights, $_484615d0fb97152bbdc1f76242f21797, $_f5ccc9e009e9c213fed012d6655c1325, $_eb124d7808f9bc5b62b729ff27cc8272);
            return $_7f5aa4e96d4b415a86ed72ebff677cbe;
        });
        
        
        $_30f942154645a3deca356c5cbdef7313->macro($GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"]["_5a95e476a760c3d562e98c28" . "5e9aa158"], 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)
    {
        
        
    }
}