mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
cs: Fix code style (safe rules only).
This commit is contained in:
@@ -1,35 +1,38 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\ThirdPartyBundle\DependencyInjection;
|
||||
|
||||
use Chill\ThirdPartyBundle\Controller\ThirdPartyController;
|
||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||
use Chill\ThirdPartyBundle\Form\ThirdPartyType;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\Config\FileLocator;
|
||||
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
||||
use Symfony\Component\DependencyInjection\Loader;
|
||||
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
|
||||
use Chill\ThirdPartyBundle\Security\Voter\ThirdPartyVoter;
|
||||
use Symfony\Component\Config\FileLocator;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
|
||||
use Symfony\Component\DependencyInjection\Loader;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
||||
|
||||
/**
|
||||
* This is the class that loads and manages your bundle configuration.
|
||||
*
|
||||
* @link http://symfony.com/doc/current/cookbook/bundles/extension.html
|
||||
* @see http://symfony.com/doc/current/cookbook/bundles/extension.html
|
||||
*/
|
||||
class ChillThirdPartyExtension extends Extension implements PrependExtensionInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function load(array $configs, ContainerBuilder $container)
|
||||
{
|
||||
$configuration = new Configuration();
|
||||
$config = $this->processConfiguration($configuration, $configs);
|
||||
|
||||
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../config'));
|
||||
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../config'));
|
||||
$loader->load('services.yaml');
|
||||
$loader->load('services/controller.yaml');
|
||||
$loader->load('services/form.yaml');
|
||||
@@ -49,15 +52,25 @@ class ChillThirdPartyExtension extends Extension implements PrependExtensionInte
|
||||
$this->prependRoleHierarchy($container);
|
||||
}
|
||||
|
||||
protected function prependRoleHierarchy(ContainerBuilder $container)
|
||||
{
|
||||
$container->prependExtensionConfig('security', [
|
||||
'role_hierarchy' => [
|
||||
ThirdPartyVoter::CREATE => [ThirdPartyVoter::SHOW],
|
||||
ThirdPartyVoter::UPDATE => [ThirdPartyVoter::SHOW],
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
protected function preprendRoutes(ContainerBuilder $container)
|
||||
{
|
||||
//declare routes for 3party bundle
|
||||
$container->prependExtensionConfig('chill_main', array(
|
||||
'routing' => [
|
||||
'resources' => array(
|
||||
'@ChillThirdPartyBundle/config/routes.yaml'
|
||||
)
|
||||
],
|
||||
$container->prependExtensionConfig('chill_main', [
|
||||
'routing' => [
|
||||
'resources' => [
|
||||
'@ChillThirdPartyBundle/config/routes.yaml',
|
||||
],
|
||||
],
|
||||
'cruds' => [
|
||||
[
|
||||
'class' => ThirdParty::class,
|
||||
@@ -81,10 +94,9 @@ class ChillThirdPartyExtension extends Extension implements PrependExtensionInte
|
||||
'view' => [
|
||||
'template' => '@ChillThirdParty/ThirdParty/view.html.twig',
|
||||
'role' => ThirdPartyVoter::SHOW,
|
||||
]
|
||||
]
|
||||
|
||||
]
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
'apis' => [
|
||||
[
|
||||
@@ -100,29 +112,19 @@ class ChillThirdPartyExtension extends Extension implements PrependExtensionInte
|
||||
Request::METHOD_HEAD => true,
|
||||
Request::METHOD_POST => true,
|
||||
Request::METHOD_PUT => true,
|
||||
Request::METHOD_PATCH => true
|
||||
Request::METHOD_PATCH => true,
|
||||
],
|
||||
'roles' => [
|
||||
Request::METHOD_GET => \Chill\ThirdPartyBundle\Security\Voter\ThirdPartyVoter::SHOW,
|
||||
Request::METHOD_HEAD => \Chill\ThirdPartyBundle\Security\Voter\ThirdPartyVoter::SHOW,
|
||||
Request::METHOD_POST => \Chill\ThirdPartyBundle\Security\Voter\ThirdPartyVoter::CREATE,
|
||||
Request::METHOD_PUT => \Chill\ThirdPartyBundle\Security\Voter\ThirdPartyVoter::CREATE,
|
||||
Request::METHOD_PATCH => \Chill\ThirdPartyBundle\Security\Voter\ThirdPartyVoter::CREATE
|
||||
Request::METHOD_PATCH => \Chill\ThirdPartyBundle\Security\Voter\ThirdPartyVoter::CREATE,
|
||||
],
|
||||
]
|
||||
]
|
||||
]
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
));
|
||||
}
|
||||
|
||||
protected function prependRoleHierarchy(ContainerBuilder $container)
|
||||
{
|
||||
$container->prependExtensionConfig('security', array(
|
||||
'role_hierarchy' => array(
|
||||
ThirdPartyVoter::CREATE => [ThirdPartyVoter::SHOW],
|
||||
ThirdPartyVoter::UPDATE => [ThirdPartyVoter::SHOW],
|
||||
)
|
||||
));
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user