Commit 435ab6fb authored by David Surville's avatar David Surville
Browse files

Prise en compte des entités définies dans la config au lieu des entités de la...

Prise en compte des entités définies dans la config au lieu des entités de la bibliothèque + fichiers SQL
parent 39a49db4
Loading
Loading
Loading
Loading
Loading

SQL/001_tables.sql

deleted100644 → 0
+0 −44
Original line number Diff line number Diff line
-- categories de privilege
create table unicaen_privilege_categorie
(
    id        serial       not null
        constraint categorie_privilege_pkey primary key,
    code      varchar(150) not null,
    libelle   varchar(200) not null,
    ordre     integer default 0,
    namespace varchar(255)
);

create unique index categorie_privilege_code_uindex on unicaen_privilege_categorie (code);
create unique index categorie_privilege_id_uindex on unicaen_privilege_categorie (id);

--privileges
create table unicaen_privilege_privilege
(
    id           serial       not null
        constraint privilege_pkey primary key,
    categorie_id integer      not null
        constraint privilege_categorie_privilege_id_fk references unicaen_privilege_categorie,
    code         varchar(150) not null,
    libelle      varchar(200) not null,
    ordre        integer default 0
);

create index privilege_categorie_id_index on unicaen_privilege_privilege (categorie_id);
create unique index privilege_id_uindex on unicaen_privilege_privilege (id);
create unique index unicaen_privilege_privilege_code_uindex on unicaen_privilege_privilege (categorie_id, code);

-- linker
create table unicaen_privilege_privilege_role_linker
(
    role_id      integer not null
        constraint unicaen_privilege_privilege_role_linker_role_id_fk
            references unicaen_utilisateur_role
            on delete cascade,
    privilege_id integer not null
        constraint unicaen_privilege_privilege_role_linker_privilege_id_fk
            references unicaen_privilege_privilege
            on delete cascade,
    constraint unicaen_privilege_privilege_role_linker_pk
        primary key (role_id, privilege_id)
);
 No newline at end of file

SQL/002_privileges.sql

deleted100644 → 0
+0 −9
Original line number Diff line number Diff line
-- Insertion de la catégorie associée à la gestion des utilisateurs
INSERT INTO unicaen_privilege_categorie (id, code, libelle, ordre) VALUES (next_val(unicaen_privilege_categorie_id_seq), 'privilege', 'Gestion des  privilèges', 2000);

-- Insertion des privilèges de base
INSERT INTO unicaen_privilege_privilege (id, categorie_id, code, libelle, ordre) VALUES (next_val(unicaen_privilege_privilege_id_seq), current_val(unicaen_privilege_categorie_id_seq), 'privilege_voir', 'Afficher les privilèges', 10);
INSERT INTO unicaen_privilege_privilege (id, categorie_id, code, libelle, ordre) VALUES (next_val(unicaen_privilege_privilege_id_seq), current_val(unicaen_privilege_categorie_id_seq), 'privilege_ajouter', 'Ajouter un privilège', 20);
INSERT INTO unicaen_privilege_privilege (id, categorie_id, code, libelle, ordre) VALUES (next_val(unicaen_privilege_privilege_id_seq), current_val(unicaen_privilege_categorie_id_seq), 'privilege_modifier', 'Modifier un privilège', 30);
INSERT INTO unicaen_privilege_privilege (id, categorie_id, code, libelle, ordre) VALUES (next_val(unicaen_privilege_privilege_id_seq), current_val(unicaen_privilege_categorie_id_seq), 'privilege_supprimer', 'Supprimer un privilège', 40);
INSERT INTO unicaen_privilege_privilege (id, categorie_id, code, libelle, ordre) VALUES (next_val(unicaen_privilege_privilege_id_seq), current_val(unicaen_privilege_categorie_id_seq), 'privilege_affecter', 'Affecter un privilège', 50);
+0 −100
Original line number Diff line number Diff line
<?php

use UnicaenPrivilege\Controller\AffectationController;
use UnicaenPrivilege\Controller\AffectationControllerFactory;
use UnicaenPrivilege\Guard\PrivilegeController;
use UnicaenPrivilege\Provider\Privilege\PrivilegePrivileges;
use UnicaenPrivilege\Service\Affectation\AffectationService;
use UnicaenPrivilege\Service\Affectation\AffectationServiceFactory;
use Zend\Router\Http\Literal;
use Zend\Router\Http\Segment;

return [
    'bjyauthorize' => [
        'guards' => [
            UnicaenPrivilege\Guard\PrivilegeController::class => [
                [
                    'controller' => AffectationController::class,
                    'action' => [
                        'index',
                        'modifier'
                    ],
                    'privileges' => [
                        PrivilegePrivileges::PRIVILEGE_VOIR,
                    ],
                ],
            ],
        ],
    ],

    'navigation' => [
        'default' => [
            'home' => [
                'pages' => [
                    'administration' => [
                        'pages' => [
                            'privilege' => [
                                'label' => 'Privilège',
                                'route' => 'unicaen-privilege/affectation',
                                'resource' => PrivilegeController::getResourceId(AffectationController::class, 'index'),
                                'order'    => 5000,
                            ],
                        ],
                    ],
                ],
            ],
        ],
    ],

    'router' => [
        'routes' => [
            'unicaen-privilege' => [
                'type' => Literal::class,
                'options' => [
                    'route'    => '/unicaen-privilege',
                ],
                'may_terminate' => false,
                'child_routes' => [
                    'affectation' => [
                        'type' => Literal::class,
                        'options' => [
                            'route'    => '/affectation',
                            'defaults' => [
                                'controller' => AffectationController::class,
                                'action' => 'index',
                            ],
                        ],
                    ],
                    'modifier-affectation' => [
                        'type' => Segment::class,
                        'options' => [
                            'route'    => '/modifier-affectation/:role/:privilege',
                            'defaults' => [
                                'controller' => AffectationController::class,
                                'action' => 'modifier',
                            ],
                        ],
                    ],
                ],
            ],
        ],
    ],

    'service_manager' => [
        'factories' => [
            AffectationService::class => AffectationServiceFactory::class,
        ],
    ],
    'controllers'     => [
        'factories' => [
            AffectationController::class => AffectationControllerFactory::class,

        ],
    ],
    'form_elements' => [
        'factories' => [],
    ],
    'hydrators' => [
        'factories' => [],
    ]
];
 No newline at end of file
+0 −5
Original line number Diff line number Diff line
@@ -38,11 +38,6 @@ return [
    'router' => [
        'routes' => [
            'unicaen-privilege' => [
                'type' => Literal::class,
                'options' => [
                    'route'    => '/unicaen-privilege',
                ],
                'may_terminate' => false,
                'child_routes' => [
                    'categorie' => [
                        'type' => Literal::class,
+46 −10
Original line number Diff line number Diff line
@@ -19,15 +19,49 @@ return [
    'bjyauthorize' => [
        'guards' => [
            UnicaenPrivilege\Guard\PrivilegeController::class => [
                [
                    'controller' => PrivilegeController::class,
                    'action' => [
                        'index',
                    ],
                    'privileges' => [
                        PrivilegePrivileges::PRIVILEGE_VOIR,
                    ],
                ],
                [
                    'controller' => PrivilegeController::class,
                    'action' => [
                        'affecter',
                    ],
                    'privileges' => [
                        PrivilegePrivileges::PRIVILEGE_AFFECTER,
                    ],
                ],
                [
                    'controller' => PrivilegeController::class,
                    'action' => [
                        'ajouter',
                    ],
                    'privileges' => [
                        PrivilegePrivileges::PRIVILEGE_AJOUTER,
                    ],
                ],
                [
                    'controller' => PrivilegeController::class,
                    'action' => [
                        'modifier',
                    ],
                    'privileges' => [
                        PrivilegePrivileges::PRIVILEGE_MODIFIER,
                    ],
                ],
                [
                    'controller' => PrivilegeController::class,
                    'action' => [
                        'supprimer',
                    ],
                    'privileges' => [
                        PrivilegePrivileges::PRIVILEGE_AJOUTER,
                        PrivilegePrivileges::PRIVILEGE_SUPPRIMER,
                    ],
                ],
            ],
@@ -39,20 +73,24 @@ return [
            'unicaen-privilege' => [
                'type' => Literal::class,
                'options' => [
                    'route'    => '/unicaen-privilege',
                    'route' => '/privilege',
                    'defaults' => [
                        'controller' => PrivilegeController::class,
                        'action' => 'index',
                    ],
                ],
                'may_terminate' => false,
                'may_terminate' => true,
                'child_routes' => [
                    'privilege' => [
                        'type' => Literal::class,
                    'affecter' => [
                        'type' => Segment::class,
                        'options' => [
                            'route'    => '/privilege',
                            'route'    => '/affecter/:role/:privilege',
                            'defaults' => [
                                'controller' => PrivilegeController::class,
                                'action' => 'affecter',
                            ],
                        ],
                    ],
                        'may_terminate' => false,
                        'child_routes' => [
                    'ajouter' => [
                        'type' => Segment::class,
                        'options' => [
@@ -87,8 +125,6 @@ return [
            ],
        ],
    ],
        ],
    ],

    'controllers' => [
        'factories' => [
Loading