fix(continuous-integration): correction point phpstan
All checks were successful
Cadoles/nineskeletor/pipeline/pr-master This commit looks good
All checks were successful
Cadoles/nineskeletor/pipeline/pr-master This commit looks good
This commit is contained in:
@ -23,6 +23,44 @@ use App\Entity\UserGroup;
|
||||
|
||||
class SynchroCommand extends Command
|
||||
{
|
||||
private $container;
|
||||
private $em;
|
||||
private $ldap;
|
||||
private $apiservice;
|
||||
private $output;
|
||||
private $filesystem;
|
||||
private $rootlog;
|
||||
private $appMasteridentity;
|
||||
private $synchro;
|
||||
private $synchropurgeniveau01;
|
||||
private $synchropurgeniveau02;
|
||||
private $synchropurgegroup;
|
||||
private $synchropurgeuser;
|
||||
private $host;
|
||||
private $port;
|
||||
private $usetls;
|
||||
private $userwriter;
|
||||
private $user;
|
||||
private $password;
|
||||
private $basedn;
|
||||
private $baseorganisation;
|
||||
private $baseniveau01;
|
||||
private $baseniveau02;
|
||||
private $basegroup;
|
||||
private $baseuser;
|
||||
private $username;
|
||||
private $firstname;
|
||||
private $lastname;
|
||||
private $email;
|
||||
private $avatar;
|
||||
private $memberof;
|
||||
private $groupgid;
|
||||
private $groupname;
|
||||
private $groupmember;
|
||||
private $groupmemberisdn;
|
||||
private $filtergroup;
|
||||
private $filteruser;
|
||||
|
||||
public function __construct(ContainerInterface $container,EntityManagerInterface $em,LdapService $ldapservice,ApiService $apiservice)
|
||||
{
|
||||
parent::__construct();
|
||||
@ -910,14 +948,6 @@ class SynchroCommand extends Command
|
||||
$user->setRole("ROLE_ADMIN");
|
||||
else {
|
||||
$user->setRole("ROLE_USER");
|
||||
|
||||
// Si modèle scribe
|
||||
$ldap_template = $this->container->getParameter('ldap_template');
|
||||
if($ldap_template=="scribe") {
|
||||
$ldapfilter="(|(&(uid=".$user->getUsername().")(ENTPersonProfils=enseignant))(&(uid=".$user->getUsername().")(typeadmin=0))(&(uid=".$user->getUsername().")(typeadmin=2)))";
|
||||
$results = $this->ldap->search($ldapfilter, ['uid'], $this->ldap_basedn);
|
||||
if($results) $user->setRole("ROLE_ANIM");
|
||||
}
|
||||
}
|
||||
|
||||
$this->em->persist($user);
|
||||
|
@ -142,7 +142,7 @@ class CronController extends AbstractController
|
||||
|
||||
public function log()
|
||||
{
|
||||
return $this->render($this->render.'logs.html.twig', [
|
||||
return $this->render($this->twig.'logs.html.twig', [
|
||||
'useheader' => true,
|
||||
'usesidebar' => true,
|
||||
]);
|
||||
@ -175,8 +175,6 @@ class CronController extends AbstractController
|
||||
}
|
||||
|
||||
if ($form->get('submit')->isClicked() && !$form->isValid()) {
|
||||
$this->get('session')->getFlashBag()->clear();
|
||||
|
||||
$errors = $form->getErrors();
|
||||
foreach( $errors as $error ) {
|
||||
$request->getSession()->getFlashBag()->add("error", $error->getMessage());
|
||||
|
@ -11,6 +11,7 @@ use Symfony\Component\Filesystem\Filesystem;
|
||||
|
||||
class MinioController extends AbstractController
|
||||
{
|
||||
private $appKernel;
|
||||
private $minio;
|
||||
|
||||
public function __construct(KernelInterface $appKernel, MinioService $minio)
|
||||
|
@ -15,7 +15,6 @@ use App\Service\MailService;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
|
||||
use App\Entity\User;
|
||||
use App\Entity\Usergroup;
|
||||
use App\Entity\Registration;
|
||||
use App\Form\RegistrationType as Form;
|
||||
use App\Form\ResetpwdType;
|
||||
|
@ -127,7 +127,7 @@ class SecurityController extends AbstractController
|
||||
$this->submitSSONiveau01($attributes,$em);
|
||||
$this->submitSSOGroup($attributes,$em);
|
||||
$niveau01=$em->getRepository('App\Entity\Niveau01')->calculateSSONiveau01($attributes);
|
||||
$user=$this->submituser($username,$firstname,$lastname,$email,$password,$niveau01,$em);
|
||||
$user=$this->submituser($username,$firstname,$lastname,$email,$avatar,$niveau01,$em);
|
||||
$user=$em->getRepository('App\Entity\Group')->calculateSSOGroup($user,$attributes);
|
||||
}
|
||||
elseif($this->getParameter("casAutoupdate")) {
|
||||
|
@ -369,7 +369,7 @@ class UserController extends AbstractController
|
||||
if(!$usermodo) {
|
||||
$usermodo= new UserModo();
|
||||
$usermodo->setUser($data);
|
||||
$usermodo->setNiveau01($dataniveau01);
|
||||
$usermodo->setNiveau01($niveau01);
|
||||
|
||||
$em->getManager()->persist($usermodo);
|
||||
$em->getManager()->flush();
|
||||
|
@ -212,18 +212,6 @@ class Group
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getInvitations(): ?array
|
||||
{
|
||||
return $this->invitations;
|
||||
}
|
||||
|
||||
public function setInvitations(?array $invitations): self
|
||||
{
|
||||
$this->invitations = $invitations;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getOwner(): ?User
|
||||
{
|
||||
return $this->owner;
|
||||
|
@ -128,6 +128,8 @@ class Registration implements UserInterface, LegacyPasswordAuthenticatedUserInte
|
||||
|
||||
|
||||
//== CODE A NE PAS REGENERER
|
||||
private $roles;
|
||||
|
||||
public function getUserIdentifier(): string
|
||||
{
|
||||
return $this->username;
|
||||
|
@ -15,9 +15,10 @@ use App\Entity\Audit as Audit;
|
||||
|
||||
class AllSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
private $entity;
|
||||
private $em;
|
||||
private $token;
|
||||
private $params;
|
||||
private $entity;
|
||||
|
||||
public function __construct(EntityManagerInterface $em, TokenStorageInterface $token,ParameterBagInterface $params)
|
||||
{
|
||||
@ -69,7 +70,7 @@ class AllSubscriber implements EventSubscriberInterface
|
||||
|
||||
$nameold="";
|
||||
if($metaCar->hasField("name"))
|
||||
$nameold=" = ".$entity>getName();
|
||||
$nameold=" = ".$entity->getName();
|
||||
elseif($metaCar->hasField("label"))
|
||||
$nameold=" = ".$entity->getLabel();
|
||||
elseif($metaCar->hasField("username"))
|
||||
@ -93,7 +94,7 @@ class AllSubscriber implements EventSubscriberInterface
|
||||
|
||||
$nameold="";
|
||||
if($metaCar->hasField("name"))
|
||||
$nameold=" = ".$entity>getName();
|
||||
$nameold=" = ".$entity->getName();
|
||||
elseif($metaCar->hasField("label"))
|
||||
$nameold=" = ".$entity->getLabel();
|
||||
elseif($metaCar->hasField("username"))
|
||||
|
@ -11,6 +11,8 @@ use App\Service\LdapService;
|
||||
|
||||
class Niveau01Repository extends ServiceEntityRepository
|
||||
{
|
||||
private $ldapservice;
|
||||
|
||||
public function __construct(ManagerRegistry $registry, LdapService $ldapservice)
|
||||
{
|
||||
parent::__construct($registry, Niveau01::class);
|
||||
|
@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Statistic;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
class StatisticRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Statistic::class);
|
||||
}
|
||||
|
||||
public function add(Statistic $entity, bool $flush = false): void
|
||||
{
|
||||
$this->getEntityManager()->persist($entity);
|
||||
|
||||
if ($flush) {
|
||||
$this->getEntityManager()->flush();
|
||||
}
|
||||
}
|
||||
|
||||
public function remove(Statistic $entity, bool $flush = false): void
|
||||
{
|
||||
$this->getEntityManager()->remove($entity);
|
||||
|
||||
if ($flush) {
|
||||
$this->getEntityManager()->flush();
|
||||
}
|
||||
}
|
||||
}
|
@ -12,6 +12,34 @@ use App\Entity\UserGroup;
|
||||
|
||||
class LdapService
|
||||
{
|
||||
private $appMasteridentity;
|
||||
private $synchro;
|
||||
private $host;
|
||||
private $port;
|
||||
private $usetls;
|
||||
private $userwriter;
|
||||
private $user;
|
||||
private $password;
|
||||
private $basedn;
|
||||
private $baseorganisation;
|
||||
private $baseniveau01;
|
||||
private $baseniveau02;
|
||||
private $basegroup;
|
||||
private $baseuser;
|
||||
private $username;
|
||||
private $firstname;
|
||||
private $lastname;
|
||||
private $email;
|
||||
private $avatar;
|
||||
private $memberof;
|
||||
private $groupgid;
|
||||
private $groupname;
|
||||
private $groupmember;
|
||||
private $groupmemberisdn;
|
||||
private $filtergroup;
|
||||
private $filteruser;
|
||||
private $userattributes;
|
||||
|
||||
private $connection;
|
||||
|
||||
public function __construct(ContainerInterface $container)
|
||||
@ -318,8 +346,6 @@ class LdapService
|
||||
$attrs = array();
|
||||
|
||||
// Attributs associés au password
|
||||
if($this->type=="AD")
|
||||
$attrs["unicodepwd"] = $user->getPasswordad();
|
||||
$attrs['userpassword'] = $user->getPassword();
|
||||
|
||||
// Rechercher le DN du user
|
||||
|
@ -13,12 +13,14 @@ class MinioService
|
||||
{
|
||||
const ERR_UNAVAILABLE = 'Service de gestion de fichiers momentanément indisponible.';
|
||||
const ERR_FILE_NOT_FOUND = 'messages.minio.404';
|
||||
protected $client;
|
||||
protected $listClient;
|
||||
protected $minioBucket;
|
||||
protected $minioRoot;
|
||||
protected $minioPathStyle;
|
||||
protected $minioSecure;
|
||||
|
||||
private $rootPath;
|
||||
private $client;
|
||||
private $listClient;
|
||||
private $minioBucket;
|
||||
private $minioRoot;
|
||||
private $minioPathStyle;
|
||||
private $minioSecure;
|
||||
|
||||
public function __construct($rootPath, $minioUrl, $minioKey, $minioSecret, $minioBucket, $minioRoot, $minioPathstyle, $minioSecure)
|
||||
{
|
||||
@ -48,7 +50,7 @@ class MinioService
|
||||
} catch (S3Exception $e) {
|
||||
switch ($e->getResponse()->getStatusCode()) {
|
||||
case 404:
|
||||
throw new NotFoundHttpException($this->translator->trans(self::ERR_FILE_NOT_FOUND, [], 'messages'));
|
||||
throw new NotFoundHttpException(self::ERR_FILE_NOT_FOUND);
|
||||
break;
|
||||
default:
|
||||
\Sentry\captureException($e);
|
||||
|
Reference in New Issue
Block a user