Commit 329786f3 authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Premier niveau de test d'accès aux étapes de WF

parent 7a71d901
Loading
Loading
Loading
Loading
Loading
+2 −2
Changes for composer.lock: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -7564,7 +7564,7 @@
            "source": {
                "type": "git",
                "url": "https://git.unicaen.fr/lib/unicaen/framework.git",
                "reference": "2eb5d4b9a1bca98defb6e8a3c681bf124cc50c4d"
                "reference": "b96643ddb64e709609b30a18823e408b70e1d4da"
            },
            "require": {
                "laminas/laminas-permissions-acl": "^2.17",
@@ -7579,7 +7579,7 @@
                }
            },
            "description": "Framework pour applications Unicaen",
            "time": "2025-10-14T14:12:58+00:00"
            "time": "2025-10-14T15:02:14+00:00"
        },
        {
            "name": "unicaen/import",
+1 −1
Changes for front/Workflow/FeuilleDeRoute.vue: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@
                    <span class="label label-primary">{{ etape.numero }}</span>

                    <!-- Libellé et lien éventuel -->
                    <a v-if="etape.url && etape.allowed"
                    <a v-if="etape.url && etape.navigable"
                       title="Cliquez sur ce lien pour accéder à la page correspondant à cette étape" :href="etape.url">
                        <abbr v-if="etape.whyNonAtteignable.length > 0" :title="formatWhyNonAtteignable(etape)">{{
                                etape.libelle
+2 −2
Changes for module/Workflow/src/Controller/WorkflowController.php: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ class WorkflowController extends AbstractController
            'atteignable',
            'whyNonAtteignable',
            'courante',
            'allowed',
            'navigable',
            'realisationPourc',
            'objectif',
            'realisation',
@@ -60,7 +60,7 @@ class WorkflowController extends AbstractController
                'atteignable',
                'whyNonAtteignable',
                'courante',
                'allowed',
                'navigable',
                'realisationPourc',
                'objectif',
                'realisation',
+24
Changes for module/Workflow/src/Model/FeuilleDeRouteEtape.php: 24 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -3,6 +3,8 @@
namespace Workflow\Model;


use Unicaen\Framework\Application\Application;
use Unicaen\Framework\Authorize\Authorize;
use Workflow\Entity\Db\WorkflowEtape;
use Workflow\Service\WorkflowService;

@@ -25,6 +27,7 @@ class FeuilleDeRouteEtape
    public float         $objectif          = 0.0;
    public float         $realisation       = 0.0;
    public array         $whyNonAtteignable = [];
    private Authorize    $authorize;



@@ -33,6 +36,9 @@ class FeuilleDeRouteEtape
        $this->feuilleDeRoute = $feuilleDeRoute;
        $this->service        = $service;
        $this->workflowEtape  = $etape;

        // Récupération en direct du service Authorize
        $this->authorize = Application::getInstance()->container()->get(Authorize::class);
    }


@@ -69,6 +75,24 @@ class FeuilleDeRouteEtape

    public function isAllowed(): bool
    {
        return $this->atteignable || $this->realisation > 0;
    }



    public function isNavigable()
    {
        if (!$this->isAllowed()) {
            return false;
        }

        if ($route = $this->workflowEtape->getRoute()) {
            $params = [
                'intervenant' => $this->feuilleDeRoute->getIntervenant(),
            ];
            return $this->authorize->isAllowedRoute($route, $params);
        } else {
            return true;
        }
    }
}
 No newline at end of file