<?php
namespace Claromentis\People\UseCase;

$GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"] = (@$GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"] ?: array()) + array("_6c8c5387f046854f266c918d1562fe" . "23" => base64_decode("cGVvcGxlLmVycm9yLmV4dHJhbmV0X3ByaW1hc" . "nlfZm9yYmlkZGVu"), "_f77bfca" . "3490ee96" . "b0c88c87" . "33efe7c5" . "c" => base64_decode("RXh0cmFuZXQgd" . "2l0aCBJRCA="), "_fa96cdf58bff3b0695fb2bc080" . "3d7b12" => base64_decode("IGRvZXMgbm90IGV4" . "aXN0"));
use Claromentis\Core\Localization\Lmsg;
use Claromentis\Core\Security\SecurityContext;
use Claromentis\People\Entity\Extranet;
use Claromentis\People\Exception\PermissionException;
use Claromentis\People\Exception\ValidationException;
use Claromentis\People\PeopleAcl;
use Claromentis\People\Repository\ExtranetRepository;
class SetPrimaryExtranet
{
    
    
    
    
    protected $acl;
    
    
    
    
    protected $lmsg;
    
    
    
    
    protected $repository;
    public function __construct(PeopleAcl $acl, Lmsg $lmsg, ExtranetRepository $_8652ba33e6ffeba02459fa9cbb320851)
    {
        $this->acl = $acl;
        $this->lmsg = $lmsg;
        $this->repository = $_8652ba33e6ffeba02459fa9cbb320851;
    }
    
    
    
    
    
    
    
    
    public function SetPrimaryExtranet(SecurityContext $context, int $id)
    {
        if (!$this->acl->IsPeopleAdmin($context)) {
            throw new PermissionException(($this->lmsg)($GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_6c8c5387f046854f266c918d1562" . "fe23"]));
        }
        
        
        $_9a2ef4ae6a5745ffe5fac33c88a222fa = $this->repository->find($id);
        if (!$_9a2ef4ae6a5745ffe5fac33c88a222fa) {
            throw new ValidationException($GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_f77bfca34" . "90ee96b0c8" . "8c8733efe7" . "c5c"] . $id . $GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_fa96cdf58bff3b069" . "5fb2bc0803d7b12"]);
        }
        $this->repository->setPrimaryExtranet($_9a2ef4ae6a5745ffe5fac33c88a222fa);
    }
}