<?php
namespace Claromentis\People\UseCase;

$GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"] = (@$GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"] ?: array()) + array("_e4543e131c67c631b14751cc849d" . "1310" => base64_decode("dXNl" . "cnM="), "_ca7ee538a806375" . "73dd3e5c1997a051" . "2" => base64_decode("Tm8gcGVybWlzc2lvbiB" . "0byBhc3NpZ24gdG8gZX" . "h0cmFuZXQgYXJlYSBJR" . "CA="));
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["__65da1b1ec2d6653e8a0ab7848e536" . "215"]["_ca7ee538a80637573dd3e5c1" . "997a0512"] . $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["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_e4543e131c67c6" . "31b14751cc849d1" . "310"] => $_e4543e131c67c631b14751cc849d1310]);
        $this->dispatcher->dispatch(PeopleEventType::SET_EXTRANET_USERS, $event);
        return $_e4543e131c67c631b14751cc849d1310;
    }
}