<?php
namespace Claromentis\People\UseCase;

$GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"] = (@$GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"] ?: array()) + array("_f4532747e1604b7bf86d299" . "f9b9b0583" => base64_decode("WW91IGRvIG5vdCBoYXZlIHBlcm1pc3Npb24gdG8gdmlldyB0aGlzIHJ" . "vbGU="), "_94c782c81807" . "66e1ff1870975" . "a93053d" => base64_decode("Um9sZSBub" . "3QgZm91bm" . "Q="));
use Claromentis\Core\Security\SecurityContext;
use Claromentis\People\Entity\Role;
use Claromentis\People\Exception\NotFoundException;
use Claromentis\People\Exception\PermissionException;
use Claromentis\People\Filter\UserFilter;
use Claromentis\People\PeopleAcl;
use Claromentis\People\Repository\RoleRepository;
class GetRoleUsers
{
    
    
    
    
    protected $acl;
    
    
    
    
    protected $role_repository;
    
    
    
    
    protected $get_users;
    
    
    
    
    
    
    public function __construct(PeopleAcl $acl, RoleRepository $_90f6cb30a269a622b4c838bfd5a0a5db, GetUsers $get_users)
    {
        $this->acl = $acl;
        $this->role_repository = $_90f6cb30a269a622b4c838bfd5a0a5db;
        $this->get_users = $get_users;
    }
    
    
    
    
    
    
    
    
    
    public function GetRoleUsers(SecurityContext $context, int $role_id, UserFilter $_03e9164d0a343b742df4793268b80767) : array
    {
        
        
        
        
        $_d1071a032215f0eb5c4a8ef175f7049d = $this->role_repository->find($role_id);
        if (!$_d1071a032215f0eb5c4a8ef175f7049d) {
            throw new NotFoundException($GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["_94c782c8" . "180766e1f" . "f1870975a" . "93053d"]);
        }
        if (!$this->acl->CanViewRole($context, $_d1071a032215f0eb5c4a8ef175f7049d)) {
            throw new PermissionException($GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_f4532747e1" . "604b7bf86d2" . "99f9b9b0583"]);
        }
        $_03e9164d0a343b742df4793268b80767->SetPeopleAcl($this->acl);
        $_03e9164d0a343b742df4793268b80767->SetRoleIds($role_id);
        return $this->get_users->GetUsers($_03e9164d0a343b742df4793268b80767);
    }
}