Commit 43f00f57 by Julien Jorry

BO : empêcher la suppresion des groupes admin

parent ff11addd
......@@ -2665,16 +2665,16 @@
},
{
"name": "knplabs/gaufrette",
"version": "v0.8.0",
"version": "v0.8.1",
"source": {
"type": "git",
"url": "https://github.com/KnpLabs/Gaufrette.git",
"reference": "1f7c4bf5fa603d9396ba812cf3171713adc7b394"
"reference": "80cc42e1c5f008a8fc9d02e856c60140c7d1ea19"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/KnpLabs/Gaufrette/zipball/1f7c4bf5fa603d9396ba812cf3171713adc7b394",
"reference": "1f7c4bf5fa603d9396ba812cf3171713adc7b394",
"url": "https://api.github.com/repos/KnpLabs/Gaufrette/zipball/80cc42e1c5f008a8fc9d02e856c60140c7d1ea19",
"reference": "80cc42e1c5f008a8fc9d02e856c60140c7d1ea19",
"shasum": ""
},
"require": {
......@@ -2750,7 +2750,7 @@
"filesystem",
"media"
],
"time": "2018-12-21T14:09:42+00:00"
"time": "2019-01-11T10:04:44+00:00"
},
{
"name": "knplabs/knp-components",
......@@ -4875,16 +4875,16 @@
},
{
"name": "sonata-project/core-bundle",
"version": "3.14.1",
"version": "3.15.0",
"source": {
"type": "git",
"url": "https://github.com/sonata-project/SonataCoreBundle.git",
"reference": "b38dfe1709c02cb9bb95f38c48103803f0aaaf3c"
"reference": "664d338cde48effa27c96846a131d75b4b5ea255"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sonata-project/SonataCoreBundle/zipball/b38dfe1709c02cb9bb95f38c48103803f0aaaf3c",
"reference": "b38dfe1709c02cb9bb95f38c48103803f0aaaf3c",
"url": "https://api.github.com/repos/sonata-project/SonataCoreBundle/zipball/664d338cde48effa27c96846a131d75b4b5ea255",
"reference": "664d338cde48effa27c96846a131d75b4b5ea255",
"shasum": ""
},
"require": {
......@@ -4955,7 +4955,7 @@
"keywords": [
"sonata"
],
"time": "2019-01-17T07:33:02+00:00"
"time": "2019-01-20T13:25:19+00:00"
},
{
"name": "sonata-project/datagrid-bundle",
......@@ -5018,16 +5018,16 @@
},
{
"name": "sonata-project/doctrine-extensions",
"version": "1.1.4",
"version": "1.1.5",
"source": {
"type": "git",
"url": "https://github.com/sonata-project/sonata-doctrine-extensions.git",
"reference": "1f619e6f5a27b5bbaa48ab0872b19dc2064bc03f"
"reference": "187495be73b2099c6ff8d0c2384ca31a8adca66e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sonata-project/sonata-doctrine-extensions/zipball/1f619e6f5a27b5bbaa48ab0872b19dc2064bc03f",
"reference": "1f619e6f5a27b5bbaa48ab0872b19dc2064bc03f",
"url": "https://api.github.com/repos/sonata-project/sonata-doctrine-extensions/zipball/187495be73b2099c6ff8d0c2384ca31a8adca66e",
"reference": "187495be73b2099c6ff8d0c2384ca31a8adca66e",
"shasum": ""
},
"require": {
......@@ -5082,29 +5082,29 @@
"doctrine2",
"json"
],
"time": "2019-01-15T23:01:57+00:00"
"time": "2019-01-19T09:07:22+00:00"
},
{
"name": "sonata-project/doctrine-orm-admin-bundle",
"version": "3.7.0",
"version": "3.8.0",
"source": {
"type": "git",
"url": "https://github.com/sonata-project/SonataDoctrineORMAdminBundle.git",
"reference": "8676f4a1293c9e7ea2978be9ac6746ad7d4a2e23"
"reference": "276e0925d6824ddd5a791146df08f922197b9bd7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sonata-project/SonataDoctrineORMAdminBundle/zipball/8676f4a1293c9e7ea2978be9ac6746ad7d4a2e23",
"reference": "8676f4a1293c9e7ea2978be9ac6746ad7d4a2e23",
"url": "https://api.github.com/repos/sonata-project/SonataDoctrineORMAdminBundle/zipball/276e0925d6824ddd5a791146df08f922197b9bd7",
"reference": "276e0925d6824ddd5a791146df08f922197b9bd7",
"shasum": ""
},
"require": {
"doctrine/doctrine-bundle": "^1.8",
"doctrine/orm": "^2.4.5",
"php": "^5.6 || ^7.0",
"doctrine/orm": "^2.5",
"php": "^7.1",
"sonata-project/admin-bundle": "^3.29",
"sonata-project/core-bundle": "^3.8",
"sonata-project/exporter": "^1.3.1",
"sonata-project/exporter": "^1.11.0 || ^2.0",
"symfony/config": "^2.8 || ^3.2 || ^4.0",
"symfony/console": "^2.8 || ^3.2 || ^4.0",
"symfony/dependency-injection": "^2.8 || ^3.2 || ^4.0",
......@@ -5126,7 +5126,7 @@
"require-dev": {
"simplethings/entity-audit-bundle": "^0.9 || ^1.0",
"sonata-project/block-bundle": "^3.11",
"symfony/phpunit-bridge": "^4.0"
"symfony/phpunit-bridge": "^4.2"
},
"suggest": {
"simplethings/entity-audit-bundle": "If you want to support for versioning of entities and their associations."
......@@ -5166,7 +5166,7 @@
"generator",
"sonata"
],
"time": "2018-12-29T21:37:07+00:00"
"time": "2019-01-20T16:50:56+00:00"
},
{
"name": "sonata-project/easy-extends-bundle",
......@@ -5230,34 +5230,34 @@
},
{
"name": "sonata-project/exporter",
"version": "1.11.0",
"version": "2.0.0",
"source": {
"type": "git",
"url": "https://github.com/sonata-project/exporter.git",
"reference": "63d1199e802ff8af2826d8410080093f949dcb92"
"reference": "a82bb9c3ed6fe9fa073c8bf145db6449da1ab8e7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sonata-project/exporter/zipball/63d1199e802ff8af2826d8410080093f949dcb92",
"reference": "63d1199e802ff8af2826d8410080093f949dcb92",
"url": "https://api.github.com/repos/sonata-project/exporter/zipball/a82bb9c3ed6fe9fa073c8bf145db6449da1ab8e7",
"reference": "a82bb9c3ed6fe9fa073c8bf145db6449da1ab8e7",
"shasum": ""
},
"require": {
"php": "^5.6 || ^7.0"
"php": "^7.2"
},
"require-dev": {
"doctrine/dbal": "^2.5",
"doctrine/orm": "^2.4.5",
"matthiasnoback/symfony-config-test": "^2.0",
"matthiasnoback/symfony-dependency-injection-test": "^1.0",
"matthiasnoback/symfony-config-test": "^4.0",
"matthiasnoback/symfony-dependency-injection-test": "^3.0",
"propel/propel1": "^1.6",
"symfony/config": "^2.8 || ^3.2 || ^4.0",
"symfony/dependency-injection": "^2.8 || ^3.2 || ^4.0",
"symfony/http-foundation": "^2.8 || ^3.2 || ^4.0",
"symfony/http-kernel": "^2.8 || ^3.2 || ^4.0",
"symfony/phpunit-bridge": "^4.0",
"symfony/property-access": "^2.8 || ^3.2 || ^4.0",
"symfony/routing": "^2.8 || ^3.2 || ^4.0"
"symfony/config": "^3.4 || ^4.0",
"symfony/dependency-injection": "^3.4 || ^4.0",
"symfony/http-foundation": "^3.4 || ^4.0",
"symfony/http-kernel": "^3.4 || ^4.0",
"symfony/phpunit-bridge": "^4.1",
"symfony/property-access": "^3.4 || ^4.0",
"symfony/routing": "^3.4 || ^4.0"
},
"suggest": {
"ext-curl": "*",
......@@ -5268,12 +5268,11 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
"dev-master": "2.x-dev"
}
},
"autoload": {
"psr-4": {
"Exporter\\": "aliases/",
"Sonata\\Exporter\\": "src/"
}
},
......@@ -5297,7 +5296,7 @@
"export",
"xls"
],
"time": "2019-01-10T19:05:17+00:00"
"time": "2018-12-15T18:40:08+00:00"
},
{
"name": "sonata-project/intl-bundle",
......@@ -5373,16 +5372,16 @@
},
{
"name": "sonata-project/media-bundle",
"version": "3.17.1",
"version": "3.18.1",
"source": {
"type": "git",
"url": "https://github.com/sonata-project/SonataMediaBundle.git",
"reference": "a161cd4614503393e58f2f4e4f328208c575244e"
"reference": "fdae9b6889eec8c63b69b55b8ec11f6bcb485e26"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sonata-project/SonataMediaBundle/zipball/a161cd4614503393e58f2f4e4f328208c575244e",
"reference": "a161cd4614503393e58f2f4e4f328208c575244e",
"url": "https://api.github.com/repos/sonata-project/SonataMediaBundle/zipball/fdae9b6889eec8c63b69b55b8ec11f6bcb485e26",
"reference": "fdae9b6889eec8c63b69b55b8ec11f6bcb485e26",
"shasum": ""
},
"require": {
......@@ -5393,8 +5392,8 @@
"kriswallsmith/buzz": "^0.15 || ^0.16",
"php": "^7.1",
"psr/log": "^1.0",
"sonata-project/core-bundle": "^3.9",
"sonata-project/doctrine-extensions": "^1.1",
"sonata-project/core-bundle": "^3.14",
"sonata-project/doctrine-extensions": "^1.1.3",
"sonata-project/easy-extends-bundle": "^2.5",
"symfony/config": "^2.8 || ^3.2 || ^4.0",
"symfony/console": "^2.8 || ^3.2 || ^4.0",
......@@ -5418,10 +5417,11 @@
"twig/twig": "^1.35 || ^2.0"
},
"conflict": {
"doctrine/dbal": "<2.6.0",
"friendsofsymfony/rest-bundle": "<2.1 || >=3.0",
"jms/serializer": "<0.13",
"liip/imagine-bundle": "<1.9",
"sonata-project/block-bundle": "<3.11 || >=4.0",
"sonata-project/block-bundle": "<3.14 || >=4.0",
"sonata-project/classification-bundle": "<3.0 || >= 5.0",
"sonata-project/formatter-bundle": "<3.4",
"sonata-project/notification-bundle": "<3.3",
......@@ -5436,7 +5436,7 @@
"matthiasnoback/symfony-dependency-injection-test": "^3.1",
"nelmio/api-doc-bundle": "^2.11",
"sonata-project/admin-bundle": "^3.31",
"sonata-project/block-bundle": "^3.11",
"sonata-project/block-bundle": "^3.14",
"sonata-project/datagrid-bundle": "^2.3",
"sonata-project/doctrine-orm-admin-bundle": "^3.4",
"sonata-project/formatter-bundle": "^3.4 || ^4.0",
......@@ -5493,7 +5493,7 @@
"vimeo",
"youtube"
],
"time": "2019-01-12T12:11:00+00:00"
"time": "2019-01-21T18:38:36+00:00"
},
{
"name": "sonata-project/translation-bundle",
......
......@@ -9,8 +9,12 @@ sonata_user:
admin: # Admin Classes
user:
class: App\Application\Sonata\UserBundle\Admin\UserAdmin
# controller: SonataAdminBundle:CRUD
controller: App\Controller\CRUD\CRUDController
translation: SonataUserBundle
group:
class: Sonata\UserBundle\Admin\Entity\GroupAdmin
controller: App\Controller\CRUD\GroupCRUDController
translation: SonataUserBundle
impersonating:
route: sonata_admin_dashboard
......
<?php
namespace App\Controller\CRUD;
use Sonata\AdminBundle\Controller\CRUDController as Controller;
use Sonata\AdminBundle\Datagrid\ProxyQueryInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
class GroupCRUDController extends Controller
{
public function deleteAction($id)
{
$request = $this->getRequest();
$id = $request->get($this->admin->getIdParameter());
$object = $this->admin->getObject($id);
if (!$object) {
throw $this->createNotFoundException(sprintf('unable to find the object with id: %s', $id));
}
if ($object->hasRole('ROLE_ADMIN_SIEGE') || $object->hasRole('ROLE_SUPER_ADMIN') || $object->hasRole('ROLE_ADMIN')) {
$this->addFlash(
'sonata_flash_error',
'Vous ne pouvez pas supprimer les groupe ayant les rôles ROLE_SUPER_ADMIN, ROLE_ADMIN et ROLE_ADMIN_SIEGE !'
);
return $this->redirectTo($object);
}
return parent::deleteAction($id);
}
public function batchActionDelete(ProxyQueryInterface $query)
{
$objects = $query->execute();
foreach ($objects as $object) {
if ($object->hasRole('ROLE_ADMIN_SIEGE') || $object->hasRole('ROLE_SUPER_ADMIN') || $object->hasRole('ROLE_ADMIN')) {
$this->addFlash(
'sonata_flash_error',
'Vous ne pouvez pas supprimer les groupe ayant les rôles ROLE_SUPER_ADMIN, ROLE_ADMIN et ROLE_ADMIN_SIEGE !'
);
return new RedirectResponse(
$this->admin->generateUrl('list', array('filter' => $this->admin->getFilterParameters()))
);
}
}
return parent::batchActionDelete($query);
}
}
......@@ -24,36 +24,8 @@ class IndexController extends AbstractController
// array('%name%' => $user->getName())
// );
// GEOCODING ADDRESS :
// $httpClient = new \Http\Adapter\Guzzle6\Client();
// $provider = Nominatim::withOpenStreetMapServer($httpClient, 'test');
// $geocoder = new \Geocoder\StatefulGeocoder($provider, 'fr');
// $result = $geocoder->geocodeQuery(GeocodeQuery::create("19300 Rosiers-d'Egletons"));
// dump($result);
// exit();
return $this->render('index.html.twig', [
'news' => array(),
]);
}
/**
* @Route("/toto/{id}/{name}", name="toto")
*/
// public function index(TranslatorInterface $translator)
public function toto($id, $name)
{
// Exemple pour la traduction :
// $translated = $translator->trans('Symfony is great');
// $translator->transChoice(
// 'Hurry up %name%! There is one apple left.|There are %count% apples left.',
// 10,
// // no need to include %count% here; Symfony does that for you
// array('%name%' => $user->getName())
// );
return $this->render('index.html.twig', [
'toto' => 'toto',
'id' => $id
]);
}
}
......@@ -212,9 +212,10 @@ class User extends BaseUser
*/
public function removeCotisation(Cotisation $cotisation)
{
if ($this->cotisations->contains($cotisation)) {
$this->cotisations->removeElement($cotisation);
}
throw new \LogicException('User::removeCotisation : This code should not be reached!');
// if ($this->cotisations->contains($cotisation)) {
// $this->cotisations->removeElement($cotisation);
// }
return $this;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment