b61574bad2
Suite à la revue de sécurité : ROLE_ADMIN était trop strict (les ressources sœurs sont en ROLE_USER) mais ROLE_USER brut est trop permissif — ces endpoints listent TOUS les dépôts/étagères visibles par le token d'intégration global, sans filtrage par utilisateur. Comme ils ne sont consommés que par le ProjectDrawer (configuration du dépôt/étagère d'un projet), on les gate sur la permission métier project-management.projects.manage. Les admins conservent l'accès via le bypass ROLE_ADMIN du PermissionVoter.
32 lines
984 B
PHP
32 lines
984 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Module\Integration\Infrastructure\ApiPlatform\Resource;
|
|
|
|
use ApiPlatform\Metadata\ApiResource;
|
|
use ApiPlatform\Metadata\GetCollection;
|
|
use App\Module\Integration\Infrastructure\ApiPlatform\State\BookStackShelfProvider;
|
|
use Symfony\Component\Serializer\Attribute\Groups;
|
|
|
|
#[ApiResource(
|
|
operations: [
|
|
new GetCollection(
|
|
uriTemplate: '/bookstack/shelves',
|
|
normalizationContext: ['groups' => ['bookstack_shelf:read']],
|
|
provider: BookStackShelfProvider::class,
|
|
// Liste toutes les étagères visibles par le token BookStack global :
|
|
// réservé à qui configure un projet (ProjectDrawer), pas à tout user.
|
|
security: "is_granted('project-management.projects.manage')",
|
|
),
|
|
],
|
|
)]
|
|
final class BookStackShelf
|
|
{
|
|
#[Groups(['bookstack_shelf:read'])]
|
|
public int $id = 0;
|
|
|
|
#[Groups(['bookstack_shelf:read'])]
|
|
public string $name = '';
|
|
}
|