<?php
namespace Claromentis\People\UseCase;

$GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"] = (@$GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"] ?: array()) + array("_e4543e131c67c631b14" . "751cc849d1310" => base64_decode("dXNlcnM" . "="), "_ca7ee538a80637573dd3e5c1997a05" . "12" => base64_decode("Tm8gcGVybWlzc2lvbiB0byBhc3NpZ24gdG8gZXh0cmFuZXQgYXJ" . "lYSBJRCA="));
use Analogue\ORM\EntityCollection;
use Analogue\ORM\Exceptions\MappingException;
use Claromentis\Core\Event\EventDispatcher;
use Claromentis\Core\Event\GenericEvent;
use Claromentis\Core\Security\Exception\AccessDeniedException;
use Claromentis\Core\Security\SecurityContext;
use Claromentis\People\Event\PeopleEventType;
use Claromentis\People\Exception\NotFoundException;
use Claromentis\People\PeopleAcl;
use Claromentis\People\Repository\ExtranetRepository;
use Claromentis\People\Exception\ValidationException;
use Claromentis\People\Validator\ExtranetValidator;
use Claromentis\People\Validator\Util;
class SetExtranetUsers
{
    
    
    
    
    protected $acl;
    
    
    
    
    protected $dispatcher;
    
    
    
    
    private $repo;
    
    
    
    
    private $validator;
    public function __construct(ExtranetRepository $repo, ExtranetValidator $_24c8d051c033d19c2c97cdc3d7098b1b, PeopleAcl $acl, EventDispatcher $dispatcher)
    {
        $this->repo = $repo;
        $this->validator = $_24c8d051c033d19c2c97cdc3d7098b1b;
        $this->acl = $acl;
        $this->dispatcher = $dispatcher;
    }
    
    
    
    
    
    
    
    
    
    
    
    
    public function UpdateExtranetUsers(SecurityContext $context, int $extranet_id, array $_17247f55ce15f647f57c3ef8bb3a474a) : EntityCollection
    {
        if (!$this->acl->CanAssignExtranetUsers($context, $extranet_id)) {
            throw new AccessDeniedException($GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_ca7ee538a80637573dd3e5c1997a0" . "512"] . $extranet_id);
        }
        Util::ValidateIds($_17247f55ce15f647f57c3ef8bb3a474a);
        $this->validator->ValidateUserList($extranet_id, $_17247f55ce15f647f57c3ef8bb3a474a);
        $_e4543e131c67c631b14751cc849d1310 = $this->repo->updateUserExtranet($extranet_id, $_17247f55ce15f647f57c3ef8bb3a474a);
        $_9a2ef4ae6a5745ffe5fac33c88a222fa = $this->repo->find($extranet_id);
        $event = new GenericEvent($_9a2ef4ae6a5745ffe5fac33c88a222fa, [$GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_e4543e131c67c631b14751cc849d131" . "0"] => $_e4543e131c67c631b14751cc849d1310]);
        $this->dispatcher->dispatch(PeopleEventType::SET_EXTRANET_USERS, $event);
        return $_e4543e131c67c631b14751cc849d1310;
    }
}