feat: Permettre la consultation et gestion des droits à l'image des élèves
Les administrateurs et enseignants ont besoin de consulter et gérer les autorisations de droit à l'image des élèves pour respecter la réglementation lors de publications contenant des photos (FR82). Cette fonctionnalité ajoute une page dédiée avec liste filtrable par statut, modification individuelle via dropdown, export CSV avec BOM UTF-8 pour Excel, et préparation du système d'avertissement avant publication (query/handler prêts, intégration à faire quand le module publication existera). Le filtrage par classe (AC2) est bloqué en attente d'une table d'affectation élève↔classe qui n'existe pas encore.
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Administration\Infrastructure\Api\Resource;
|
||||
|
||||
use ApiPlatform\Metadata\ApiProperty;
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use ApiPlatform\Metadata\Get;
|
||||
use ApiPlatform\Metadata\GetCollection;
|
||||
use ApiPlatform\Metadata\Patch;
|
||||
use App\Administration\Application\Query\GetStudentsImageRights\StudentImageRightsDto;
|
||||
use App\Administration\Infrastructure\Api\Processor\UpdateImageRightsProcessor;
|
||||
use App\Administration\Infrastructure\Api\Provider\ImageRightsCollectionProvider;
|
||||
use App\Administration\Infrastructure\Api\Provider\ImageRightsExportProvider;
|
||||
use App\Administration\Infrastructure\Api\Provider\ImageRightsItemProvider;
|
||||
use DateTimeImmutable;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
#[ApiResource(
|
||||
shortName: 'ImageRights',
|
||||
operations: [
|
||||
new GetCollection(
|
||||
uriTemplate: '/students/image-rights',
|
||||
provider: ImageRightsCollectionProvider::class,
|
||||
name: 'get_students_image_rights',
|
||||
),
|
||||
new Get(
|
||||
uriTemplate: '/students/image-rights/export',
|
||||
provider: ImageRightsExportProvider::class,
|
||||
name: 'export_students_image_rights',
|
||||
),
|
||||
new Patch(
|
||||
uriTemplate: '/students/{id}/image-rights',
|
||||
provider: ImageRightsItemProvider::class,
|
||||
processor: UpdateImageRightsProcessor::class,
|
||||
name: 'update_student_image_rights',
|
||||
),
|
||||
],
|
||||
)]
|
||||
final class ImageRightsResource
|
||||
{
|
||||
#[ApiProperty(identifier: true)]
|
||||
public ?string $id = null;
|
||||
|
||||
public ?string $firstName = null;
|
||||
|
||||
public ?string $lastName = null;
|
||||
|
||||
public ?string $email = null;
|
||||
|
||||
#[Assert\NotBlank(message: 'Le statut est requis.')]
|
||||
#[Assert\Choice(choices: ['authorized', 'refused', 'not_specified'], message: 'Statut invalide.')]
|
||||
public ?string $imageRightsStatus = null;
|
||||
|
||||
public ?string $imageRightsStatusLabel = null;
|
||||
|
||||
public ?DateTimeImmutable $imageRightsUpdatedAt = null;
|
||||
|
||||
public ?string $className = null;
|
||||
|
||||
public static function fromDto(StudentImageRightsDto $dto): self
|
||||
{
|
||||
$resource = new self();
|
||||
$resource->id = $dto->id;
|
||||
$resource->firstName = $dto->firstName;
|
||||
$resource->lastName = $dto->lastName;
|
||||
$resource->email = $dto->email;
|
||||
$resource->imageRightsStatus = $dto->imageRightsStatus;
|
||||
$resource->imageRightsStatusLabel = $dto->imageRightsStatusLabel;
|
||||
$resource->imageRightsUpdatedAt = $dto->imageRightsUpdatedAt;
|
||||
$resource->className = $dto->className;
|
||||
|
||||
return $resource;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user