template.config.php 6.44 KB
Newer Older
Jean-Philippe Metivier's avatar
Jean-Philippe Metivier committed
1
2
<?php

3
4
5
6
7
8
use UnicaenRenderer\Controller\TemplateController;
use UnicaenRenderer\Controller\TemplateControllerFactory;
use UnicaenRenderer\Form\Template\TemplateForm;
use UnicaenRenderer\Form\Template\TemplateFormFactory;
use UnicaenRenderer\Form\Template\TemplateHydrator;
use UnicaenRenderer\Form\Template\TemplateHydratorFactory;
9
use UnicaenRenderer\Provider\Privilege\DocumenttemplatePrivileges;
10
11
use UnicaenRenderer\Service\Template\TemplateService;
use UnicaenRenderer\Service\Template\TemplateServiceFactory;
Jean-Philippe Metivier's avatar
Jean-Philippe Metivier committed
12
13
14
15
16
17
18
19
20
use UnicaenPrivilege\Guard\PrivilegeController;
use Zend\Router\Http\Literal;
use Zend\Router\Http\Segment;

return [
    'bjyauthorize' => [
        'guards' => [
            PrivilegeController::class => [
                [
21
                    'controller' => TemplateController::class,
Jean-Philippe Metivier's avatar
Jean-Philippe Metivier committed
22
23
                    'action' => [
                        'index',
24
25
26
27
28
29
30
31
                    ],
                    'privileges' => [
                        DocumenttemplatePrivileges::DOCUMENTTEMPLATE_INDEX,
                    ],
                ],
                [
                    'controller' => TemplateController::class,
                    'action' => [
Jean-Philippe Metivier's avatar
Jean-Philippe Metivier committed
32
33
34
                        'afficher',
                    ],
                    'privileges' => [
35
                        DocumenttemplatePrivileges::DOCUMENTTEMPLATE_AFFICHER,
Jean-Philippe Metivier's avatar
Jean-Philippe Metivier committed
36
37
38
                    ],
                ],
                [
39
                    'controller' => TemplateController::class,
Jean-Philippe Metivier's avatar
Jean-Philippe Metivier committed
40
41
42
43
                    'action' => [
                        'ajouter',
                    ],
                    'privileges' => [
44
                        DocumenttemplatePrivileges::DOCUMENTTEMPLATE_AJOUTER,
Jean-Philippe Metivier's avatar
Jean-Philippe Metivier committed
45
46
47
                    ],
                ],
                [
48
                    'controller' => TemplateController::class,
Jean-Philippe Metivier's avatar
Jean-Philippe Metivier committed
49
50
51
52
                    'action' => [
                        'modifier',
                    ],
                    'privileges' => [
53
                        DocumenttemplatePrivileges::DOCUMENTTEMPLATE_MODIFIER,
Jean-Philippe Metivier's avatar
Jean-Philippe Metivier committed
54
55
56
                    ],
                ],
                [
57
                    'controller' => TemplateController::class,
Jean-Philippe Metivier's avatar
Jean-Philippe Metivier committed
58
59
60
61
                    'action' => [
                        'detruire',
                    ],
                    'privileges' => [
62
                        DocumenttemplatePrivileges::DOCUMENTTEMPLATE_SUPPRIMER,
Jean-Philippe Metivier's avatar
Jean-Philippe Metivier committed
63
64
65
66
67
68
69
70
71
72
73
74
75
76
                    ],
                ],
            ],
        ],
    ],

    'navigation' => [
        'default' => [
            'home' => [
                'pages' => [
                    'administration' => [
                        'pages' => [
                            'contenu' => [
                                'pages' => [
77
                                    'template' => [
78
79
80
                                        'label' => 'Template',
                                        'route' => 'contenu/template',
                                        'resource' => PrivilegeController::getResourceId(TemplateController::class, 'index'),
Jean-Philippe Metivier's avatar
Jean-Philippe Metivier committed
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
                                        'order'    => 10001,
                                    ],
                                ],
                            ],
                        ],
                    ],
                ],
            ],
        ],
    ],

    'router' => [
        'routes' => [
            'contenu' => [
                'child_routes' => [
96
                    'template' => [
Jean-Philippe Metivier's avatar
Jean-Philippe Metivier committed
97
98
                        'type' => Literal::class,
                        'options' => [
99
                            'route' => '/template',
Jean-Philippe Metivier's avatar
Jean-Philippe Metivier committed
100
                            'defaults' => [
101
                                'controller' => TemplateController::class,
Jean-Philippe Metivier's avatar
Jean-Philippe Metivier committed
102
103
104
105
106
107
108
109
                                'action' => 'index',
                            ],
                        ],
                        'may_terminate' => true,
                        'child_routes' => [
                            'afficher' => [
                                'type' => Segment::class,
                                'options' => [
110
                                    'route' => '/afficher/:template',
Jean-Philippe Metivier's avatar
Jean-Philippe Metivier committed
111
                                    'defaults' => [
112
                                        'controller' => TemplateController::class,
Jean-Philippe Metivier's avatar
Jean-Philippe Metivier committed
113
114
115
116
117
118
119
120
121
                                        'action' => 'afficher',
                                    ],
                                ],
                            ],
                            'ajouter' => [
                                'type' => Literal::class,
                                'options' => [
                                    'route' => '/ajouter',
                                    'defaults' => [
122
                                        'controller' => TemplateController::class,
Jean-Philippe Metivier's avatar
Jean-Philippe Metivier committed
123
124
125
126
127
128
129
                                        'action' => 'ajouter',
                                    ],
                                ],
                            ],
                            'modifier' => [
                                'type' => Segment::class,
                                'options' => [
130
                                    'route' => '/modifier/:template',
Jean-Philippe Metivier's avatar
Jean-Philippe Metivier committed
131
                                    'defaults' => [
132
                                        'controller' => TemplateController::class,
Jean-Philippe Metivier's avatar
Jean-Philippe Metivier committed
133
134
135
136
137
138
139
                                        'action' => 'modifier',
                                    ],
                                ],
                            ],
                            'detruire' => [
                                'type' => Segment::class,
                                'options' => [
140
                                    'route' => '/detruire/:template',
Jean-Philippe Metivier's avatar
Jean-Philippe Metivier committed
141
                                    'defaults' => [
142
                                        'controller' => TemplateController::class,
Jean-Philippe Metivier's avatar
Jean-Philippe Metivier committed
143
144
145
146
147
148
149
150
151
152
153
154
155
                                        'action' => 'detruire',
                                    ],
                                ],
                            ],
                        ],
                    ],
                ],
            ],
        ],
    ],

    'service_manager' => [
        'factories' => [
156
            TemplateService::class => TemplateServiceFactory::class,
Jean-Philippe Metivier's avatar
Jean-Philippe Metivier committed
157
158
159
160
        ],
    ],
    'form_elements' => [
        'factories' => [
161
            TemplateForm::class => TemplateFormFactory::class,
Jean-Philippe Metivier's avatar
Jean-Philippe Metivier committed
162
163
164
165
        ],
    ],
    'hydrators' => [
        'factories' => [
166
            TemplateHydrator::class => TemplateHydratorFactory::class,
Jean-Philippe Metivier's avatar
Jean-Philippe Metivier committed
167
168
169
170
        ],
    ],
    'controllers'     => [
        'factories' => [
171
            TemplateController::class => TemplateControllerFactory::class,
Jean-Philippe Metivier's avatar
Jean-Philippe Metivier committed
172
173
174
        ]
    ],
];