mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
merging add_ui_permission into master
refs #573 Squashed commit of the following: commit 33635722c231a3a80518e0dc027911766a95cbfa Author: Julien Fastré <julien.fastre@champs-libres.coop> Date: Sun Sep 20 21:42:37 2015 +0200 translation of roles commit 18d96fe59f836564ace5e6045fa87ac81da6b27b Author: Julien Fastré <julien.fastre@champs-libres.coop> Date: Sun Sep 20 11:54:46 2015 +0200 remove admin menu for person bundle commit 2acd79930e28fda315d97df2c0ff8aae33ab489a Author: Julien Fastré <julien.fastre@champs-libres.coop> Date: Fri Sep 18 21:05:00 2015 +0200 add logger to project commit 724d2fc8685fced0cf9da77e9e9730c5c57337ed Author: Julien Fastré <julien.fastre@champs-libres.coop> Date: Mon Sep 14 00:50:01 2015 +0200 switch to role declaration in code commit 10f6219b277445b0dfeb51fa0b7566a28fdd41bf Author: Julien Fastré <julien.fastre@champs-libres.coop> Date: Mon Aug 31 23:51:47 2015 +0200 declare role in parameter chill.available_roles
This commit is contained in:
parent
2f0197aff3
commit
31aa50b4ea
4
.gitignore
vendored
4
.gitignore
vendored
@ -4,4 +4,6 @@ parameters.yml
|
||||
*~
|
||||
*.DS_Store
|
||||
*.sass-cache
|
||||
Resources/node_modules/
|
||||
Resources/node_modules/
|
||||
Tests/Fixtures/App/app/config/parameters.yml
|
||||
|
||||
|
@ -1,24 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\PersonBundle\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author julien.fastre@champs-libres.coop
|
||||
*/
|
||||
class AdminController extends Controller {
|
||||
|
||||
public function indexAction() {
|
||||
return $this->forward('CLChillMainBundle:Admin:index',
|
||||
array(
|
||||
'menu' => 'admin_person',
|
||||
'page_title' => 'menu.person.admin.index',
|
||||
'header_title' => 'menu.person.header_index'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
@ -43,7 +43,6 @@ class LoadPersonACL extends AbstractFixture implements OrderedFixtureInterface
|
||||
{
|
||||
foreach (LoadPermissionsGroup::$refs as $permissionsGroupRef) {
|
||||
$permissionsGroup = $this->getReference($permissionsGroupRef);
|
||||
$scope = $this->getReference('scope_all');
|
||||
|
||||
//create permission group
|
||||
switch ($permissionsGroup->getName()) {
|
||||
@ -52,11 +51,11 @@ class LoadPersonACL extends AbstractFixture implements OrderedFixtureInterface
|
||||
printf("Adding CHILL_PERSON_UPDATE & CHILL_PERSON_CREATE to %s permission group \n", $permissionsGroup->getName());
|
||||
$roleScopeUpdate = (new RoleScope())
|
||||
->setRole('CHILL_PERSON_UPDATE')
|
||||
->setScope($scope);
|
||||
->setScope(null);
|
||||
$permissionsGroup->addRoleScope($roleScopeUpdate);
|
||||
$roleScopeCreate = (new RoleScope())
|
||||
->setRole('CHILL_PERSON_CREATE')
|
||||
->setScope($scope);
|
||||
->setScope(null);
|
||||
$permissionsGroup->addRoleScope($roleScopeCreate);
|
||||
$manager->persist($roleScopeUpdate);
|
||||
$manager->persist($roleScopeCreate);
|
||||
@ -65,7 +64,7 @@ class LoadPersonACL extends AbstractFixture implements OrderedFixtureInterface
|
||||
printf("Adding CHILL_PERSON_SEE to %s permission group \n", $permissionsGroup->getName());
|
||||
$roleScopeSee = (new RoleScope())
|
||||
->setRole('CHILL_PERSON_SEE')
|
||||
->setScope($scope);
|
||||
->setScope(null);
|
||||
$permissionsGroup->addRoleScope($roleScopeSee);
|
||||
$manager->persist($roleScopeSee);
|
||||
break;
|
||||
|
@ -70,16 +70,6 @@ chill_person_accompanying_period_open:
|
||||
path: /{_locale}/person/{person_id}/accompanying-period/open
|
||||
defaults: { _controller: ChillPersonBundle:AccompanyingPeriod:open }
|
||||
|
||||
chill_person_admin:
|
||||
path: /{_locale}/admin/person
|
||||
defaults: { _controller: ChillPersonBundle:Admin:index }
|
||||
options:
|
||||
menus:
|
||||
admin:
|
||||
order: 100
|
||||
label: menu.person.admin.index
|
||||
helper: menu.person.admin.helper
|
||||
|
||||
chill_person_export:
|
||||
path: /{_locale}/person/export/
|
||||
defaults: { _controller: ChillPersonBundle:Person:export }
|
||||
|
@ -47,3 +47,4 @@ services:
|
||||
- "@chill.main.security.authorization.helper"
|
||||
tags:
|
||||
- { name: security.voter }
|
||||
- { name: chill.role }
|
||||
|
@ -72,3 +72,8 @@ Reset: 'Remise à zéro'
|
||||
#timeline
|
||||
'An accompanying period is opened for %person% on %date%': Une période d'accompagnement a été ouverte le %date% pour %person%
|
||||
'An accompanying period is closed for %person% on %date%': Une période d'accompagnement a été fermée le %date% pour %person%
|
||||
|
||||
#roles
|
||||
CHILL_PERSON_SEE: Voir les personnes
|
||||
CHILL_PERSON_UPDATE: Modifier les personnes
|
||||
CHILL_PERSON_CREATE: Ajouter des personnes
|
||||
|
@ -22,13 +22,14 @@ namespace Chill\PersonBundle\Security\Authorization;
|
||||
use Chill\MainBundle\Security\Authorization\AbstractChillVoter;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||
use Chill\MainBundle\Security\ProvideRoleInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||
*/
|
||||
class PersonVoter extends AbstractChillVoter
|
||||
class PersonVoter extends AbstractChillVoter implements ProvideRoleInterface
|
||||
{
|
||||
const CREATE = 'CHILL_PERSON_CREATE';
|
||||
const UPDATE = 'CHILL_PERSON_UPDATE';
|
||||
@ -64,4 +65,15 @@ class PersonVoter extends AbstractChillVoter
|
||||
return $this->helper->userHasAccess($user, $person, $attribute);
|
||||
|
||||
}
|
||||
|
||||
public function getRoles()
|
||||
{
|
||||
return $this->getSupportedAttributes();
|
||||
}
|
||||
|
||||
public function getRolesWithoutScope()
|
||||
{
|
||||
return $this->getSupportedAttributes();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,7 +17,8 @@ class AppKernel extends Kernel
|
||||
new Chill\PersonBundle\ChillPersonBundle(),
|
||||
new Chill\MainBundle\ChillMainBundle(),
|
||||
new \Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(),
|
||||
new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle()
|
||||
new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
|
||||
new Symfony\Bundle\MonologBundle\MonologBundle(),
|
||||
#add here all the required bundle (some bundle are not required)
|
||||
);
|
||||
}
|
||||
|
@ -19,7 +19,7 @@
|
||||
"php": "~5.5",
|
||||
"twig/extensions": "~1.0",
|
||||
"symfony/assetic-bundle": "~2.3",
|
||||
"symfony/monolog-bundle": "~2.4",
|
||||
"symfony/monolog-bundle": "^2.7",
|
||||
"symfony/framework-bundle": "~2.7",
|
||||
"symfony/yaml": "~2.7",
|
||||
"symfony/symfony": "~2.7",
|
||||
@ -27,7 +27,7 @@
|
||||
"doctrine/orm": "~2.4",
|
||||
"doctrine/common": "~2.4",
|
||||
"doctrine/doctrine-bundle": "~1.2",
|
||||
"chill-project/main": "dev-master@dev",
|
||||
"chill-project/main": "dev-add_ui_permission as dev-master",
|
||||
"chill-project/custom-fields": "dev-master@dev",
|
||||
"doctrine/doctrine-fixtures-bundle": "~2.2",
|
||||
"champs-libres/composer-bundle-migration": "~1.0",
|
||||
|
Loading…
x
Reference in New Issue
Block a user