Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
ottaviano committed Jan 30, 2025
1 parent cbde8af commit 5d824ce
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;

#[Route(path: '/v3/filters', name: 'app_collection_filters_get', methods: ['GET'])]
#[IsGranted(new Expression("is_granted('REQUEST_SCOPE_GRANTED', ['contacts', 'messages'])"))]
#[Route(path: '/v3/filters', name: 'app_collection_filters_get', methods: ['GET'])]
class GetCollectionFiltersController extends AbstractController
{
public function __construct(
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Api/Security/GetJWTTokenController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;

#[Route(path: '/v3/sso/jwt/{uuid}', name: 'api_security_get_jwt_token', methods: ['GET'])]
#[IsGranted(new Expression("is_granted('REQUEST_SCOPE_GRANTED', 'featurebase')"))]
#[Route(path: '/v3/sso/jwt/{uuid}', name: 'api_security_get_jwt_token', methods: ['GET'])]
class GetJWTTokenController extends AbstractController
{
public function __invoke(Client $client, JWTTokenGenerator $tokenGenerator): Response
Expand Down
9 changes: 9 additions & 0 deletions src/Entity/EntityIdentityTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,21 @@ trait EntityIdentityTrait
'adherent_message_update_filter',
'audience_list_read',
'audience_read',
'committee_candidacies_group:write',
'elected_representative_write',
'elected_mandate_write',
'event_write',
'event_write_creation',
'audience_segment_read',
'my_team_member_write',
'cause_read',
'committee:list',
'committee:update_animator',
'committee:read',
'committee_candidacies_group:read',
'committee_candidacy:read',
'jecoute_news_write',
'pap_campaign_history_write',
'committee_election:read',
'contact_read',
'contact_read_after_write',
Expand Down
2 changes: 1 addition & 1 deletion src/Entity/Event/BaseEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ abstract class BaseEvent implements ReportableInterface, GeoPointInterface, Addr
/**
* @var EventCategoryInterface|EventCategory|null
*/
#[Groups(['event_read', 'event_list_read', 'event_write'])]
#[Groups(['event_read', 'event_list_read', 'event_write', 'event_write_creation'])]
#[ORM\ManyToOne(targetEntity: EventCategory::class)]
protected $category;

Expand Down
2 changes: 1 addition & 1 deletion src/Entity/Event/BaseEventCategory.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ abstract class BaseEventCategory implements EventCategoryInterface
#[Assert\Length(max: 100)]
#[Assert\NotBlank]
#[Gedmo\Slug(fields: ['name'], unique: true)]
#[Groups(['event_read', 'event_list_read', 'event_category_read'])]
#[Groups(['event_read', 'event_list_read', 'event_category_read', 'event_write', 'event_write_creation'])]
#[ORM\Column(length: 100, unique: true)]
protected $slug;

Expand Down
13 changes: 13 additions & 0 deletions src/Entity/Event/EventCategory.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

namespace App\Entity\Event;

use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\GetCollection;
use App\Repository\EventCategoryRepository;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation\Slug;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Serializer\Attribute\Groups;
use Symfony\Component\Validator\Constraints as Assert;
Expand Down Expand Up @@ -34,6 +36,17 @@ class EventCategory extends BaseEventCategory
#[ORM\ManyToOne(targetEntity: EventGroupCategory::class, inversedBy: 'eventCategories')]
private $eventGroupCategory;

/**
* @var string|null
*/
#[ApiProperty(identifier: true)]
#[Assert\Length(max: 100)]
#[Assert\NotBlank]
#[Groups(['event_read', 'event_list_read', 'event_category_read', 'event_write', 'event_write_creation'])]
#[ORM\Column(length: 100, unique: true)]
#[Slug(fields: ['name'], unique: true)]
protected $slug;

public function getEventGroupCategory(): ?EventGroupCategory
{
return $this->eventGroupCategory;
Expand Down

0 comments on commit 5d824ce

Please sign in to comment.