diff --git a/src/Domain/Registry/Controller/TreatmentController.php b/src/Domain/Registry/Controller/TreatmentController.php index ff513c3ce54cc748028564ed1b81accb11edb24b..d69f9751fbb4c28524bc3a618b8a5a97931c01cf 100644 --- a/src/Domain/Registry/Controller/TreatmentController.php +++ b/src/Domain/Registry/Controller/TreatmentController.php @@ -363,7 +363,7 @@ class TreatmentController extends CRUDController 'id' => $treatment->getId(), 'nom' => $treatmentLink, 'collectivite' => $this->authorizationChecker->isGranted('ROLE_REFERENT') ? $treatment->getCollectivity()->getName() : '', - 'service' => $this->authorizationChecker->isGranted('ROLE_REFERENT') && $treatment->getService() ? $treatment->getService()->getName() : '', + 'service' => $this->authorizationChecker->isGranted('ROLE_USER') && $treatment->getService() ? $treatment->getService()->getName() : '', 'baseLegal' => !empty($treatment->getLegalBasis()) && array_key_exists($treatment->getLegalBasis(), TreatmentLegalBasisDictionary::getBasis()) ? TreatmentLegalBasisDictionary::getBasis()[$treatment->getLegalBasis()] : $treatment->getLegalBasis(), 'logiciel' => $treatment->getToolsString(), 'enTantQue' => !empty($treatment->getAuthor()) && array_key_exists($treatment->getAuthor(), TreatmentAuthorDictionary::getAuthors()) ? TreatmentAuthorDictionary::getAuthors()[$treatment->getAuthor()] : $treatment->getAuthor(), @@ -699,6 +699,38 @@ class TreatmentController extends CRUDController ]; } + if ($this->userProvider->getAuthenticatedUser()->hasServices()) { + return [ + '1' => 'name', + '2' => 'collectivite', + '3' => 'service', + '4' => 'statut', + '5' => 'baseLegal', + '6' => 'logiciel', + '7' => 'enTantQue', + '8' => 'gestionnaire', + '9' => 'sousTraitant', + '10' => 'sensitiveData', + '11' => 'controleAcces', + '12' => 'tracabilite', + '13' => 'saving', + '14' => 'update', + '15' => 'other', + '16' => 'entitledPersons', + '17' => 'openAccounts', + '18' => 'specificitiesDelivered', + '19' => 'public', + '20' => 'responsableTraitement', + '21' => 'specific_traitement', + '22' => 'conformite_traitement', + '23' => 'avis_aipd', + '24' => 'exempt_AIPD', + '25' => 'createdAt', + '26' => 'updatedAt', + '27' => 'actions', + ]; + } + return [ '1' => 'name', '2' => 'statut', diff --git a/src/Domain/Registry/Controller/ViolationController.php b/src/Domain/Registry/Controller/ViolationController.php index e33b8110159a2054b225dce2cdfe949f0269a5bd..776d4ece165e42d2d910fb2d483b3bd0c86f3d17 100644 --- a/src/Domain/Registry/Controller/ViolationController.php +++ b/src/Domain/Registry/Controller/ViolationController.php @@ -185,7 +185,7 @@ class ViolationController extends CRUDController $reponse['data'][] = [ 'id' => $violation->getId(), 'collectivite' => $violation->getCollectivity()->getName(), - 'service' => $this->authorizationChecker->isGranted('ROLE_REFERENT') && $violation->getService() ? $violation->getService()->getName() : '', + 'service' => $this->userProvider->getAuthenticatedUser()->hasServices() && $violation->getService() ? $violation->getService()->getName() : '', 'date' => $violationLink, 'nature' => $natures, 'cause' => !\is_null($violation->getCause()) ? ViolationCauseDictionary::getNatures()[$violation->getCause()] : null, @@ -233,6 +233,22 @@ class ViolationController extends CRUDController ]; } + if ($this->userProvider->getAuthenticatedUser()->hasServices()) { + return [ + 'date', + 'service', + 'service', + 'nature', + 'inProgress', + 'cause', + 'gravity', + 'notification', + 'createdAt', + 'updatedAt', + 'actions', + ]; + } + return [ 'date', 'nature', diff --git a/src/Domain/User/Model/User.php b/src/Domain/User/Model/User.php index 6f7c6ee88ac04755bcef15ad8654b6db00f4dffa..079de60769b816960477498f096556e97bd1ad7a 100644 --- a/src/Domain/User/Model/User.php +++ b/src/Domain/User/Model/User.php @@ -493,6 +493,11 @@ class User implements LoggableSubject, UserInterface, CollectivityRelated, Passw return $this->hasModule('isHasModuleConformiteOrganisation'); } + public function hasServices(): bool + { + return $this->hasModule('getIsServicesEnabled'); + } + private function hasModule($func) { if (in_array(UserRoleDictionary::ROLE_REFERENT, $this->getRoles())) { diff --git a/templates/Registry/Treatment/list.html.twig b/templates/Registry/Treatment/list.html.twig index 4cbfb0e703eb39ec1f99b8c29d322c67369f572b..33d9356ba1d696125bd94165121458846524c83b 100644 --- a/templates/Registry/Treatment/list.html.twig +++ b/templates/Registry/Treatment/list.html.twig @@ -96,6 +96,8 @@ <th scope="col"> <input class="form-control" type="text" id="search_collectivite" placeholder="{{ 'global.label.organization'|trans }}" style="width: 100%;"> </th> + {% endif %} + {% if app.user.hasServices %} <th scope="col"> <input class="form-control" type="text" id="search_service" placeholder="{{ 'global.label.service'|trans }}" style="width: 100%;"> </th> @@ -250,6 +252,8 @@ <th scope="col">{{ 'registry.treatment.label.name'|trans }}</th> {% if is_granted('ROLE_REFERENT') %} <th scope="col">{{ 'global.label.organization'|trans }}</th> + {% endif %} + {% if app.user.hasServices %} <th scope="col">{{ 'global.label.service'|trans }}</th> {% endif %} <th scope="col" style="max-width: 60px;">{{ 'registry.treatment.label.statut'|trans }}</th> @@ -329,6 +333,39 @@ {"data": "updatedAt", "visible": false}, {"data": "actions", "className": "noVis actions", "visible": actionIsVisible, "orderable": false}, ] %} + + {% if app.user.hasServices %} + {% set cols = [ + {"data": "id", "className": "noVis isId"}, + {"data": "nom", "className": "noVis"}, + {"data" : "service", "visible": false}, + {"data": "statut", "visible": true}, + {"data": "baseLegal", "visible": true}, + {"data": "logiciel", "visible": true}, + {"data": "enTantQue", "visible": false}, + {"data": "gestionnaire", "visible": true}, + {"data": "sousTraitant", "visible": false, "orderable": false}, + {"data": "sensitiveData", "visible": true}, + {"data": "controleAcces", "visible": false}, + {"data": "tracabilite", "visible": false}, + {"data": "saving", "visible": false}, + {"data": "update", "visible": false}, + {"data": "other", "visible": false}, + {"data": "entitledPersons", "visible": false}, + {"data": "openAccounts", "visible": false}, + {"data": "specificitiesDelivered", "visible": false}, + {"data": "public", "visible": false, "orderable": false}, + {"data": "responsableTraitement", "visible": false}, + {"data": "specific_traitement","visible": true, "orderable": false}, + {"data": "conformite_traitement","visible": false}, + {"data": "avis_aipd","visible": false}, + {"data": "exempt_AIPD","visible": false}, + {"data": "createdAt", "visible": false}, + {"data": "updatedAt", "visible": false}, + {"data": "actions", "className": "noVis actions", "visible": actionIsVisible, "orderable": false}, + ] %} + {% endif %} + {% if is_granted('ROLE_REFERENT') %} {% set cols = [ {"data": "id", "className": "noVis isId"}, @@ -480,7 +517,10 @@ var col = 0; {% if is_granted('ROLE_REFERENT') %} - col = 2; + col = 1; + {% endif %} + {% if app.user.hasServices %} + col += 1; {% endif %} $('#search_nom').off('keyup'); @@ -492,11 +532,12 @@ $('#search_collectivite').keyup($.debounce(250, function(){ oTable.column('2').search($(this).val()).draw() ; })); + {% endif %} $('#search_service').off('keyup'); $('#search_service').keyup($.debounce(250, function(){ oTable.column('3').search($(this).val()).draw() ; })); - {% endif %} + $('#search_statut').off('change'); $('#search_statut').change(function(){ diff --git a/templates/Registry/Violation/list.html.twig b/templates/Registry/Violation/list.html.twig index cbbb2afceeffcf9640f9d8671d14e65983499341..4de2d4c0924cab7bc0f22837f381a13c30f91464 100644 --- a/templates/Registry/Violation/list.html.twig +++ b/templates/Registry/Violation/list.html.twig @@ -84,6 +84,8 @@ <th scope="col"> <input class="form-control" type="text" id="search_collectivite" placeholder="{{ 'global.label.organization'|trans }}" style="width: 100%;"> </th> + {% endif %} + {% if app.user.hasServices %} <th scope="col"> <input class="form-control" type="text" id="search_service" placeholder="{{ 'global.label.service'|trans }}" style="width: 100%;"> </th> @@ -139,6 +141,8 @@ <th scope="col">{{ 'registry.violation.label.date'|trans }}</th> {% if is_granted('ROLE_REFERENT') %} <th scope="col">{{ 'global.label.organization'|trans }}</th> + {% endif %} + {% if app.user.hasServices %} <th scope="col">{{ 'global.label.service'|trans }}</th> {% endif %} <th scope="col">{{ 'registry.violation.list.violation_nature'|trans }}</th> @@ -185,6 +189,22 @@ {"data": "actions", "className": "noVis", "orderable": false, "visible": actionIsVisible}, ] %} + + {% if app.user.hasServices %} + {% set cols = [ + {"data": "date", "className": "noVis"}, + {"data": "service", "visible": false}, + {"data": "nature"}, + {"data": "inProgress"}, + {"data": "cause"}, + {"data": "gravity"}, + {"data": "notification"}, + {"data": "createdAt", "visible": false}, + {"data": "updatedAt", "visible": false}, + {"data": "actions", "className": "noVis", "orderable": false, "visible": actionIsVisible}, + ] %} + {% endif %} + {% if is_granted('ROLE_REFERENT') %} {% set cols = [ {"data": "date", "className": "noVis"}, @@ -212,9 +232,13 @@ var oTable = $('#table').DataTable(); var col = 0; {% if is_granted('ROLE_REFERENT') %} - col = 2; + col = 1; + {% endif %} + {% if app.user.hasServices %} + col += 1; {% endif %} + oTable.on( 'draw', function () { const printButton = $('#print-all') let printLink = "{{ path('registry_violation_print_all', { }) }}"; @@ -250,6 +274,8 @@ $('#search_collectivite').keyup($.debounce(250, function(){ oTable.column(1).search($(this).val()).draw() ; })); + {% endif %} + {% if app.user.hasServices %} $('#search_service').off('keyup'); $('#search_service').keyup($.debounce(250, function(){ oTable.column(2).search($(this).val()).draw() ;