Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions api/rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use Rector\Privatization\Rector\Class_\FinalizeTestCaseClassRector;
use Rector\Renaming\Rector\FuncCall\RenameFunctionRector;
use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector;
use Rector\Symfony\Symfony73\Rector\Class_\ConstraintOptionsToNamedArgumentsRector;
use Rector\TypeDeclaration\Rector\StmtsAwareInterface\DeclareStrictTypesRector;

// @noinspection PhpUnhandledExceptionInspection
Expand All @@ -42,6 +43,7 @@
AddInstanceofAssertForNullableInstanceRector::class,
AssertEmptyNullableObjectToAssertInstanceofRector::class,
CombineIfRector::class,
ConstraintOptionsToNamedArgumentsRector::class,
DeclareStrictTypesRector::class,
DisallowedEmptyRuleFixerRector::class,
ExplicitBoolCompareRector::class,
Expand Down
35 changes: 18 additions & 17 deletions api/src/DTO/Invitation.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,35 +21,36 @@
#[ApiResource(
operations: [
new Get(
provider: InvitationProvider::class,
uriTemplate: '/invitations/{inviteKey}/find{._format}', // TO DISCUSS: Wouldn't '/{inviteKey}{._format}' be more REST-like
// TO DISCUSS: Wouldn't '/{inviteKey}{._format}' be more REST-like
uriTemplate: '/invitations/{inviteKey}/find{._format}',
openapi: new OpenApiOperation(description: 'Use myInviteKey to find an invitation in the dev environment.'),
normalizationContext: self::ITEM_NORMALIZATION_CONTEXT,
openapi: new OpenApiOperation(description: 'Use myInviteKey to find an invitation in the dev environment.')
provider: InvitationProvider::class
),
new Patch(
provider: InvitationProvider::class,
processor: InvitationAcceptProcessor::class,
output: Invitation::class,
security: 'is_authenticated()',
uriTemplate: '/invitations/{inviteKey}/'.self::ACCEPT.'{._format}',
denormalizationContext: ['groups' => ['write']],
normalizationContext: self::ITEM_NORMALIZATION_CONTEXT,
openapi: new OpenApiOperation(summary: 'Accept an Invitation.', description: 'Use myInviteKey2 to accept an invitation in dev environment.'),
validationContext: ['groups' => ['Default', 'accept']]
normalizationContext: self::ITEM_NORMALIZATION_CONTEXT,
denormalizationContext: ['groups' => ['write']],
security: 'is_authenticated()',
validationContext: ['groups' => ['Default', 'accept']],
output: Invitation::class,
provider: InvitationProvider::class,
processor: InvitationAcceptProcessor::class
),
new Patch(
provider: InvitationProvider::class,
processor: InvitationRejectProcessor::class,
output: Invitation::class,
uriTemplate: '/invitations/{inviteKey}/'.self::REJECT.'{._format}',
denormalizationContext: ['groups' => ['write']],
openapi: new OpenApiOperation(summary: 'Reject an Invitation.', description: 'Use myInviteKey to reject an invitation in dev environment.'),
normalizationContext: self::ITEM_NORMALIZATION_CONTEXT,
openapi: new OpenApiOperation(summary: 'Reject an Invitation.', description: 'Use myInviteKey to reject an invitation in dev environment.')
denormalizationContext: ['groups' => ['write']],
output: Invitation::class,
provider: InvitationProvider::class,
processor: InvitationRejectProcessor::class
),
new GetCollection(
provider: InvitationProvider::class,
openapi: false,
security: 'false',
openapi: false
provider: InvitationProvider::class
),
],
)]
Expand Down
18 changes: 9 additions & 9 deletions api/src/DTO/ResetPassword.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,26 @@
#[ApiResource(
operations: [
new Get(
provider: ResetPasswordProvider::class,
uriTemplate: '/reset_password/{id}{._format}', // TO DISCUSS: default uri would be /reset_password (plural). Shall we keep or fix?
security: 'true',
provider: ResetPasswordProvider::class,
),
new Patch(
provider: ResetPasswordProvider::class,
processor: ResetPasswordUpdateProcessor::class,
uriTemplate: '/reset_password/{id}{._format}',
denormalizationContext: ['groups' => ['update']],
security: 'true',
denormalizationContext: ['groups' => ['update']]
provider: ResetPasswordProvider::class,
processor: ResetPasswordUpdateProcessor::class
),
new Post(
processor: ResetPasswordCreateProcessor::class,
uriTemplate: '/reset_password{._format}',
security: 'true',
status: 204,
output: false,
denormalizationContext: ['groups' => ['create']],
openapi: new OpenApiOperation(summary: 'Request Password-Reset-Mail', description: 'Password-Reset-Link will be sent to the given email'),
normalizationContext: ['groups' => ['read']],
openapi: new OpenApiOperation(summary: 'Request Password-Reset-Mail', description: 'Password-Reset-Link will be sent to the given email')
denormalizationContext: ['groups' => ['create']],
security: 'true',
output: false,
processor: ResetPasswordCreateProcessor::class
),
],
routePrefix: '/auth'
Expand Down
8 changes: 4 additions & 4 deletions api/src/DTO/UserActivation.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
#[ApiResource(
operations: [
new Post(
processor: ResendActivationProcessor::class,
uriTemplate: '/resend_activation{._format}',
security: 'true',
status: 204,
output: false,
openapi: new OpenApiOperation(summary: 'Request activation email again', description: 'Activation email will be sent to the given email again.'),
denormalizationContext: ['groups' => ['create']],
openapi: new OpenApiOperation(summary: 'Request activation email again', description: 'Activation email will be sent to the given email again.')
security: 'true',
output: false,
processor: ResendActivationProcessor::class
),
],
routePrefix: '/auth'
Expand Down
4 changes: 2 additions & 2 deletions api/src/DTO/ValidationError.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ public function __construct(
private readonly string $type = 'about:blank',
) {
parent::__construct(
type: $this->type,
title: $this->title,
status: $this->status,
detail: $this->detail,
status: $this->status,
instance: $this->instance,
type: $this->type,
);
}

Expand Down
12 changes: 6 additions & 6 deletions api/src/Entity/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
validationContext: ['groups' => ['Default', 'update']]
),
new Delete(
processor: ActivityRemoveProcessor::class,
security: 'is_granted("CAMP_MEMBER", object) or is_granted("CAMP_MANAGER", object)'
security: 'is_granted("CAMP_MEMBER", object) or is_granted("CAMP_MANAGER", object)',
processor: ActivityRemoveProcessor::class
),
new GetCollection(
normalizationContext: self::COLLECTION_NORMALIZATION_CONTEXT,
Expand All @@ -65,11 +65,11 @@
]
),
new Post(
processor: ActivityCreateProcessor::class,
validationContext: ['groups' => ['Default', 'create']],
denormalizationContext: ['groups' => ['write', 'create']],
normalizationContext: self::ITEM_NORMALIZATION_CONTEXT,
securityPostDenormalize: 'is_granted("CAMP_MEMBER", object) or is_granted("CAMP_MANAGER", object) or object.category === null'
denormalizationContext: ['groups' => ['write', 'create']],
securityPostDenormalize: 'is_granted("CAMP_MEMBER", object) or is_granted("CAMP_MANAGER", object) or object.category === null',
validationContext: ['groups' => ['Default', 'create']],
processor: ActivityCreateProcessor::class
),
],
denormalizationContext: ['groups' => ['write']],
Expand Down
10 changes: 5 additions & 5 deletions api/src/Entity/ActivityProgressLabel.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
validationContext: ['groups' => ['Default', 'update']]
),
new Delete(
validate: true,
security: 'is_granted("CAMP_MANAGER", object)',
validationContext: ['groups' => ['delete']],
security: 'is_granted("CAMP_MANAGER", object)'
validate: true
),
new GetCollection(
security: 'is_authenticated()'
Expand All @@ -61,10 +61,10 @@
]
),
new Post(
validationContext: ['groups' => ['Default', 'create']],
denormalizationContext: ['groups' => ['write', 'create']],
normalizationContext: self::ITEM_NORMALIZATION_CONTEXT,
securityPostDenormalize: 'is_granted("CAMP_MANAGER", object) or object.camp === null'
denormalizationContext: ['groups' => ['write', 'create']],
securityPostDenormalize: 'is_granted("CAMP_MANAGER", object) or object.camp === null',
validationContext: ['groups' => ['Default', 'create']]
),
],
denormalizationContext: ['groups' => ['write']],
Expand Down
16 changes: 8 additions & 8 deletions api/src/Entity/Camp.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,29 @@
#[ApiResource(
operations: [
new Get(
normalizationContext: self::ITEM_NORMALIZATION_CONTEXT,
security: 'is_granted("CAMP_COLLABORATOR", object) or
is_granted("CAMP_IS_PUBLIC", object)',
normalizationContext: self::ITEM_NORMALIZATION_CONTEXT,
),
new Patch(
processor: CampUpdateProcessor::class,
security: 'is_granted("CAMP_MEMBER", object) or is_granted("CAMP_MANAGER", object)',
denormalizationContext: ['groups' => ['write', 'update']],
normalizationContext: self::ITEM_NORMALIZATION_CONTEXT,
denormalizationContext: ['groups' => ['write', 'update']],
security: 'is_granted("CAMP_MEMBER", object) or is_granted("CAMP_MANAGER", object)',
processor: CampUpdateProcessor::class,
),
new Delete(
processor: CampRemoveProcessor::class,
security: 'is_granted("CAMP_MANAGER", object)',
processor: CampRemoveProcessor::class,
),
new GetCollection(
security: 'is_authenticated()'
),
new Post(
processor: CampCreateProcessor::class,
normalizationContext: self::ITEM_NORMALIZATION_CONTEXT,
denormalizationContext: ['groups' => ['write', 'create']],
security: 'is_authenticated()',
validationContext: ['groups' => ['Default', 'create', 'Camp:create']],
denormalizationContext: ['groups' => ['write', 'create']],
normalizationContext: self::ITEM_NORMALIZATION_CONTEXT,
processor: CampCreateProcessor::class,
),
],
denormalizationContext: ['groups' => ['write']],
Expand Down
34 changes: 17 additions & 17 deletions api/src/Entity/CampCollaboration.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,28 +38,28 @@
security: 'is_granted("CAMP_COLLABORATOR", object) or is_granted("CAMP_IS_PUBLIC", object)'
),
new Patch(
processor: CampCollaborationUpdateProcessor::class,
denormalizationContext: ['groups' => ['write', 'update']],
normalizationContext: self::ITEM_NORMALIZATION_CONTEXT,
denormalizationContext: ['groups' => ['write', 'update']],
security: '(is_authenticated() && user === object.user) or is_granted("CAMP_MEMBER", object) or is_granted("CAMP_MANAGER", object)',
validationContext: ['groups' => ['Default', 'update']]
validationContext: ['groups' => ['Default', 'update']],
processor: CampCollaborationUpdateProcessor::class
),
new Delete(
validate: true,
security: 'is_granted("CAMP_MEMBER", object) or is_granted("CAMP_MANAGER", object)',
validationContext: ['groups' => ['delete']],
security: 'is_granted("CAMP_MEMBER", object) or is_granted("CAMP_MANAGER", object)'
validate: true
),
new Patch(
processor: CampCollaborationResendInvitationProcessor::class,
security: '(is_authenticated() && user === object.user) or is_granted("CAMP_MEMBER", object) or is_granted("CAMP_MANAGER", object)',
uriTemplate: 'camp_collaborations/{id}/'.self::RESEND_INVITATION,
denormalizationContext: ['groups' => ['resend_invitation']],
openapi: new OpenApiOperation(summary: 'Send the invitation email for this CampCollaboration again. Only possible, if the status is already invited.'),
validationContext: ['groups' => ['Default', 'resend_invitation']]
denormalizationContext: ['groups' => ['resend_invitation']],
security: '(is_authenticated() && user === object.user) or is_granted("CAMP_MEMBER", object) or is_granted("CAMP_MANAGER", object)',
validationContext: ['groups' => ['Default', 'resend_invitation']],
processor: CampCollaborationResendInvitationProcessor::class
),
new GetCollection(
security: 'is_fully_authenticated()',
normalizationContext: self::COLLECTION_NORMALIZATION_CONTEXT
normalizationContext: self::COLLECTION_NORMALIZATION_CONTEXT,
security: 'is_fully_authenticated()'
),
new GetCollection(
uriTemplate: self::CAMP_SUBRESOURCE_URI_TEMPLATE,
Expand All @@ -71,15 +71,15 @@
is_granted("CAMP_IS_PUBLIC", camp)'
),
],
security: 'is_fully_authenticated()',
normalizationContext: self::COLLECTION_NORMALIZATION_CONTEXT
normalizationContext: self::COLLECTION_NORMALIZATION_CONTEXT,
security: 'is_fully_authenticated()'
),
new Post(
processor: CampCollaborationCreateProcessor::class,
denormalizationContext: ['groups' => ['write', 'create']],
normalizationContext: self::ITEM_NORMALIZATION_CONTEXT,
openapi: new OpenApiOperation(description: 'Also sends an invitation email to the inviteEmail address, if specified.'),
securityPostDenormalize: 'is_granted("CAMP_MEMBER", object) or is_granted("CAMP_MANAGER", object) or object.camp === null'
normalizationContext: self::ITEM_NORMALIZATION_CONTEXT,
denormalizationContext: ['groups' => ['write', 'create']],
securityPostDenormalize: 'is_granted("CAMP_MEMBER", object) or is_granted("CAMP_MANAGER", object) or object.camp === null',
processor: CampCollaborationCreateProcessor::class
),
],
denormalizationContext: ['groups' => ['write']],
Expand Down
16 changes: 8 additions & 8 deletions api/src/Entity/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,39 +39,39 @@
is_granted("CAMP_IS_PUBLIC", object)'
),
new Patch(
denormalizationContext: ['groups' => ['write', 'update']],
normalizationContext: self::ITEM_NORMALIZATION_CONTEXT,
denormalizationContext: ['groups' => ['write', 'update']],
security: 'is_granted("CAMP_MEMBER", object) or is_granted("CAMP_MANAGER", object)'
),
new Delete(
processor: CategoryRemoveProcessor::class,
security: 'is_granted("CAMP_MEMBER", object) or is_granted("CAMP_MANAGER", object)',
validate: true,
validationContext: ['groups' => ['delete']],
validate: true,
processor: CategoryRemoveProcessor::class,
),
new GetCollection(
security: 'is_authenticated()'
),
new Post(
processor: CategoryCreateProcessor::class,
denormalizationContext: ['groups' => ['write', 'create']],
normalizationContext: self::ITEM_NORMALIZATION_CONTEXT,
securityPostDenormalize: 'is_granted("CAMP_MEMBER", object) or is_granted("CAMP_MANAGER", object) or object.camp === null'
denormalizationContext: ['groups' => ['write', 'create']],
securityPostDenormalize: 'is_granted("CAMP_MEMBER", object) or is_granted("CAMP_MANAGER", object) or object.camp === null',
processor: CategoryCreateProcessor::class
),
new GetCollection(
uriTemplate: self::CAMP_SUBRESOURCE_URI_TEMPLATE,
uriVariables: [
'campId' => new Link(
fromClass: Camp::class,
toProperty: 'camp',
fromClass: Camp::class,
security: 'is_granted("CAMP_COLLABORATOR", camp) or
is_granted("CAMP_IS_PUBLIC", camp)'
),
],
normalizationContext: self::COLLECTION_NORMALIZATION_CONTEXT,
extraProperties: [
'filter_by_current_user' => false,
],
normalizationContext: self::COLLECTION_NORMALIZATION_CONTEXT,
),
],
denormalizationContext: ['groups' => ['write']],
Expand Down
6 changes: 3 additions & 3 deletions api/src/Entity/Checklist.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,18 @@
security: '(is_granted("CHECKLIST_IS_PROTOTYPE", object) and is_granted("ROLE_ADMIN")) or
(is_granted("CAMP_MEMBER", object) or is_granted("CAMP_MANAGER", object))
',
validate: true,
validationContext: ['groups' => ['delete']],
validate: true,
),
new GetCollection(
security: 'is_authenticated()'
),
new Post(
processor: ChecklistCreateProcessor::class,
denormalizationContext: ['groups' => ['write', 'create']],
securityPostDenormalize: '(is_granted("CHECKLIST_IS_PROTOTYPE", object) and is_granted("ROLE_ADMIN")) or
(!is_granted("CHECKLIST_IS_PROTOTYPE", object) and (is_granted("CAMP_MEMBER", object) or is_granted("CAMP_MANAGER", object) or object.camp === null))
'
',
processor: ChecklistCreateProcessor::class
),
new GetCollection(
uriTemplate: self::CAMP_SUBRESOURCE_URI_TEMPLATE,
Expand Down
4 changes: 2 additions & 2 deletions api/src/Entity/ChecklistItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
new Delete(
security: '(is_granted("CHECKLIST_IS_PROTOTYPE", object) and is_granted("ROLE_ADMIN")) or
(is_granted("CAMP_MEMBER", object) or is_granted("CAMP_MANAGER", object))',
validate: true,
validationContext: ['groups' => ['delete']],
validate: true,
),
new GetCollection(
security: 'is_authenticated()',
Expand All @@ -63,8 +63,8 @@
uriTemplate: self::CHECKLIST_SUBRESOURCE_URI_TEMPLATE,
uriVariables: [
'checklistId' => new Link(
fromClass: Checklist::class,
toProperty: 'checklist',
fromClass: Checklist::class,
security: 'is_granted("CHECKLIST_IS_PROTOTYPE", checklist) or
is_granted("CAMP_IS_PUBLIC", checklist) or
is_granted("CAMP_COLLABORATOR", checklist)'
Expand Down
2 changes: 1 addition & 1 deletion api/src/Entity/Comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
security: 'is_authenticated()'
),
new Post(
processor: CommentCreateProcessor::class,
denormalizationContext: ['groups' => ['create', 'write']],
securityPostDenormalize: 'is_granted("CAMP_COLLABORATOR", object)',
processor: CommentCreateProcessor::class,
),
new GetCollection(
uriTemplate: self::ACTIVITY_SUBRESOURCE_URI_TEMPLATE,
Expand Down
Loading