Skip to content
Snippets Groups Projects
Commit 3eeb0e01 authored by gauthierb's avatar gauthierb
Browse files

Abandon de l'interface "StructureAwareInterface" là où je connais.

parent 2b715939
No related branches found
No related tags found
No related merge requests found
Showing with 46 additions and 32 deletions
......@@ -732,9 +732,9 @@ class ContratController extends AbstractActionController
{
if (null === $this->structure) {
$role = $this->getServiceContext()->getSelectedIdentityRole();
if (!$role instanceof \Application\Interfaces\StructureAwareInterface) {
throw new LogicException("Rôle courant inattendu.");
}
// if (!$role instanceof \Application\Interfaces\StructureAwareInterface) {
// throw new LogicException("Rôle courant inattendu.");
// }
$this->structure = $role->getStructure();
}
......
......@@ -180,13 +180,14 @@ class IndicateurController extends AbstractActionController
{
$role = $this->getServiceContext()->getSelectedIdentityRole();
if ($role instanceof \Application\Interfaces\StructureAwareInterface) {
// if ($role instanceof \Application\Interfaces\StructureAwareInterface) {
// return $role->getStructure();
// }
//
// return null;
return $role->getStructure();
}
return null;
}
/**
* @return NotificationIndicateurService
*/
......
......@@ -244,13 +244,14 @@ EOS;
{
$role = $this->getServiceContext()->getSelectedIdentityRole();
if ($role instanceof StructureAwareInterface) {
// if ($role instanceof StructureAwareInterface) {
// return $role->getStructure();
// }
//
// return null;
return $role->getStructure();
}
return null;
}
/**
* @return IndicateurService
*/
......
......@@ -112,9 +112,9 @@ class ServiceController extends AbstractActionController
$canAddServiceReferentiel = $intervenant instanceof IntervenantPermanent &&
$this->isAllowed($this->getServiceServiceReferentiel()->newEntity()->setIntervenant($intervenant), 'create');
if (! $this->isAllowed($this->getServiceService()->newEntity()->setIntervenant($intervenant), 'read')){
throw new \BjyAuthorize\Exception\UnAuthorizedException();
}
// if (! $this->isAllowed($this->getServiceService()->newEntity()->setIntervenant($intervenant), 'read')){
// throw new \BjyAuthorize\Exception\UnAuthorizedException();
// }
if (! $intervenant){
$action = $this->getRequest()->getQuery('action', null); // ne pas afficher par défaut, sauf si demandé explicitement
......@@ -233,9 +233,20 @@ class ServiceController extends AbstractActionController
$this->messenger()->addMessage("La saisie des enseignements réalisés a été clôturée le $dateCloture.", 'success');
}
$avertissement = "<strong>Attention!</strong> <br />"
. "Assurez-vous de n'avoir oublié de déclarer la réalisation "
. "d'aucun autre enseignement, quelle que soit la composante d'intervention. <br />"
. "Cliquer sur le bouton ci-dessous vous empêchera de revenir sur votre saisie.";
$confirm = "Attention! "
. "Confirmez-vous n'avoir oublié de déclarer la réalisation "
. "d'aucun autre enseignement, quelle que soit la composante d'intervention ? "
. "Cliquer sur OK vous empêchera de revenir sur votre saisie.";
$viewModel->setVariables([
'typeVolumeHoraire' => $tvh,
'validation' => $validation,
'avertissement' => $avertissement,
'confirm' => $confirm,
]);
return $viewModel;
......
......@@ -180,9 +180,9 @@ class ValidationController extends AbstractActionController
if (!$this->validation) {
$this->validation = $serviceValidation->newEntity($typeValidation);
$this->validation->setIntervenant($this->intervenant);
if ($role instanceof \Application\Interfaces\StructureAwareInterface) {
// if ($role instanceof \Application\Interfaces\StructureAwareInterface) {
$this->validation->setStructure($role->getStructure());
}
// }
}
else {
$this->formValider->get('valide')->setValue(true);
......@@ -548,11 +548,11 @@ class ValidationController extends AbstractActionController
$role = $this->getServiceContext()->getSelectedIdentityRole();
$validation = $this->context()->mandatory()->validationFromRoute(); /* @var $validation \Application\Entity\Db\Validation */
if ($role instanceof \Application\Interfaces\StructureAwareInterface) {
// if ($role instanceof \Application\Interfaces\StructureAwareInterface) {
if ($validation->getStructure() !== $role->getStructure()) {
throw new RuntimeException("Suppression de la validation interdite.");
}
}
// }
$title = "Suppression de la validation";
$form = new \Application\Form\Supprimer('suppr');
......
......@@ -68,7 +68,7 @@ class RoleProvider implements ProviderInterface, EntityManagerAwareInterface
protected function makeRoles()
{
$roles = [];
$roles['test'] = new Role( 'test', 'user', 'Rôle de test');
/* deprecated */
foreach( $this->config as $classname ){
if (class_exists( $classname )){
......
......@@ -127,12 +127,13 @@ abstract class ValidationEnsRefAbstractRule implements WorkflowIntervenantAwareI
*/
protected function determineStructureRole()
{
if ($this->role instanceof \Application\Interfaces\StructureAwareInterface) {
// if ($this->role instanceof \Application\Interfaces\StructureAwareInterface) {
// $this->structureRole = $this->role->getStructure();
// }
// else {
// $this->structureRole = null;
// }
$this->structureRole = $this->role->getStructure();
}
else {
$this->structureRole = null;
}
return $this;
}
......
......@@ -332,9 +332,9 @@ class ContratProcess extends AbstractService
{
if (null === $this->structure) {
$role = $this->getServiceContext()->getSelectedIdentityRole();
if (!$role instanceof \Application\Interfaces\StructureAwareInterface) {
throw new LogicException("Rôle courant inattendu.");
}
// if (!$role instanceof \Application\Interfaces\StructureAwareInterface) {
// throw new LogicException("Rôle courant inattendu.");
// }
$this->structure = $role->getStructure();
}
......
......@@ -125,7 +125,7 @@ class Structure extends AbstractEntityService
if (true === $role) {
$qb->andWhere("EXISTS ( SELECT r from Application\Entity\Db\Role r WHERE r.structure = $alias)");
}
elseif ($role instanceof \Application\Interfaces\StructureAwareInterface && $role->getStructure()) {
elseif (/*$role instanceof \Application\Interfaces\StructureAwareInterface && */$role->getStructure()) {
$this->finderByStructure( $role->getStructure(), $qb, $alias );
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment