|
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( |
|
62 | 64 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['isPrototype'])] |
63 | 65 | #[ORM\Entity(repositoryClass: CampRepository::class)] |
64 | 66 | #[ORM\Index(columns: ['isPrototype'])] |
| 67 | +#[ORM\Index(columns: ['isShared'])] |
| 68 | +#[ORM\Index(columns: ['updateTime'])] // TODO unclear why this is necessary, but doctrine forgot about this index from BaseEntity... |
65 | 69 | class Camp extends BaseEntity implements BelongsToCampInterface, CopyFromPrototypeInterface { |
66 | 70 | public const ITEM_NORMALIZATION_CONTEXT = [ |
67 | 71 | 'groups' => ['read', 'Camp:Periods', 'Period:Days', 'Camp:CampCollaborations', 'CampCollaboration:User'], |
@@ -181,6 +185,17 @@ class Camp extends BaseEntity implements BelongsToCampInterface, CopyFromPrototy |
181 | 185 | #[Groups(['create'])] |
182 | 186 | public ?Camp $campPrototype = null; |
183 | 187 |
|
| 188 | + /** |
| 189 | + * Whether the programme of this camp is publicly available to anyone (except for |
| 190 | + * personal data such as camp collaborations, personal material lists, |
| 191 | + * responsibilities and comments). |
| 192 | + */ |
| 193 | + #[Assert\Type('bool')] |
| 194 | + #[ApiProperty(example: true)] |
| 195 | + #[Groups(['read', 'write'])] |
| 196 | + #[ORM\Column(type: 'boolean', nullable: false, options: ['default' => false])] |
| 197 | + public bool $isShared = false; |
| 198 | + |
184 | 199 | /** |
185 | 200 | * Whether this camp may serve as a template for creating other camps. |
186 | 201 | */ |
|
0 commit comments