fix(security) : add ROLE_USER security on all read endpoints
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -18,8 +18,8 @@ use Symfony\Component\Serializer\Attribute\Groups;
|
|||||||
|
|
||||||
#[ApiResource(
|
#[ApiResource(
|
||||||
operations: [
|
operations: [
|
||||||
new GetCollection(),
|
new GetCollection(security: "is_granted('ROLE_USER')"),
|
||||||
new Get(),
|
new Get(security: "is_granted('ROLE_USER')"),
|
||||||
new Post(security: "is_granted('ROLE_ADMIN')"),
|
new Post(security: "is_granted('ROLE_ADMIN')"),
|
||||||
new Patch(security: "is_granted('ROLE_ADMIN')"),
|
new Patch(security: "is_granted('ROLE_ADMIN')"),
|
||||||
new Delete(security: "is_granted('ROLE_ADMIN')"),
|
new Delete(security: "is_granted('ROLE_ADMIN')"),
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||||||
|
|
||||||
#[ApiResource(
|
#[ApiResource(
|
||||||
operations: [
|
operations: [
|
||||||
new GetCollection(),
|
new GetCollection(security: "is_granted('ROLE_USER')"),
|
||||||
new Get(),
|
new Get(security: "is_granted('ROLE_USER')"),
|
||||||
new Post(
|
new Post(
|
||||||
security: "is_granted('ROLE_ADMIN')",
|
security: "is_granted('ROLE_ADMIN')",
|
||||||
denormalizationContext: ['groups' => ['project:write', 'project:create']],
|
denormalizationContext: ['groups' => ['project:write', 'project:create']],
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ use Symfony\Component\Serializer\Attribute\Groups;
|
|||||||
|
|
||||||
#[ApiResource(
|
#[ApiResource(
|
||||||
operations: [
|
operations: [
|
||||||
new GetCollection(paginationEnabled: false),
|
new GetCollection(paginationEnabled: false, security: "is_granted('ROLE_USER')"),
|
||||||
new Get(),
|
new Get(security: "is_granted('ROLE_USER')"),
|
||||||
new Post(security: "is_granted('ROLE_ADMIN')", processor: TaskNumberProcessor::class),
|
new Post(security: "is_granted('ROLE_ADMIN')", processor: TaskNumberProcessor::class),
|
||||||
new Patch(security: "is_granted('ROLE_ADMIN')"),
|
new Patch(security: "is_granted('ROLE_ADMIN')"),
|
||||||
new Delete(security: "is_granted('ROLE_ADMIN')"),
|
new Delete(security: "is_granted('ROLE_ADMIN')"),
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ use Symfony\Component\Serializer\Attribute\Groups;
|
|||||||
|
|
||||||
#[ApiResource(
|
#[ApiResource(
|
||||||
operations: [
|
operations: [
|
||||||
new GetCollection(paginationEnabled: false),
|
new GetCollection(paginationEnabled: false, security: "is_granted('ROLE_USER')"),
|
||||||
new Get(),
|
new Get(security: "is_granted('ROLE_USER')"),
|
||||||
new Post(
|
new Post(
|
||||||
security: "is_granted('ROLE_ADMIN')",
|
security: "is_granted('ROLE_ADMIN')",
|
||||||
processor: TaskDocumentProcessor::class,
|
processor: TaskDocumentProcessor::class,
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ use Symfony\Component\Serializer\Attribute\Groups;
|
|||||||
|
|
||||||
#[ApiResource(
|
#[ApiResource(
|
||||||
operations: [
|
operations: [
|
||||||
new GetCollection(),
|
new GetCollection(security: "is_granted('ROLE_USER')"),
|
||||||
new Get(),
|
new Get(security: "is_granted('ROLE_USER')"),
|
||||||
new Post(security: "is_granted('ROLE_ADMIN')"),
|
new Post(security: "is_granted('ROLE_ADMIN')"),
|
||||||
new Patch(security: "is_granted('ROLE_ADMIN')"),
|
new Patch(security: "is_granted('ROLE_ADMIN')"),
|
||||||
new Delete(security: "is_granted('ROLE_ADMIN')"),
|
new Delete(security: "is_granted('ROLE_ADMIN')"),
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ use Symfony\Component\Serializer\Attribute\Groups;
|
|||||||
|
|
||||||
#[ApiResource(
|
#[ApiResource(
|
||||||
operations: [
|
operations: [
|
||||||
new GetCollection(),
|
new GetCollection(security: "is_granted('ROLE_USER')"),
|
||||||
new Get(),
|
new Get(security: "is_granted('ROLE_USER')"),
|
||||||
new Post(security: "is_granted('ROLE_ADMIN')"),
|
new Post(security: "is_granted('ROLE_ADMIN')"),
|
||||||
new Patch(security: "is_granted('ROLE_ADMIN')"),
|
new Patch(security: "is_granted('ROLE_ADMIN')"),
|
||||||
new Delete(security: "is_granted('ROLE_ADMIN')"),
|
new Delete(security: "is_granted('ROLE_ADMIN')"),
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ use Symfony\Component\Serializer\Attribute\Groups;
|
|||||||
|
|
||||||
#[ApiResource(
|
#[ApiResource(
|
||||||
operations: [
|
operations: [
|
||||||
new GetCollection(),
|
new GetCollection(security: "is_granted('ROLE_USER')"),
|
||||||
new Get(),
|
new Get(security: "is_granted('ROLE_USER')"),
|
||||||
new Post(security: "is_granted('ROLE_ADMIN')"),
|
new Post(security: "is_granted('ROLE_ADMIN')"),
|
||||||
new Patch(security: "is_granted('ROLE_ADMIN')"),
|
new Patch(security: "is_granted('ROLE_ADMIN')"),
|
||||||
new Delete(security: "is_granted('ROLE_ADMIN')"),
|
new Delete(security: "is_granted('ROLE_ADMIN')"),
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ use Symfony\Component\Serializer\Attribute\Groups;
|
|||||||
|
|
||||||
#[ApiResource(
|
#[ApiResource(
|
||||||
operations: [
|
operations: [
|
||||||
new GetCollection(),
|
new GetCollection(security: "is_granted('ROLE_USER')"),
|
||||||
new Get(),
|
new Get(security: "is_granted('ROLE_USER')"),
|
||||||
new Post(security: "is_granted('ROLE_ADMIN')"),
|
new Post(security: "is_granted('ROLE_ADMIN')"),
|
||||||
new Patch(security: "is_granted('ROLE_ADMIN')"),
|
new Patch(security: "is_granted('ROLE_ADMIN')"),
|
||||||
new Delete(security: "is_granted('ROLE_ADMIN')"),
|
new Delete(security: "is_granted('ROLE_ADMIN')"),
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ use Symfony\Component\Serializer\Attribute\Groups;
|
|||||||
|
|
||||||
#[ApiResource(
|
#[ApiResource(
|
||||||
operations: [
|
operations: [
|
||||||
new GetCollection(),
|
new GetCollection(security: "is_granted('ROLE_USER')"),
|
||||||
new Get(),
|
new Get(security: "is_granted('ROLE_USER')"),
|
||||||
new Post(security: "is_granted('ROLE_ADMIN')"),
|
new Post(security: "is_granted('ROLE_ADMIN')"),
|
||||||
new Patch(security: "is_granted('ROLE_ADMIN')"),
|
new Patch(security: "is_granted('ROLE_ADMIN')"),
|
||||||
new Delete(security: "is_granted('ROLE_ADMIN')"),
|
new Delete(security: "is_granted('ROLE_ADMIN')"),
|
||||||
|
|||||||
@@ -24,15 +24,16 @@ use Symfony\Component\Serializer\Attribute\Groups;
|
|||||||
|
|
||||||
#[ApiResource(
|
#[ApiResource(
|
||||||
operations: [
|
operations: [
|
||||||
new GetCollection(),
|
new GetCollection(security: "is_granted('ROLE_USER')"),
|
||||||
new GetCollection(
|
new GetCollection(
|
||||||
name: 'active_time_entry',
|
name: 'active_time_entry',
|
||||||
uriTemplate: '/time_entries/active',
|
uriTemplate: '/time_entries/active',
|
||||||
provider: ActiveTimeEntryProvider::class,
|
provider: ActiveTimeEntryProvider::class,
|
||||||
description: 'Get the active timer for the current user',
|
description: 'Get the active timer for the current user',
|
||||||
paginationEnabled: false,
|
paginationEnabled: false,
|
||||||
|
security: "is_granted('ROLE_USER')",
|
||||||
),
|
),
|
||||||
new Get(),
|
new Get(security: "is_granted('ROLE_USER')"),
|
||||||
new Post(security: "is_granted('ROLE_USER')"),
|
new Post(security: "is_granted('ROLE_USER')"),
|
||||||
new Patch(security: "is_granted('ROLE_ADMIN') or object.getUser() == user"),
|
new Patch(security: "is_granted('ROLE_ADMIN') or object.getUser() == user"),
|
||||||
new Delete(security: "is_granted('ROLE_ADMIN') or object.getUser() == user"),
|
new Delete(security: "is_granted('ROLE_ADMIN') or object.getUser() == user"),
|
||||||
|
|||||||
Reference in New Issue
Block a user