diff --git a/data/privileges.php b/data/privileges.php
index 2442cdd8e4c36ec9b5e7ffe5f8b314cebd598a6b..91236813b63bcad363b89dc247471ef4f2aa6e5a 100644
--- a/data/privileges.php
+++ b/data/privileges.php
@@ -113,12 +113,13 @@ return [
'referentiel' => [
'libelle' => 'Référentiel',
'privileges' => [
- 'visualisation' => 'Visualisation',
- 'edition' => 'Édition',
- 'validation' => 'Validation',
- 'admin-edition' => 'Administration - Édition',
- 'devalidation' => 'Dévalidation',
- 'admin-visualisation' => 'Administration - Visualisation',
+ 'visualisation' => 'Visualisation',
+ 'edition' => 'Édition',
+ 'validation' => 'Validation',
+ 'admin-edition' => 'Administration - Édition',
+ 'devalidation' => 'Dévalidation',
+ 'admin-visualisation' => 'Administration - Visualisation',
+ 'saisie-toutes-composantes' => 'Saisie sans contrainte de composante',
],
],
diff --git a/module/Application/src/Application/Assertion/ServiceAssertion.php b/module/Application/src/Application/Assertion/ServiceAssertion.php
index 63df3ac0d8b28f624784c13ab160c2815bd69e71..93fcae027b3d29f84773ccc7d6615e154ecc2805 100755
--- a/module/Application/src/Application/Assertion/ServiceAssertion.php
+++ b/module/Application/src/Application/Assertion/ServiceAssertion.php
@@ -34,7 +34,6 @@ class ServiceAssertion extends AbstractAssertion
use TypeVolumeHoraireServiceAwareTrait;
-
/* ---- Routage général ---- */
public function __invoke(array $page) // gestion des visibilités de menus
{
@@ -284,23 +283,23 @@ class ServiceAssertion extends AbstractAssertion
protected function assertServiceReferentielEdition(Role $role, ServiceReferentiel $serviceReferentiel)
{
- $structure = $role->getStructure();
-
$asserts = [];
-
- if ($structure) {
- $structureAffectation = $serviceReferentiel->getIntervenant() ? $serviceReferentiel->getIntervenant()->getStructure() : null;
- $structureEnseignement = $serviceReferentiel->getStructure();
-
- if ($structureAffectation && $structureEnseignement) {
- // cas d'un intervenant d'une autre structure prenant un enseignement dans une autre structure
- $asserts[] = $structure == $structureAffectation || $structure == $structureEnseignement; // le service doit avoir un lien avec la structure
- } elseif ($structureAffectation && !$structureEnseignement) {
- // cas d'un intervenant prenant des enseignements à l'extérieur
- $asserts[] = $structure == $structureAffectation;
- } elseif (!$structureAffectation && $structureEnseignement) {
- // cas d'un intervenant extérieur prenant des enseignements de la composante
- $asserts[] = $structure == $structureEnseignement;
+ if (!$role->hasPrivilege(Privileges::REFERENTIEL_SAISIE_TOUTES_COMPOSANTES)) {
+ // Si on n'a pas le privilège pour pouvoir du référentiel dans toutes les composantes sans restriction
+ if ($structure = $role->getStructure()) {
+ $structureAffectation = $serviceReferentiel->getIntervenant() ? $serviceReferentiel->getIntervenant()->getStructure() : null;
+ $structureEnseignement = $serviceReferentiel->getStructure();
+
+ if ($structureAffectation && $structureEnseignement) {
+ // cas d'un intervenant d'une autre structure prenant un enseignement dans une autre structure
+ $asserts[] = $structure == $structureAffectation || $structure == $structureEnseignement; // le service doit avoir un lien avec la structure
+ } elseif ($structureAffectation && !$structureEnseignement) {
+ // cas d'un intervenant prenant des enseignements à l'extérieur
+ $asserts[] = $structure == $structureAffectation;
+ } elseif (!$structureAffectation && $structureEnseignement) {
+ // cas d'un intervenant extérieur prenant des enseignements de la composante
+ $asserts[] = $structure == $structureEnseignement;
+ }
}
}
diff --git a/module/Application/src/Application/Provider/Privilege/Privileges.php b/module/Application/src/Application/Provider/Privilege/Privileges.php
index e8e5bf647332723d10f283776b16491bab15f8ef..ec640ac7e7c9f9e7a6180e8b68bce078be6dd1ab 100755
--- a/module/Application/src/Application/Provider/Privilege/Privileges.php
+++ b/module/Application/src/Application/Provider/Privilege/Privileges.php
@@ -184,5 +184,6 @@ class Privileges extends \UnicaenAuth\Provider\Privilege\Privileges
const UNICAEN_TBL_UPDATE_ACTUPROC = 'unicaen-tbl-update-actuproc';
const WORKFLOW_DEPENDANCES_EDITION = 'workflow-dependances-edition';
const WORKFLOW_DEPENDANCES_VISUALISATION = 'workflow-dependances-visualisation';
+ const REFERENTIEL_SAISIE_TOUTES_COMPOSANTES = 'referentiel-saisie-toutes-composantes';
}
\ No newline at end of file