mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Remove custom definition (form.yaml).
This commit is contained in:
parent
a9bdb1fe3b
commit
1f9b4ddd79
@ -38,7 +38,7 @@ use Chill\MainBundle\Entity\RoleScope;
|
|||||||
*
|
*
|
||||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||||
*/
|
*/
|
||||||
class AuthorizationHelper
|
class AuthorizationHelper implements AuthorizationHelperInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -0,0 +1,87 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\MainBundle\Security\Authorization;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Entity\User;
|
||||||
|
use Chill\MainBundle\Entity\Center;
|
||||||
|
use Chill\MainBundle\Entity\HasCenterInterface;
|
||||||
|
use Symfony\Component\Security\Core\Role\Role;
|
||||||
|
use Chill\MainBundle\Entity\Scope;
|
||||||
|
|
||||||
|
interface AuthorizationHelperInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines if a user is active on this center
|
||||||
|
*
|
||||||
|
* @param User $user
|
||||||
|
* @param Center $center
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function userCanReachCenter(User $user, Center $center);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Determines if the user has access to the given entity.
|
||||||
|
*
|
||||||
|
* if the entity implements Chill\MainBundle\Entity\HasScopeInterface,
|
||||||
|
* the scope is taken into account.
|
||||||
|
*
|
||||||
|
* @param User $user
|
||||||
|
* @param HasCenterInterface $entity the entity may also implement HasScopeInterface
|
||||||
|
* @param string|Role $attribute
|
||||||
|
* @return boolean true if the user has access
|
||||||
|
*/
|
||||||
|
public function userHasAccess(User $user, HasCenterInterface $entity, $attribute);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get reachable Centers for the given user, role,
|
||||||
|
* and optionnaly Scope
|
||||||
|
*
|
||||||
|
* @param User $user
|
||||||
|
* @param Role $role
|
||||||
|
* @param null|Scope $scope
|
||||||
|
* @return Center[]
|
||||||
|
*/
|
||||||
|
public function getReachableCenters(User $user, Role $role, Scope $scope = null);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all reachable scope for a given user, center and role
|
||||||
|
*
|
||||||
|
* @deprecated Use getReachableCircles
|
||||||
|
*
|
||||||
|
* @param User $user
|
||||||
|
* @param Role $role
|
||||||
|
* @param Center $center
|
||||||
|
* @return Scope[]
|
||||||
|
*/
|
||||||
|
public function getReachableScopes(User $user, Role $role, Center $center);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all reachable circle for a given user, center and role
|
||||||
|
*
|
||||||
|
* @param User $user
|
||||||
|
* @param Role $role
|
||||||
|
* @param Center $center
|
||||||
|
* @return Scope[]
|
||||||
|
*/
|
||||||
|
public function getReachableCircles(User $user, Role $role, Center $center);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param Role $role
|
||||||
|
* @param Center $center
|
||||||
|
* @param Scope $circle
|
||||||
|
* @return Users
|
||||||
|
*/
|
||||||
|
public function findUsersReaching(Role $role, Center $center, Scope $circle = null);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all the role which give access to the given role. Only the role
|
||||||
|
* which are registered into Chill are taken into account.
|
||||||
|
*
|
||||||
|
* @param Role $role
|
||||||
|
* @return Role[] the role which give access to the given $role
|
||||||
|
*/
|
||||||
|
public function getParentRoles(Role $role);
|
||||||
|
}
|
@ -28,7 +28,7 @@ use Twig\TwigFilter;
|
|||||||
*
|
*
|
||||||
* @package Chill\MainBundle\Templating\Entity
|
* @package Chill\MainBundle\Templating\Entity
|
||||||
*/
|
*/
|
||||||
class ChillEntityRenderExtension extends AbstractExtension
|
class ChillEntityRenderExtension extends AbstractExtension implements ChillEntityRenderExtensionInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var ChillEntityRenderInterface
|
* @var ChillEntityRenderInterface
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\MainBundle\Templating\Entity;
|
||||||
|
|
||||||
|
use Twig\Extension\ExtensionInterface;
|
||||||
|
use Twig\TwigFilter;
|
||||||
|
|
||||||
|
interface ChillEntityRenderExtensionInterface extends ExtensionInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return array|TwigFilter[]
|
||||||
|
*/
|
||||||
|
public function getFilters();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $entity
|
||||||
|
* @param array $options
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function renderString($entity, array $options = []): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $entity
|
||||||
|
* @param array $options
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function renderBox($entity, array $options = []): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ChillEntityRenderInterface $render
|
||||||
|
*/
|
||||||
|
public function addRender(ChillEntityRenderInterface $render);
|
||||||
|
}
|
@ -6,6 +6,7 @@ services:
|
|||||||
$hierarchy: "%security.role_hierarchy.roles%"
|
$hierarchy: "%security.role_hierarchy.roles%"
|
||||||
$em: '@Doctrine\ORM\EntityManagerInterface'
|
$em: '@Doctrine\ORM\EntityManagerInterface'
|
||||||
Chill\MainBundle\Security\Authorization\AuthorizationHelper: '@chill.main.security.authorization.helper'
|
Chill\MainBundle\Security\Authorization\AuthorizationHelper: '@chill.main.security.authorization.helper'
|
||||||
|
Chill\MainBundle\Security\Authorization\AuthorizationHelperInterface: Chill\MainBundle\Security\Authorization\AuthorizationHelper
|
||||||
|
|
||||||
chill.main.role_provider:
|
chill.main.role_provider:
|
||||||
class: Chill\MainBundle\Security\RoleProvider
|
class: Chill\MainBundle\Security\RoleProvider
|
||||||
|
@ -30,6 +30,7 @@ services:
|
|||||||
Chill\MainBundle\Templating\Entity\ChillEntityRenderExtension:
|
Chill\MainBundle\Templating\Entity\ChillEntityRenderExtension:
|
||||||
tags:
|
tags:
|
||||||
- { name: twig.extension }
|
- { name: twig.extension }
|
||||||
|
Chill\MainBundle\Templating\Entity\ChillEntityRenderExtensionInterface: Chill\MainBundle\Templating\Entity\ChillEntityRenderExtension
|
||||||
|
|
||||||
Chill\MainBundle\Templating\Entity\CommentRender:
|
Chill\MainBundle\Templating\Entity\CommentRender:
|
||||||
arguments:
|
arguments:
|
||||||
|
@ -13,30 +13,3 @@ services:
|
|||||||
- '@Chill\PersonBundle\Config\ConfigPersonAltNamesHelper'
|
- '@Chill\PersonBundle\Config\ConfigPersonAltNamesHelper'
|
||||||
tags:
|
tags:
|
||||||
- { name: form.type, alias: '@chill.main.form.person_creation' }
|
- { name: form.type, alias: '@chill.main.form.person_creation' }
|
||||||
|
|
||||||
chill.person.accompanying_period_closing_motive:
|
|
||||||
class: Chill\PersonBundle\Form\Type\ClosingMotivePickerType
|
|
||||||
arguments:
|
|
||||||
$translatableStringHelper: '@Chill\MainBundle\Templating\TranslatableStringHelper'
|
|
||||||
$chillEntityRenderExtension: '@Chill\MainBundle\Templating\Entity\ChillEntityRenderExtension'
|
|
||||||
$closingMotiveRepository: '@Chill\PersonBundle\Repository\AccompanyingPeriod\ClosingMotiveRepository'
|
|
||||||
tags:
|
|
||||||
- { name: form.type, alias: closing_motive }
|
|
||||||
|
|
||||||
chill.person.form.type.pick_person:
|
|
||||||
class: Chill\PersonBundle\Form\Type\PickPersonType
|
|
||||||
arguments:
|
|
||||||
- Chill\PersonBundle\Repository\PersonRepository"
|
|
||||||
- "@security.token_storage"
|
|
||||||
- "@chill.main.security.authorization.helper"
|
|
||||||
- '@Symfony\Component\Routing\Generator\UrlGeneratorInterface'
|
|
||||||
- '@Symfony\Component\Translation\TranslatorInterface'
|
|
||||||
tags:
|
|
||||||
- { name: form.type }
|
|
||||||
|
|
||||||
Chill\PersonBundle\Form\Type\PersonAltNameType:
|
|
||||||
arguments:
|
|
||||||
$configHelper: '@Chill\PersonBundle\Config\ConfigPersonAltNamesHelper'
|
|
||||||
$translatableStringHelper: '@chill.main.helper.translatable_string'
|
|
||||||
tags:
|
|
||||||
- { name: form.type }
|
|
||||||
|
@ -3,13 +3,11 @@
|
|||||||
namespace Chill\PersonBundle\Form\Type;
|
namespace Chill\PersonBundle\Form\Type;
|
||||||
|
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive;
|
||||||
use Chill\MainBundle\Templating\Entity\ChillEntityRenderExtension;
|
use Chill\MainBundle\Templating\Entity\ChillEntityRenderExtensionInterface;
|
||||||
|
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||||
use Symfony\Component\OptionsResolver\Options;
|
use Symfony\Component\OptionsResolver\Options;
|
||||||
use Chill\PersonBundle\Repository\AccompanyingPeriod\ClosingMotiveRepository;
|
use Chill\PersonBundle\Repository\AccompanyingPeriod\ClosingMotiveRepository;
|
||||||
|
|
||||||
@ -23,12 +21,12 @@ class ClosingMotivePickerType extends AbstractType
|
|||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var TranslatableStringHelper
|
* @var TranslatableStringHelperInterface
|
||||||
*/
|
*/
|
||||||
protected $translatableStringHelper;
|
protected $translatableStringHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var ChillEntityRenderExtension
|
* @var ChillEntityRenderExtensionInterface
|
||||||
*/
|
*/
|
||||||
protected $entityRenderExtension;
|
protected $entityRenderExtension;
|
||||||
|
|
||||||
@ -40,13 +38,13 @@ class ClosingMotivePickerType extends AbstractType
|
|||||||
/**
|
/**
|
||||||
* ClosingMotivePickerType constructor.
|
* ClosingMotivePickerType constructor.
|
||||||
*
|
*
|
||||||
* @param TranslatableStringHelper $translatableStringHelper
|
* @param TranslatableStringHelperInterface $translatableStringHelper
|
||||||
* @param ChillEntityRenderExtension $chillEntityRenderExtension
|
* @param ChillEntityRenderExtensionInterface $chillEntityRenderExtension
|
||||||
* @param ClosingMotiveRepository $closingMotiveRepository
|
* @param ClosingMotiveRepository $closingMotiveRepository
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
TranslatableStringHelper $translatableStringHelper,
|
TranslatableStringHelperInterface $translatableStringHelper,
|
||||||
ChillEntityRenderExtension $chillEntityRenderExtension,
|
ChillEntityRenderExtensionInterface $chillEntityRenderExtension,
|
||||||
ClosingMotiveRepository $closingMotiveRepository
|
ClosingMotiveRepository $closingMotiveRepository
|
||||||
) {
|
) {
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
$this->translatableStringHelper = $translatableStringHelper;
|
||||||
|
@ -7,8 +7,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
|||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
||||||
use Chill\PersonBundle\Config\ConfigPersonAltNamesHelper;
|
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
use Chill\PersonBundle\Config\ConfigPersonAltNamesHelperInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -18,19 +18,19 @@ class PersonAltNameType extends AbstractType
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var ConfigPersonAltNamesHelper
|
* @var TranslatableStringHelperInterface
|
||||||
*/
|
*/
|
||||||
private $configHelper;
|
private $configHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var TranslatableStringHelper
|
* @var TranslatableStringHelperInterface
|
||||||
*/
|
*/
|
||||||
private $translatableStringHelper;
|
private $translatableStringHelper;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
ConfigPersonAltNamesHelper $configHelper,
|
ConfigPersonAltNamesHelperInterface $configHelper,
|
||||||
TranslatableStringHelper $translatableStringHelper
|
TranslatableStringHelperInterface $translatableStringHelper
|
||||||
) {
|
) {
|
||||||
$this->configHelper = $configHelper;
|
$this->configHelper = $configHelper;
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
$this->translatableStringHelper = $translatableStringHelper;
|
||||||
|
@ -29,8 +29,8 @@ use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
|||||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||||
use Chill\MainBundle\Entity\GroupCenter;
|
use Chill\MainBundle\Entity\GroupCenter;
|
||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
|
||||||
use Chill\MainBundle\Entity\Center;
|
use Chill\MainBundle\Entity\Center;
|
||||||
|
use Chill\MainBundle\Security\Authorization\AuthorizationHelperInterface;
|
||||||
use Chill\PersonBundle\Repository\PersonRepository;
|
use Chill\PersonBundle\Repository\PersonRepository;
|
||||||
use Chill\PersonBundle\Search\PersonSearch;
|
use Chill\PersonBundle\Search\PersonSearch;
|
||||||
use Symfony\Component\Translation\TranslatorInterface;
|
use Symfony\Component\Translation\TranslatorInterface;
|
||||||
@ -68,7 +68,7 @@ class PickPersonType extends AbstractType
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var AuthorizationHelper
|
* @var AuthorizationHelperInterface
|
||||||
*/
|
*/
|
||||||
protected $authorizationHelper;
|
protected $authorizationHelper;
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ class PickPersonType extends AbstractType
|
|||||||
public function __construct(
|
public function __construct(
|
||||||
PersonRepository $personRepository,
|
PersonRepository $personRepository,
|
||||||
TokenStorageInterface $tokenStorage,
|
TokenStorageInterface $tokenStorage,
|
||||||
AuthorizationHelper $authorizationHelper,
|
AuthorizationHelperInterface $authorizationHelper,
|
||||||
UrlGeneratorInterface $urlGenerator,
|
UrlGeneratorInterface $urlGenerator,
|
||||||
TranslatorInterface $translator
|
TranslatorInterface $translator
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user