chill-bundles/DependencyInjection/RoleProvidersCompilerPass.php
Julien Fastré 841c1ca625 Merge add_ui_permission into master
refs #573

Squashed commit of the following:

commit f0974ee386050e34495eecd29c69bee50644309a
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Sun Sep 20 21:34:50 2015 +0200

    center validation

    name must be between 3 and 50 characters and not blank

commit 359b79f6674e3665df3213b04a9b4b69bcdb1537
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Sun Sep 20 21:26:11 2015 +0200

    RoleScope: scope absence validation if role does not require it

commit 40d7930699a9b48d31f151d0febb46de5b356192
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Sun Sep 20 21:09:47 2015 +0200

    improve welcome message

commit 72298510f99699c4dd501ef589f5997a28d0884d
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Sun Sep 20 21:06:16 2015 +0200

    layout of center

commit 9ac6ae7dae38bd7c2ac3ab5a0bfd3753d13ca294
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Sun Sep 20 17:41:37 2015 +0200

    layout of circles

commit 5fc27ae078ca422ff44367198492aebbbb49a38a
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Sun Sep 20 17:34:45 2015 +0200

    Merge modification from origin/master

    commit 7ed87b92fc4a3941a07b3295ee55b8fe2c1a96fe
    Author: Julien Fastré <julien@fastre.info>
    Date:   Mon Sep 14 15:43:29 2015 +0200

        adding signature (proof of concept)

    commit 2e2b8f5c8557cdd8be00372b5e3e43b0b9bad1f6
    Author: Marc Ducobu <marc@champs-libres.coop>
    Date:   Tue Sep 1 16:51:39 2015 +0200

        Search result with a padding

    commit 7dc3514e00c16ac74beb4c7486d1a202510294f5
    Author: Marc Ducobu <marc@champs-libres.coop>
    Date:   Wed Aug 26 13:29:17 2015 +0200

        Blue as default color for table header

    commit 2b45d4cec5028abe7d49d44da4fa937a2b1ecddf
    Author: Marc Ducobu <marc@champs-libres.coop>
    Date:   Wed Aug 26 13:15:53 2015 +0200

        Tables as Thibault design

    commit deb12a117d6eed7cef602d2e2723009f142eb78f
    Author: Marc Ducobu <marc@champs-libres.coop>
    Date:   Tue Aug 25 19:51:15 2015 +0200

        Improving the navigation bar

    commit 8c3ea5b8667fd3aa40fa0d311f8d80a2a0c905b5
    Author: Marc Ducobu <marc@champs-libres.coop>
    Date:   Tue Aug 25 18:29:34 2015 +0200

        Adding class for colors

    commit 251f51bab2ce82c2eb78e30d345075e8bbb9b02b
    Author: Marc Ducobu <marc@champs-libres.coop>
    Date:   Tue Aug 25 17:31:22 2015 +0200

        Menu person as thibautl propose

    commit 2457ff021a6ff7a324ebadd163880838ec16be4d
    Author: Marc Ducobu <marc@champs-libres.coop>
    Date:   Tue Aug 25 17:29:51 2015 +0200

        updating select2

    commit d339b70f2d5190dcfd4a210e338c8910430d2e48
    Author: Marc Ducobu <marc@champs-libres.coop>
    Date:   Tue Aug 25 17:29:16 2015 +0200

        updating select2

    commit 767a72e3cfd49acdd3fdacc68b5f041571b99780
    Author: Marc Ducobu <marc@champs-libres.coop>
    Date:   Tue Aug 25 17:28:50 2015 +0200

        Refactoring : removing useless line return

    commit 5bb74ab09e1933f97eb8d897e5f5791c791c7a56
    Author: Marc Ducobu <marc@champs-libres.coop>
    Date:   Tue Aug 25 13:31:48 2015 +0200

        Removing css specific for the person bundle

commit ca8a597b3c858d27f59346e841f2cbded4b66e9b
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Sun Sep 20 17:33:14 2015 +0200

    add correct key for flash messages

commit b3fc4c1b7eea6bc87459a290b295a7c54c550da4
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Sun Sep 20 17:32:22 2015 +0200

    set a flash message to correct level

commit 3425de79c029039a8df4657b7cc672359199dbf5
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Sun Sep 20 17:24:28 2015 +0200

    layout of permissions group + translations

commit 670d7f64fa6e1073015810bc92f0a11def9bef4b
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Sun Sep 20 16:41:46 2015 +0200

    layout of user (include translations)

commit ed8a7fdebe91a8c94ae3338c756796758de184a2
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Sun Sep 20 11:49:13 2015 +0200

    rename route entries prefix for center with "admin_center"

commit d1d229e4e13d3fcd3ab70319ae04062a691344ff
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Sun Sep 20 11:39:48 2015 +0200

    add menu for permissions management

commit 972cc15ae370a0faab58d26c9fcdf6e36cc19077
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Fri Sep 18 21:10:04 2015 +0200

    add logger to tests fixtures

commit b8b34b090acd3971098349a5e5d2e8d608714a4f
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Fri Sep 18 17:12:45 2015 +0200

    allow blank roles scopes in show action

commit 3673c60de4b4a5d8f7f72638a10209fe53084b16
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Fri Sep 18 17:05:15 2015 +0200

    allow role scope without scope required

    Some roles doesn't need to be associated with a scope.

    Example: CHILL_PERSON_SEE, ... => The person aren't associated with a scope.

    Now we may check if a role must be associated with a scope.

commit e14cda12a412b2c2af54e662db5925a99f594cd7
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Fri Sep 18 11:33:49 2015 +0200

    add user creation

    The form UserType receive a new parameter: 'is_creation' (boolean). If
    'is_creation' is true, (false by default) the field "enabled" is removed
    (new users are enabled by default) and a field "password" ask for a
    password.

commit d4f59a01a708e5d310a8e99fe2796292bc8da121
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Fri Sep 18 11:04:40 2015 +0200

    add possibility to change password

commit cdddfffd3dcde9f673f0042f8eb55b90d76412f5
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Thu Sep 17 23:18:21 2015 +0200

    mark test empty to avoid failure

commit 82eee24a5d4b71a3deef7dc250ae8a747569d892
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Thu Sep 17 22:34:23 2015 +0200

    remove & add groupCenter to user + validation

    The validation check that groupCenter are associated only once to the
    user.

commit 7e774de4d1c72cc3ba5d221251aa505653c06621
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Thu Sep 17 22:25:02 2015 +0200

    remove deprecated key

commit aeb7bf5ef56bf4e4939400b85e9393b72c2e1658
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Wed Sep 16 22:28:13 2015 +0200

    correct generated code for user entity

    * index view
    * show a user
    * edit a user: general form + remove a group center

commit 6d8e1bba6e163c7dc93bc05a74cdb9dd839f8749
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Tue Sep 15 21:14:48 2015 +0200

    add message if group does not have any permissions

commit 6a3a2938c3066c95b2672a88f244c3c9ea7bff64
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Mon Sep 14 00:43:40 2015 +0200

    set role declaration in compiler pass

    This should ease development.

    The role are now declared into the bundle and not in configuration. The
    role can be added alongside with voters.

    To declare role, add a service which implements
    `Chill\MainBundle\Security\ProvideRoleInterface` and declare the service
    with a tag `chill.role`

    <pre>
    my_service:
       # ...
       tags:
          - { name: chill.role }
    </pre>

commit fe28360e9253493c91ab2c02cdbad7a36f76047c
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Sun Sep 13 23:55:39 2015 +0200

    add validation for permissions group

    * name must be max 50 and not empty
    * the same role scope must be present only once

commit 2e2653f43388e65379c2285db1354a32c683cd65
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Sun Sep 13 22:23:28 2015 +0200

    fix permission group new/creation

    * Layout of "new" form
    * after "new" form posting, the "create" action redirect to edit form
    * (to add roleScopes to the new permissionsgroup)

commit fbe97c882e1bbf06668a02effed5996777c8020e
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Sat Sep 12 14:20:29 2015 +0200

    change strategy to keep roleScope uniques

    The form 'permissiongroupType' doesn't handle link to role scope any
    more.

    Those link are handled by the controller, which generate a form to
    add/delete link between roleScopes and permissionsGroup.

commit e11fe7644312ae25b46202b9f0733823e75ffa9d
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Sun Sep 6 23:00:37 2015 +0200

    the controller prevent creation of duplicated/update of roleScopes

commit 81c8b12fa4d2f2ae88206a4a5086b13615462b74
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Fri Sep 4 17:25:39 2015 +0200

    add persistance for allowing new role_scopes

commit 912b004daf0b3f1208ef1e11b2424f88ea78a90a
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Mon Aug 31 23:49:11 2015 +0200

    fix generated code of CRUD permissionsgroup

    + add a ComposedRoleScopeType to prepare creation "on the fly" of RoleScopes.

    + add a new parameter chill.available_roles to let other bundle declare their roles.

commit baf970538fbac4ff778540e23aa70efff3937883
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Thu Aug 27 15:19:30 2015 +0200

    Remove deletion of PermissionsGroup from autogenerated code

commit c5774bf5564d8279f9fcab15b61823857f438387
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Thu Aug 27 15:11:36 2015 +0200

    replace setDefaultOptions by configureOptions

    setDefaultOptions will be removed in symfony 3.0

commit 8bef7328203c2d0e635b51fac901a520330d6cd2
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Thu Aug 27 14:55:32 2015 +0200

    Fix auto-generated CRUD for Center

    Add ChillMainBundle layout, translations, ...

commit 9d6e77e15d50e797570ccb8ca56d035ce752cc80
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Thu Aug 27 09:10:05 2015 +0200

    remove delete methods, url, link for center

    Centers cannot be deleted.

commit 1fdedd56329dd4f58d7d0460ef197ab17f7db755
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Thu Aug 27 09:08:32 2015 +0200

    remove delete url on scope

commit ef371fac696e521e8570ca63c868421f0dd02af2
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Tue Aug 25 16:50:30 2015 +0200

    fix auto-generation for scope/circle

commit eb67639673543f8153308b2fa863047ec0eeddc3
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Tue Aug 25 16:21:01 2015 +0200

    add autogenerated crud for entity permissionGroup

commit 38c8a60f56e0870f5c196daa7e1d6851ea6edb8e
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Tue Aug 25 16:19:46 2015 +0200

    add autogenerated user entity

commit 554ca141bba6b1a4da81f9fe806d02c369221bea
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Tue Aug 25 16:18:35 2015 +0200

    add autogenerated crud for scopes

commit 0cfb587f15df979e6f61e4363b42d443034580fd
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Tue Aug 25 16:17:22 2015 +0200

    add auto-generated crud for center

commit 65651dd8ffda02869117ee5fd782b50bf4aa5219
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Tue Aug 25 15:27:37 2015 +0200

    remove deprecated function in groupCenter

    GroupCenter::addPermissionGroup and getPermissionGroups is now removed.

commit f957aa416ff610c29917367ff5b6e81467e7dd95
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Tue Aug 25 14:46:58 2015 +0200

    set correct association in permissionGroup

commit 5852c169385c908eecc952155d73de4db506274b
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Fri Aug 21 12:37:43 2015 +0200

    association between groupCenter <->PermissionGroup is oneToMany

    One groupCenter may have ONLY one permissionGroup

    including the migration file. During migration a script ensure that no
    data is lost in permissions.
2015-09-20 21:38:24 +02:00

58 lines
1.8 KiB
PHP

<?php
/*
* Copyright (C) 2015 Julien Fastré <julien.fastre@champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Chill\MainBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\Reference;
/**
*
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
*/
class RoleProvidersCompilerPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition('chill.main.role_provider')) {
throw new \LogicException('service chill.main.role_provider '
. 'is not defined. It is required by RoleProviderCompilerPass');
}
$definition = $container->getDefinition(
'chill.main.role_provider'
);
$taggedServices = $container->findTaggedServiceIds(
'chill.role'
);
foreach ($taggedServices as $id => $tagAttributes) {
$definition->addMethodCall(
'addProvider',
array(new Reference($id))
);
}
}
}