|
32 | 32 | #[ApiResource( |
33 | 33 | operations: [ |
34 | 34 | new Get( |
35 | | - security: 'is_granted("CAMP_COLLABORATOR", object) or is_granted("CAMP_IS_PROTOTYPE", object)', |
| 35 | + security: 'is_granted("CAMP_COLLABORATOR", object) or |
| 36 | + is_granted("CAMP_IS_SHARED", object) or |
| 37 | + is_granted("CAMP_IS_PROTOTYPE", object)', |
36 | 38 | normalizationContext: self::ITEM_NORMALIZATION_CONTEXT, |
37 | 39 | ), |
38 | 40 | new Patch( |
@@ -68,6 +70,7 @@ class Camp extends BaseEntity implements BelongsToCampInterface, CopyFromPrototy |
68 | 70 | 'swagger_definition_name' => 'read', |
69 | 71 | ]; |
70 | 72 |
|
| 73 | + #[ApiProperty(security: 'is_granted("CAMP_COLLABORATOR", object)')] |
71 | 74 | #[AssertContainsAtLeastOneManager(groups: ['update'])] |
72 | 75 | #[SerializedName('campCollaborations')] |
73 | 76 | #[Groups(['read'])] |
@@ -181,6 +184,17 @@ class Camp extends BaseEntity implements BelongsToCampInterface, CopyFromPrototy |
181 | 184 | #[Groups(['create'])] |
182 | 185 | public ?Camp $campPrototype = null; |
183 | 186 |
|
| 187 | + /** |
| 188 | + * Whether the programme of this camp is publicly available to anyone who knows its |
| 189 | + * URI (excluding collaboration-based data such as camp collaborations, personal |
| 190 | + * material lists, responsibilities and comments). |
| 191 | + */ |
| 192 | + #[Assert\Type('bool')] |
| 193 | + #[ApiProperty(example: true)] |
| 194 | + #[Groups(['read', 'write'])] |
| 195 | + #[ORM\Column(type: 'boolean', nullable: false, options: ['default' => false])] |
| 196 | + public bool $isShared = false; |
| 197 | + |
184 | 198 | /** |
185 | 199 | * Whether this camp may serve as a template for creating other camps. |
186 | 200 | */ |
@@ -453,7 +467,7 @@ public function getCampCollaborations(): array { |
453 | 467 | * |
454 | 468 | * @return CampCollaboration[] |
455 | 469 | */ |
456 | | - #[ApiProperty(writable: false, readableLink: true)] |
| 470 | + #[ApiProperty(writable: false, readableLink: true, security: 'is_granted("CAMP_COLLABORATOR", object)')] |
457 | 471 | #[SerializedName('campCollaborations')] |
458 | 472 | #[Groups('Camp:CampCollaborations')] |
459 | 473 | public function getEmbeddedCampCollaborations(): array { |
|
0 commit comments