Commit d0918c9e authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Renommage du module en unicaen/db-anonym

parent 5c1c3d57
Loading
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
<?php

namespace UnicaenDbfakator;
namespace UnicaenDbAnonym;

use Laminas\Config\Factory as ConfigFactory;
use Laminas\Console\Adapter\AdapterInterface;
@@ -45,7 +45,7 @@ class Module implements ConsoleBannerProviderInterface, ConsoleUsageProviderInte
     */
    public function getConsoleBanner(AdapterInterface $console): ?string
    {
        return "UnicaenDbfakator";
        return "UnicaenDbAnonym";
    }

    /**
@@ -57,18 +57,18 @@ class Module implements ConsoleBannerProviderInterface, ConsoleUsageProviderInte
            /**
             * @see ConsoleController::genererAction()
             */
            'unicaen-dbfakator generer' => "Génère le script d'anonymisation et le script de restauration.",
            'unicaen-db-anonym generer' => "Génère le script d'anonymisation et le script de restauration.",

            /**
             * @see ConsoleController::anonymiserAction()
             */
            'unicaen-dbfakator anonymiser' => "Lance le script SQL d'anonymisation généré précédemment.",
            'unicaen-db-anonym anonymiser' => "Lance le script SQL d'anonymisation généré précédemment.",
            [],

            /**
             * @see ConsoleController::restaurerAction()
             */
            'unicaen-dbfakator restaurer' => "Lance le script SQL de restauration généré précédemment.",
            'unicaen-db-anonym restaurer' => "Lance le script SQL de restauration généré précédemment.",
            [],
        ];
    }
+1 −1
Original line number Diff line number Diff line
# unicaen/dbfakator
# unicaen/db-anonym

Ce module permet d'anonymiser et de restaurer la base de données d'une appli, selon ce qui est spécifié 
dans un fichier de configuration.
+3 −3
Original line number Diff line number Diff line
{
    "name": "unicaen/dbfakator",
    "description": "Module pour anonymiser une base de données",
    "name": "unicaen/db-anonym",
    "description": "Module pour anonymiser les données d'une bdd",
    "require": {
        "php": ">=7.3",
        "unicaen/app": "^4.0",
@@ -13,7 +13,7 @@
    },
    "autoload": {
        "psr-0": {
            "UnicaenDbfakator": "src/"
            "UnicaenDbAnonym": "src/"
        },
        "classmap": [
            "./Module.php"
+15 −15
Original line number Diff line number Diff line
<?php

namespace UnicaenDbfakator;
namespace UnicaenDbAnonym;

use Laminas\Mvc\Console\Router\Simple;
use UnicaenAuth\Guard\PrivilegeController;
use UnicaenDbfakator\Controller\ConsoleController;
use UnicaenDbfakator\Controller\ConsoleControllerFactory;
use UnicaenDbfakator\Controller\IndexController;
use UnicaenDbfakator\Controller\IndexControllerFactory;
use UnicaenDbfakator\Service\DbfakatorService;
use UnicaenDbfakator\Service\DbfakatorServiceFactory;
use UnicaenDbfakator\Service\DbService;
use UnicaenDbfakator\Service\DbServiceFactory;
use UnicaenDbAnonym\Controller\ConsoleController;
use UnicaenDbAnonym\Controller\ConsoleControllerFactory;
use UnicaenDbAnonym\Controller\IndexController;
use UnicaenDbAnonym\Controller\IndexControllerFactory;
use UnicaenDbAnonym\Service\AnonymService;
use UnicaenDbAnonym\Service\AnonymServiceFactory;
use UnicaenDbAnonym\Service\DbService;
use UnicaenDbAnonym\Service\DbServiceFactory;

return [
    'router' => [
        'routes' => [
            'unicaen-dbfakator' => [
            'unicaen-db-anonym' => [
                'type' => 'Literal',
                'options' => [
                    'route' => '/unicaen-dbfakator',
                    'route' => '/unicaen-db-anonym',
                    'defaults' => [
                        'controller' => IndexController::class,
                        'action' => 'index',
@@ -76,7 +76,7 @@ return [
                'generer' => [
                    'type' => Simple::class,
                    'options' => [
                        'route'    => 'unicaen-dbfakator generer',
                        'route'    => 'unicaen-db-anonym generer',
                        'defaults' => [
                            /**
                             * @see ConsoleController::genererAction()
@@ -89,7 +89,7 @@ return [
                'anonymiser' => [
                    'type' => Simple::class,
                    'options' => [
                        'route'    => 'unicaen-dbfakator anonymiser',
                        'route'    => 'unicaen-db-anonym anonymiser',
                        'defaults' => [
                            /**
                             * @see ConsoleController::anonymiserAction()
@@ -102,7 +102,7 @@ return [
                'restaurer' => [
                    'type' => Simple::class,
                    'options' => [
                        'route'    => 'unicaen-dbfakator restaurer',
                        'route'    => 'unicaen-db-anonym restaurer',
                        'defaults' => [
                            /**
                             * @see ConsoleController::restaurerAction()
@@ -153,7 +153,7 @@ return [
    'service_manager' => [
        'factories' => [
            DbService::class => DbServiceFactory::class,
            DbfakatorService::class => DbfakatorServiceFactory::class,
            AnonymService::class => AnonymServiceFactory::class,
        ],
    ],
    'controllers' => [
+16 −5
Original line number Diff line number Diff line
@@ -6,18 +6,29 @@ use Application\Entity\Db\Individu;
use Application\Entity\Db\Utilisateur;

return [
    'unicaen-db-fake' => [
    'unicaen-db-anonym' => [
        'output' => [
            /**
             * Chemin des scripts SQL à générer :
             *    - 'anonymisation' : mise à jour des données avec des données fictives spécifiées.
             */
            'anonymisation' => '/tmp/unicaen_db_anonym_anonymisation.sql',
            'restauration' => '/tmp/unicaen_db_anonym_restauration.sql',
        ],
        'entities' => [
            /**
             * Config par classe d'entité Doctrine.
             */
            Individu::class => [
                'mapping' => [
                /**
                     * 'field' => 'xxxxx'            : pour appeler le formatter sans arguments `$faker->xxxxx()` (@see https://fakerphp.github.io/formatters)
                     * 'field' => ['xxxxx', 3, true] : pour appeler le formatter avec arguments `$faker->xxxxx(3, true)`
                     * 'field' => 'null'             : pour mettre le champ à NULL.
                 * Mapping des champs à modifier avec des données fictives générées avec FakerPHP
                 * (@see https://fakerphp.github.io/formatters)
                 *
                 * 'field' => 'xxxxx'            : formatter FakerPHP sans arguments `$faker->xxxxx()`
                 * 'field' => ['xxxxx', 3, true] : formatter FakerPHP avec arguments `$faker->xxxxx(3, true)`
                 * 'field' => 'null'             : mise à NULL.
                 */
                'mapping' => [
                    'nomUsuel' => 'lastName',
                    'nomPatronymique' => 'null',
                    'prenom1' => 'firstName',
Loading