Commit fc3ed165 authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

- Accès / Privilèges

 - Commande de status + récupération du message de refus (à formaliser)
 - Gestion des options pour les boutons pour la vue administration
parent 48ad9929
Loading
Loading
Loading
Loading
Loading
+62 −37
Changes for config/merged/signature.config.php: 62 added lines, 37 removed lines.
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ use UnicaenPrivilege\Guard\PrivilegeController;
use UnicaenSignature\Controller\SignatureControllerFactory;
use UnicaenSignature\Controller\SignatureTypeController;
use UnicaenSignature\Controller\SignatureTypeControllerFactory;
use UnicaenSignature\Provider\SignaturePrivileges;
use UnicaenSignature\Service\LetterfileService;
use UnicaenSignature\Service\LetterfileServiceFactory;
use UnicaenSignature\Service\LoggerService;
@@ -25,31 +26,55 @@ return [
                [
                    'controller' => SignatureController::class,
                    'action' => [
                        'delete',
                        'download',
                        'new',
                        'send',
                        'signatures',
                        'signRequests',
                        'status',
                        'workflows',
                    ],
//                    'privileges' => [
//                        Unicaencalendrier_indexPrivileges::INDEX,
//                    ],
                    'privileges' => [
                        SignaturePrivileges::SIGNATURE_INDEX,
                    ],
                    'roles' => []
                ],
                [
                    'controller' => SignatureTypeController::class,
                    'controller' => SignatureController::class,
                    'action' => [
                        'create',
                        'index',
                        'status'
                    ],
                    'privileges' => [
                        SignaturePrivileges::SIGNATURE_SYNC,
                    ],
                    'roles' => []
                ],
                [
                    'controller' => SignatureController::class,
                    'action' => [
                        'new', 'send'
                    ],
                    'privileges' => [
                        SignaturePrivileges::SIGNATURE_CREATE,
                    ],
                    'roles' => []
                ],
                [
                    'controller' => SignatureController::class,
                    'action' => [
                        'delete',
                    ],
                    'privileges' => [
                        SignaturePrivileges::SIGNATURE_DELETE,
                    ],
//                    'privileges' => [
//                        Unicaencalendrier_indexPrivileges::INDEX,
//                    ],
                    'roles' => []
                ],
//                [
//                    'controller' => SignatureTypeController::class,
//                    'action' => [
//                        'create',
//                        'index',
//                    ],
////                    'privileges' => [
////                        Unicaencalendrier_indexPrivileges::INDEX,
////                    ],
//                    'roles' => []
//                ],
            ],
        ],
    ],
@@ -132,28 +157,28 @@ return [
                        ]
                    ],
                ],
            'unicaen-signaturetype' => [
                'type' => Literal::class,
                'options' => [
                    'route' => '/unicaen-signaturetype',
                    'defaults' => [
                        'controller' => SignatureTypeController::class,
                        'action' => 'index',
                    ],
                ],
                'may_terminate' => true,
                'child_routes' => [
                    'create' => [
                        'type' => Segment::class,
                        'options' => [
                            'route' => '/create',
                            'defaults' => [
                                'action' => 'create'
                            ]
                        ]
                    ]
                ],
            ],
//            'unicaen-signaturetype' => [
//                'type' => Literal::class,
//                'options' => [
//                    'route' => '/unicaen-signaturetype',
//                    'defaults' => [
//                        'controller' => SignatureTypeController::class,
//                        'action' => 'index',
//                    ],
//                ],
//                'may_terminate' => true,
//                'child_routes' => [
//                    'create' => [
//                        'type' => Segment::class,
//                        'options' => [
//                            'route' => '/create',
//                            'defaults' => [
//                                'action' => 'create'
//                            ]
//                        ]
//                    ]
//                ],
//            ],
        ],
    ],

+34 −0
Changes for src/Command/SignatureLetterfileInfosCommand.php: 34 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php

namespace UnicaenSignature\Command;

use Laminas\ServiceManager\ServiceManager;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class SignatureLetterfileInfosCommand extends SignatureCommandAbstract
{
    // php bin/oscar.php signature:add-signature "$(<module/UnicaenSignature/test/datas/json-datas-add-signature.json)"

    protected static $defaultName = 'signature:letterfile-info';

    const ARG_ID = "id";

    protected function configure()
    {
        $this
            ->setDescription("Récupération des informations sur la procédure de signature dans ESUP")
            ->addArgument(self::ARG_ID, InputArgument::REQUIRED, "données JSON")
        ;
    }

    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $io = $this->getIO($input, $output);
        $id = $input->getArgument(self::ARG_ID);
        $infos = $this->getSignatureService()->getLetterfileService()->getDefaultLetterFileStrategy()->getSignRequestInfo($id);
        var_dump($infos);
        return self::SUCCESS;
    }
}
 No newline at end of file
+3 −1
Changes for src/Command/SignatureListCommand.php: 3 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ class SignatureListCommand extends SignatureCommandAbstract
        $io = $this->getIO($input, $output);
        $io->title("Procédures de signature");

        $headers = ["ID", "Label", "Description", "Parafeur", "Doc ID", "Statut"];
        $headers = ["ID", "Label", "Description", "Parafeur", "Destinataires", "Tous", "Doc ID", "Statut"];
        $rows = [];

        /** @var Signature $signature */
@@ -32,6 +32,8 @@ class SignatureListCommand extends SignatureCommandAbstract
                $signature->getLabel(),
                $signature->getDescription(),
                $signature->getLetterfileKey(),
                implode(',', $signature->getRecipientsEmailsArray()),
                $signature->getAllSignToComplete() ? "O" : "N",
                $signature->getDocumentRemotekey(),
                $signature->getStatusText(),
            ];
+33 −5
Changes for src/Entity/Db/Signature.php: 33 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -107,7 +107,7 @@ class Signature
     * Liste des contrats de financement pour le projet.
     *
     * @var ArrayCollection
     * @ORM\OneToMany(targetEntity="SignatureRecipient", mappedBy="signature", cascade={"persist"})
     * @ORM\OneToMany(targetEntity="SignatureRecipient", mappedBy="signature", cascade={"persist","remove"})
     */
    protected $recipients;

@@ -173,7 +173,13 @@ class Signature
     */
    private ?string $letterfile_url;


    /**
     * Une signature de tous les destinataires est attendue.
     *
     * @var string|null
     * @ORM\Column (type="boolean", options={"default"="false"})
     */
    private bool $allSignToComplete = false;

    /**
     * @return int
@@ -183,6 +189,23 @@ class Signature
        return $this->id;
    }

    /**
     * @return boolean
     */
    public function getAllSignToComplete(): bool
    {
        return $this->allSignToComplete;
    }

    /**
     * @param string|null $allSignToComplete
     */
    public function setAllSignToComplete(bool $allSignToComplete): self
    {
        $this->allSignToComplete = $allSignToComplete;
        return $this;
    }

    /**
     * @return DateTime|null
     */
@@ -452,15 +475,20 @@ class Signature

    public function isDeletable(): bool
    {
        return true;
        $deletable = [
            self::STATUS_SIGNATURE_DRAFT,
            self::STATUS_SIGNATURE_WAIT
        ];
        return in_array($this->getStatus(), $deletable);
    }

    public function isDownloadable(): bool
    {
        return $this->getStatus() != self::STATUS_SIGNATURE_FULLDELETE;
        return $this->getStatus() != self::STATUS_SIGNATURE_FULLDELETE && $this->getStatus() != self::STATUS_SIGNATURE_DRAFT;
    }

    public function getStatusText() :string {
    public function getStatusText(): string
    {
        return self::getStatusLabel($this->getStatus());
    }

+1 −1
Changes for src/Entity/Db/SignatureRecipient.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ class SignatureRecipient
     * @var string|null
     * @ORM\Column(type="integer", nullable=true)
     */
    private ?string $status;
    private ?int $status;

    /**
     * @var string|null
Loading