fix(fixtureavatar): resolution csfixer
Cadoles/nineskeletor/pipeline/pr-master This commit looks good
Details
Cadoles/nineskeletor/pipeline/pr-master This commit looks good
Details
This commit is contained in:
parent
3af16b4c8b
commit
7d8ec5d8c5
|
@ -8,18 +8,18 @@ use App\Entity\Niveau03;
|
|||
use App\Entity\Niveau04;
|
||||
use App\Entity\User;
|
||||
use App\Entity\UserModo;
|
||||
use App\Service\MinioService;
|
||||
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||
use Doctrine\ORM\Id\AssignedGenerator;
|
||||
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
use LasseRafn\InitialAvatarGenerator\InitialAvatar;
|
||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
use Symfony\Component\Console\Input\ArrayInput;
|
||||
use Symfony\Component\Console\Output\BufferedOutput;
|
||||
use Symfony\Component\Console\Output\ConsoleOutput;
|
||||
use Symfony\Component\HttpKernel\KernelInterface;
|
||||
use LasseRafn\InitialAvatarGenerator\InitialAvatar;
|
||||
use App\Service\MinioService;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Component\HttpKernel\KernelInterface;
|
||||
|
||||
class AppFixtures extends Fixture
|
||||
{
|
||||
|
@ -53,8 +53,8 @@ class AppFixtures extends Fixture
|
|||
$manager->flush();
|
||||
|
||||
// Color
|
||||
$this->colorbg=$manager->getRepository("App\Entity\Config")->find("colorbgbodydark")->getValue();
|
||||
$this->colorft=$manager->getRepository("App\Entity\Config")->find("colorfttitledark")->getValue();
|
||||
$this->colorbg = $manager->getRepository("App\Entity\Config")->find('colorbgbodydark')->getValue();
|
||||
$this->colorft = $manager->getRepository("App\Entity\Config")->find('colorfttitledark')->getValue();
|
||||
|
||||
// app:Synchro
|
||||
$manager->clear();
|
||||
|
@ -250,7 +250,6 @@ class AppFixtures extends Fixture
|
|||
$user->setNiveau01($niveau02->getNiveau01());
|
||||
$user->setNiveau02($niveau02);
|
||||
|
||||
|
||||
$this->generateavatar($username);
|
||||
$user->setAvatar($username.'.png');
|
||||
|
||||
|
@ -290,7 +289,6 @@ class AppFixtures extends Fixture
|
|||
$this->generateavatar($username);
|
||||
$user->setAvatar($username.'.png');
|
||||
|
||||
|
||||
$manager->flush();
|
||||
}
|
||||
|
||||
|
@ -364,7 +362,8 @@ class AppFixtures extends Fixture
|
|||
return $r;
|
||||
}
|
||||
|
||||
private function generateavatar($username) {
|
||||
private function generateavatar($username)
|
||||
{
|
||||
$avatar = new InitialAvatar();
|
||||
$image = $avatar->name($username)->height(100)->width(100)->background($this->colorbg)->color($this->colorft)->generate();
|
||||
file_put_contents($this->kernel->getProjectDir().'/var/tmp/avatar/'.$username.'.png', $image->stream('png', 90));
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace App\EventListener;
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Event\ExceptionEvent;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
|
||||
|
||||
class ExceptionListener implements EventSubscriberInterface
|
||||
{
|
||||
private $router;
|
||||
|
||||
public function __construct(UrlGeneratorInterface $router) {
|
||||
public function __construct(UrlGeneratorInterface $router)
|
||||
{
|
||||
$this->router = $router;
|
||||
}
|
||||
|
||||
|
@ -40,6 +41,5 @@ class ExceptionListener implements EventSubscriberInterface
|
|||
|
||||
// optionally set the custom response
|
||||
$event->setResponse($response);
|
||||
|
||||
}
|
||||
}
|
|
@ -157,6 +157,8 @@ class LdapService
|
|||
break;
|
||||
case 'basedn': return $this->basedn;
|
||||
break;
|
||||
case 'baseorganisation': return $this->baseorganisation;
|
||||
break;
|
||||
case 'filteruser': return $this->filteruser;
|
||||
break;
|
||||
}
|
||||
|
@ -187,13 +189,27 @@ class LdapService
|
|||
return $this->resultToArray($result);
|
||||
}
|
||||
|
||||
public function deleteByDN($dn)
|
||||
public function deleteByDN($dn, $recursive = false)
|
||||
{
|
||||
$connection = $this->connect();
|
||||
if (false == $recursive) {
|
||||
$removed = ldap_delete($connection, $dn);
|
||||
if (!$removed) {
|
||||
$this->ldapError();
|
||||
}
|
||||
} else {
|
||||
// searching for sub entries
|
||||
$sr = ldap_list($connection, $dn, 'ObjectClass=*', ['']);
|
||||
$info = ldap_get_entries($connection, $sr);
|
||||
for ($i = 0; $i < $info['count']; ++$i) {
|
||||
$result = $this->deleteByDN($info[$i]['dn'], $recursive);
|
||||
if (!$result) {
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
return ldap_delete($connection, $dn);
|
||||
}
|
||||
}
|
||||
|
||||
public function rename($oldDN, $newDN, $parentDN = '', $deleteOldDN = true)
|
||||
|
|
Loading…
Reference in New Issue