<?php
namespace Claromentis\People\UseCase;

$GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"] = (@$GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"] ?: array()) + array("_ca7ee538a8063757" . "3dd3e5c1997a0512" => base64_decode("Tm8gcGVybWlzc2lvbiB0byBhc3NpZ2" . "4gdG8gZXh0cmFuZXQgYXJlYSBJRCA="), "_e4543e131c67c6" . "31b14751cc849d1" . "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["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["_ca7ee538a80637573dd3e5c1997a05" . "12"] . $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"]["_e4543e131c67c631b14751cc84" . "9d1310"] => $_e4543e131c67c631b14751cc849d1310]);
        $this->dispatcher->dispatch(PeopleEventType::SET_EXTRANET_USERS, $event);
        return $_e4543e131c67c631b14751cc849d1310;
    }
}