<?php
namespace Claromentis\People\UseCase;

$GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"] = (@$GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"] ?: array()) + array("_ca7ee538a80637573dd3e5c199" . "7a0512" => base64_decode("Tm8gcGVybWlzc2lvbiB0byBhc3NpZ24gdG8g" . "ZXh0cmFuZXQgYXJlYSBJRCA="), "_e4543e131" . "c67c631b14" . "751cc849d1" . "310" => base64_decode("dX" . "Nl" . "cn" . "M="));
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["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_ca7ee53" . "8a806375" . "73dd3e5c" . "1997a051" . "2"] . $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["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_e4543e13" . "1c67c631b" . "14751cc84" . "9d1310"] => $_e4543e131c67c631b14751cc849d1310]);
        $this->dispatcher->dispatch(PeopleEventType::SET_EXTRANET_USERS, $event);
        return $_e4543e131c67c631b14751cc849d1310;
    }
}