Skip to content

Commit b2d65bf

Browse files
eceltovkrulis-martin
authored andcommitted
added private data format
1 parent c915b58 commit b2d65bf

File tree

3 files changed

+77
-7
lines changed

3 files changed

+77
-7
lines changed

app/helpers/MetaFormats/FormatDefinitions/GroupFormat.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,11 @@
99
use App\Helpers\MetaFormats\Validators\VBool;
1010
use App\Helpers\MetaFormats\Validators\VEmail;
1111
use App\Helpers\MetaFormats\Validators\VMixed;
12+
use App\Helpers\MetaFormats\Validators\VObject;
1213
use App\Helpers\MetaFormats\Validators\VString;
1314
use App\Helpers\MetaFormats\Validators\VUuid;
1415
use ArrayAccess;
1516

16-
/**
17-
* Format definition used by the RegistrationPresenter::actionCreateInvitation endpoint.
18-
*/
1917
#[Format(GroupFormat::class)]
2018
class GroupFormat extends MetaFormat// implements ArrayAccess
2119
{
@@ -68,10 +66,10 @@ class GroupFormat extends MetaFormat// implements ArrayAccess
6866
#[FPost(new VArray(new VUuid()), "Identifications of child groups.")]
6967
public ?array $childGroups;
7068

71-
#[FPost(new VMixed(), "")]
72-
public mixed $privateData;
69+
#[FPost(new VObject(GroupPrivateDataFormat::class), required: false)]
70+
public ?GroupPrivateDataFormat $privateData;
7371

74-
#[FPost(new VArray(), "")]
72+
#[FPost(new VArray())]
7573
public ?array $permissionHints;
7674

7775

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?php
2+
3+
namespace App\Helpers\MetaFormats\FormatDefinitions;
4+
5+
use App\Helpers\MetaFormats\Attributes\Format;
6+
use App\Helpers\MetaFormats\MetaFormat;
7+
use App\Helpers\MetaFormats\Attributes\FPost;
8+
use App\Helpers\MetaFormats\Validators\VArray;
9+
use App\Helpers\MetaFormats\Validators\VBool;
10+
use App\Helpers\MetaFormats\Validators\VDouble;
11+
use App\Helpers\MetaFormats\Validators\VEmail;
12+
use App\Helpers\MetaFormats\Validators\VInt;
13+
use App\Helpers\MetaFormats\Validators\VMixed;
14+
use App\Helpers\MetaFormats\Validators\VString;
15+
use App\Helpers\MetaFormats\Validators\VTimestamp;
16+
use App\Helpers\MetaFormats\Validators\VUuid;
17+
use ArrayAccess;
18+
19+
#[Format(GroupPrivateDataFormat::class)]
20+
class GroupPrivateDataFormat extends MetaFormat
21+
{
22+
#[FPost(new VArray(new VUuid()), "IDs of all users that have admin privileges to this group (including inherited)")]
23+
public array $admins;
24+
25+
#[FPost(new VArray(new VUuid()))]
26+
public array $supervisors;
27+
28+
#[FPost(new VArray(new VUuid()))]
29+
public array $observers;
30+
31+
#[FPost(new VArray(new VUuid()))]
32+
public array $students;
33+
34+
#[FPost(new VUuid(), required: false)]
35+
public string $instanceId;
36+
37+
#[FPost(new VBool())]
38+
public bool $hasValidLicence;
39+
40+
#[FPost(new VArray(new VUuid()))]
41+
public array $assignments;
42+
43+
#[FPost(new VArray(new VUuid()))]
44+
public array $shadowAssignments;
45+
46+
#[FPost(new VBool())]
47+
public bool $publicStats;
48+
49+
#[FPost(new VBool())]
50+
public bool $detaining;
51+
52+
#[FPost(new VDouble(), required: false)]
53+
public ?float $threshold;
54+
55+
#[FPost(new VInt(), required: false)]
56+
public ?int $pointsLimit;
57+
58+
#[FPost(new VArray())]
59+
public array $bindings;
60+
61+
#[FPost(new VTimestamp(), required: false)]
62+
public ?int $examBegin;
63+
64+
#[FPost(new VTimestamp(), required: false)]
65+
public ?int $examEnd;
66+
67+
#[FPost(new VBool(), required: false)]
68+
public ?bool $examLockStrict;
69+
70+
#[FPost(new VArray())]
71+
public array $exams;
72+
}

docs/swagger.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2341,7 +2341,7 @@ paths:
23412341
properties:
23422342
success: { description: '', type: boolean, example: 'true', nullable: false }
23432343
code: { description: '', type: integer, example: '0', nullable: false }
2344-
payload: { description: '', properties: { id: { description: 'An identifier of the group', type: string, pattern: '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$', example: 10000000-2000-4000-8000-160000000000, nullable: false }, externalId: { description: 'An informative, human readable identifier of the group', type: string, example: text, nullable: true }, organizational: { description: 'Whether the group is organizational (no assignments nor students).', type: boolean, example: 'true', nullable: false }, exam: { description: 'Whether the group is an exam group.', type: boolean, example: 'true', nullable: false }, archived: { description: 'Whether the group is archived', type: boolean, example: 'true', nullable: false }, public: { description: 'Should the group be visible to all student?', type: boolean, example: 'true', nullable: false }, directlyArchived: { description: 'Whether the group was explicitly marked as archived', type: boolean, example: 'true', nullable: false }, localizedTexts: { description: 'Localized names and descriptions', type: array, items: { }, nullable: false }, primaryAdminsIds: { description: 'IDs of users which are explicitly listed as direct admins of this group', type: array, items: { type: string, pattern: '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$', example: 10000000-2000-4000-8000-160000000000 }, nullable: false }, parentGroupId: { description: 'Identifier of the parent group (absent for a top-level group)', type: string, pattern: '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$', example: 10000000-2000-4000-8000-160000000000, nullable: false }, parentGroupsIds: { description: 'Identifications of groups in descending order.', type: array, items: { type: string, pattern: '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$', example: 10000000-2000-4000-8000-160000000000 }, nullable: false }, childGroups: { description: 'Identifications of child groups.', type: array, items: { type: string, pattern: '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$', example: 10000000-2000-4000-8000-160000000000 }, nullable: false }, privateData: { description: '', type: string, nullable: false }, permissionHints: { description: '', type: array, items: { }, nullable: false } }, type: object, nullable: false }
2344+
payload: { description: '', properties: { id: { description: 'An identifier of the group', type: string, pattern: '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$', example: 10000000-2000-4000-8000-160000000000, nullable: false }, externalId: { description: 'An informative, human readable identifier of the group', type: string, example: text, nullable: true }, organizational: { description: 'Whether the group is organizational (no assignments nor students).', type: boolean, example: 'true', nullable: false }, exam: { description: 'Whether the group is an exam group.', type: boolean, example: 'true', nullable: false }, archived: { description: 'Whether the group is archived', type: boolean, example: 'true', nullable: false }, public: { description: 'Should the group be visible to all student?', type: boolean, example: 'true', nullable: false }, directlyArchived: { description: 'Whether the group was explicitly marked as archived', type: boolean, example: 'true', nullable: false }, localizedTexts: { description: 'Localized names and descriptions', type: array, items: { }, nullable: false }, primaryAdminsIds: { description: 'IDs of users which are explicitly listed as direct admins of this group', type: array, items: { type: string, pattern: '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$', example: 10000000-2000-4000-8000-160000000000 }, nullable: false }, parentGroupId: { description: 'Identifier of the parent group (absent for a top-level group)', type: string, pattern: '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$', example: 10000000-2000-4000-8000-160000000000, nullable: false }, parentGroupsIds: { description: 'Identifications of groups in descending order.', type: array, items: { type: string, pattern: '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$', example: 10000000-2000-4000-8000-160000000000 }, nullable: false }, childGroups: { description: 'Identifications of child groups.', type: array, items: { type: string, pattern: '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$', example: 10000000-2000-4000-8000-160000000000 }, nullable: false }, privateData: { description: '', properties: { admins: { description: 'IDs of all users that have admin privileges to this group (including inherited)', type: array, items: { type: string, pattern: '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$', example: 10000000-2000-4000-8000-160000000000 }, nullable: false }, supervisors: { description: '', type: array, items: { type: string, pattern: '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$', example: 10000000-2000-4000-8000-160000000000 }, nullable: false }, observers: { description: '', type: array, items: { type: string, pattern: '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$', example: 10000000-2000-4000-8000-160000000000 }, nullable: false }, students: { description: '', type: array, items: { type: string, pattern: '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$', example: 10000000-2000-4000-8000-160000000000 }, nullable: false }, instanceId: { description: '', type: string, pattern: '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$', example: 10000000-2000-4000-8000-160000000000, nullable: false }, hasValidLicence: { description: '', type: boolean, example: 'true', nullable: false }, assignments: { description: '', type: array, items: { type: string, pattern: '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$', example: 10000000-2000-4000-8000-160000000000 }, nullable: false }, shadowAssignments: { description: '', type: array, items: { type: string, pattern: '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$', example: 10000000-2000-4000-8000-160000000000 }, nullable: false }, publicStats: { description: '', type: boolean, example: 'true', nullable: false }, detaining: { description: '', type: boolean, example: 'true', nullable: false }, threshold: { description: '', type: number, example: '0.1', nullable: false }, pointsLimit: { description: '', type: integer, example: '0', nullable: false }, bindings: { description: '', type: array, items: { }, nullable: false }, examBegin: { description: '', type: integer, example: '1740135333', nullable: false }, examEnd: { description: '', type: integer, example: '1740135333', nullable: false }, examLockStrict: { description: '', type: boolean, example: 'true', nullable: false }, exams: { description: '', type: array, items: { }, nullable: false } }, type: object, nullable: false }, permissionHints: { description: '', type: array, items: { }, nullable: false } }, type: object, nullable: false }
23452345
type: object
23462346
delete:
23472347
summary: 'Delete a group'

0 commit comments

Comments
 (0)