Repository navigation
Expand file tree
/
Copy pathopenapi.yaml
More file actions
8002 lines (7672 loc) · 278 KB
/
Copy pathopenapi.yaml
File metadata and controls
8002 lines (7672 loc) · 278 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: "3.1.0"
# Copyright 2026 Chronos Ledger Contributors
# Licensed under the Apache License, Version 2.0
#
# This is the authoritative static OpenAPI contract for Chronos Ledger.
# FastAPI also generates a live version at runtime: GET /openapi.json, but
# only where DOCS_ENABLED allows it, which it does not under APP_ENV=production.
# The two should remain in sync. Update this file when adding or changing endpoints.
info:
title: Chronos Ledger API
version: "0.17.0" # x-release-please-version
description: |
Organization Schedule & Attendance Management REST API.
**Authentication**: All endpoints except `/config`, `/auth/login` and
`/guest/visit/{code}` require a Bearer JWT in the `Authorization` header. An API key in
`X-API-Key` is accepted in place of one anywhere, which is how a lobby
terminal with no one to sign in reaches `/guest/register-checkin` and
`/guest/directory`. A key can be narrowed to part of the API and given
an end date: see the `ApiKeyAuth` security scheme.
**Roles**: `ORG_ADMIN` > `UNIT_ADMIN` > `STAFF` > `MEMBER`.
Role requirements are noted on each endpoint.
**Organizations**: every account belongs to one organization, and a
caller reads and writes only that organization's data. The organization
comes from the caller, never from the path or a header. A row in another
organization answers `404 NOT_FOUND`, the same as a row that does not
exist. A user id and an email address are unique across the whole
deployment; a resource code is unique within an organization.
contact:
name: Chronos Ledger Contributors
email: admin@org.internal
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0
servers:
- url: http://localhost
description: Local development (Docker Compose)
- url: http://{server_ip}
description: Organization intranet
variables:
server_ip:
default: "192.168.1.100"
# ─────────────────────────────────────────────
# Reusable components
# ─────────────────────────────────────────────
components:
securitySchemes:
BearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
ApiKeyAuth:
type: apiKey
in: header
name: X-API-Key
description: |
A machine credential bound to a service-account user. Accepted anywhere
a Bearer token is, and acts as the bound user, so roles and unit scoping
apply unchanged. This is how a lobby kiosk authenticates.
A key can also be narrowed and given an end date, which a Bearer token
cannot be. `scopes` is a comma separated list of `<area>:read` and
`<area>:write`, where the area is the path segment after `/api/v1`:
`schedule`, `resources`, `attendance`, `users`, `ingestion`, `guest`,
`sync`, `config`, `auth`, `api-keys`, `audit`, `changes`, `webhooks`. `GET`, `HEAD` and `OPTIONS` are
reads and everything else is a write, so `schedule:read` passes
`GET /schedule/slots` and is refused `POST /schedule/slots` with a 403
naming `schedule:write`. The single scope `*` is every area, which is
what a key issued before scopes existed holds and what a key created
without naming any gets. The one scope outside that grammar is
`impersonate`, which `*` does not include: see below.
A key holding `impersonate` may send `X-Chronos-Actor: <user id>` and
the request then runs as that person, so their role and unit scoping
apply, and the key's own scopes still apply on top. It only narrows:
what the request may do is what both the key and the named person may
do. The named person has to exist, be active and be in the key's
organization; unknown and other-organization ids get the same answer.
A Bearer token, or a key without the scope, that sends the header is
refused with 403 `IMPERSONATION_NOT_ALLOWED` and a named person who
cannot be acted for with 403 `IMPERSONATION_REFUSED`. The header is
never ignored. Rate limits and idempotency keys stay with the API key,
and the audit log records both the key's account and the person
named. See `ActingFor`.
`expires_at` is checked on the request, not by a sweep, so a key stops
working the moment it runs out and answers 401 `API key expired`. A
null expiry never runs out.
The first-login gate does not apply to a key. It holds an admin
account until the password it was handed is changed, and a key never
uses that password, so a service account at an admin role works
through its key without anyone signing in as it.
schemas:
# ── Enumerations ──────────────────────────
InstitutionalRole:
type: string
enum: [ORG_ADMIN, UNIT_ADMIN, STAFF, MEMBER]
description: Role assigned to a system user.
AccessReadiness:
type: string
enum: [OPEN_AD_HOC, BUSY, CRITICAL_DO_NOT_DISTURB, VERY_FREE]
description: Staff availability / occupancy index visible to members.
DynamicState:
type: string
enum: [SCHEDULED, ON_LEAVE, PROXY_SUBSTITUTE, LUNCH, INTERNAL_MEETING, ADHOC_EVENT]
description: Operational state of a daily ledger entry.
ExecutionMode:
type: string
enum: [PHYSICAL, ONLINE_STREAM]
description: Class delivery format.
VerificationMetric:
type: string
enum: [PRESENT, ABSENT, LATE]
description: Attendance marking status for a member.
LogVerificationState:
type: string
enum: [PENDING_VERIFICATION, VERIFIED_APPROVED, VERIFIED_DENIED]
description: Approval workflow state for absence requests and guest handshakes.
# ── Auth ──────────────────────────────────
LoginRequest:
type: object
required: [email_address, password]
description: >
`email` is accepted in place of `email_address` through 0.14 and
removed in 0.15.
properties:
email_address:
type: string
format: email
example: staff@org.internal
password:
type: string
format: password
example: "••••••••"
Readiness:
type: object
properties:
status:
type: string
enum: [ready, not ready]
database:
type: string
enum: [ok, unavailable]
redis:
type: string
enum: [ok, unavailable]
TokenResponse:
type: object
properties:
access_token:
type: string
description: "Signed JWT. Include as `Authorization: Bearer <token>`."
refresh_token:
type: string
description: Exchange at `POST /auth/refresh` for a new pair when the access token expires.
token_type:
type: string
example: bearer
user_id:
type: string
example: FAC001
role:
$ref: "#/components/schemas/InstitutionalRole"
full_name:
type: string
example: Dr. Priya Sharma
initial_login_state:
type: boolean
description: True on first login, client should prompt password change.
ChangePasswordRequest:
type: object
required: [current_password, new_password]
properties:
current_password:
type: string
format: password
new_password:
type: string
format: password
minLength: 12
description: >
At least PASSWORD_MIN_LENGTH characters, 12 unless the deployment
has raised it, and not a placeholder published in this repository.
FederatedTokenRequest:
type: object
required: [token]
properties:
token:
type: string
description: >
The note, exactly as its issuer minted it. A signed JWT whose
`iss` names a registered issuer, whose header `kid` names one of
that issuer's registered keys, and which carries `aud`, `sub`,
`jti`, `iat` and `exp`. An `email` claim is what a first-time
subject is provisioned from; `name` and `groups` are read if they
are there.
RefreshRequest:
type: object
required: [refresh_token]
properties:
refresh_token:
type: string
FeedToken:
type: object
properties:
feed_token:
type: string
description: 256 bits out of the system random source, hex encoded.
feed_path:
type: string
description: >
The feed path this token opens, relative to the server root.
example: /api/v1/sync/user-feed/1f4a9c2e.ics
# ── Users ─────────────────────────────────
UserCreate:
type: object
required: [id, full_name, email_address, password, role_type]
properties:
id:
type: string
example: FAC042
full_name:
type: string
example: Dr. Rajan Mehta
email_address:
type: string
format: email
password:
type: string
format: password
minLength: 12
description: >
Held to the same PASSWORD_MIN_LENGTH floor as a password the user
chooses for themselves.
role_type:
$ref: "#/components/schemas/InstitutionalRole"
unit_code:
type: string
nullable: true
example: CSE
assigned_base_station:
type: string
nullable: true
example: Front Desk
reporting_line_manager:
type: string
nullable: true
example: HOD001
UserUpdate:
type: object
description: >
A field left out keeps its value and a null clears it, except
full_name and email_address, which cannot be null (422).
properties:
full_name:
type: string
email_address:
type: string
format: email
unit_code:
type: string
nullable: true
assigned_base_station:
type: string
nullable: true
reporting_line_manager:
type: string
nullable: true
ProvisionedCredential:
type: object
description: >
A password generated for a member the import created. Returned
only in the upload response and never stored.
properties:
member_id:
type: string
email_address:
type: string
initial_password:
type: string
required: [member_id, email_address, initial_password]
CsvImportResult:
type: object
properties:
status:
type: string
enum: [SUCCESS, FAILED]
rows_ingested:
type: integer
description: Present when status is SUCCESS.
provisioned_credentials:
type: array
description: >
One entry per member this import created, empty when the file
only touched members who already existed. The single copy of
these passwords: save them or reset the members individually.
items:
$ref: "#/components/schemas/ProvisionedCredential"
slots_corrected:
type: integer
description: >
Slots this file changed rather than created. Re-uploading a file
with a corrected room or lead is how a timetable is edited in
bulk; a slot whose start time moved does not match and arrives as
a second slot instead, with the original reported in not_in_file.
ledger_rows_updated:
type: integer
description: >
Days already generated from a corrected slot that were still
plans and now carry the new lead and room. A day whose room
changed also has its geofence cleared, because the old one
fenced members out of the room they have just been sent to.
ledger_rows_kept:
type: integer
description: >
Days left alone because attendance or a note has been recorded
against them. They now disagree with the timetable on purpose:
they record what happened. Days already past are never touched
and are not counted here.
kept_days:
type: array
description: >
The days counted in ledger_rows_kept, earliest first, each with
the room it still has. Present when status is SUCCESS.
items:
$ref: "#/components/schemas/KeptDay"
requirements_unmet:
type: array
description: >
One entry per requirement of a slot in the file, or of its
activity or room, that the slot's next run cannot have. A
report; the import is not refused for it.
items:
$ref: "#/components/schemas/SlotRequirementGap"
not_in_file:
$ref: "#/components/schemas/ImportOrphans"
removed:
$ref: "#/components/schemas/ImportRemoved"
not_removed:
$ref: "#/components/schemas/ImportNotRemoved"
error_log:
type: string
description: Present when status is FAILED.
required: [status]
KeptDay:
type: object
description: >
A day a re-import left as it was, because attendance or a note has
been recorded against it. It keeps the room, lead and window it
was held with.
properties:
id:
type: integer
description: The ledger entry, as GET /schedule/ledger returns it.
date:
type: string
format: date
activity_code:
type: string
master_slot_id:
type: integer
description: The slot the file corrected.
time_window_start:
type: string
format: time
room:
type: string
nullable: true
description: The room the day still has, not the one the file names.
required: [id, date, activity_code, master_slot_id, time_window_start, room]
ImportOrphans:
type: object
description: >
What the cycle holds that this file did not mention. A report, and
an action only when the upload sets `remove_missing`: a file covering
half a timetable cannot be told apart from a timetable that lost half
its classes, so by default nothing here is removed and somebody
decides.
Scoped to the units named in the file, not to the whole cycle, so a
file covering one unit does not report every class in every other
unit each time it is uploaded.
properties:
slots:
type: array
items:
$ref: "#/components/schemas/OrphanSlot"
enrollments:
type: array
items:
$ref: "#/components/schemas/OrphanEnrollment"
required: [slots, enrollments]
OrphanSlot:
type: object
properties:
id:
type: integer
description: What DELETE /schedule/slots/{slot_id} takes, if it should go.
activity_code:
type: string
rrule:
type: string
example: FREQ=WEEKLY;BYDAY=MO
dtstart:
type: string
format: date
time_window_start:
type: string
format: time
room:
type: string
nullable: true
required: [id, activity_code, rrule, dtstart, time_window_start]
OrphanEnrollment:
type: object
properties:
member_id:
type: string
activity_code:
type: string
required: [member_id, activity_code]
ImportRemoved:
type: object
description: >
What an upload with `remove_missing` set removed, from among the rows
in `not_in_file`. Both lists are empty when the option is off.
properties:
slots:
type: array
items:
$ref: "#/components/schemas/RemovedSlot"
enrollments:
type: array
items:
$ref: "#/components/schemas/OrphanEnrollment"
required: [slots, enrollments]
RemovedSlot:
description: A slot the upload removed, as it was listed in `not_in_file`.
allOf:
- $ref: "#/components/schemas/OrphanSlot"
- type: object
properties:
ledger_rows_removed:
type: integer
description: Days from today on that the slot had produced, now withdrawn.
ledger_rows_detached:
type: integer
description: >
Days already past, kept with everything recorded on them and
no longer pointing at a slot.
required: [ledger_rows_removed, ledger_rows_detached]
ImportNotRemoved:
type: object
description: >
What an upload with `remove_missing` set listed for removal and left
in place. Empty when the option is off.
properties:
slots:
type: array
items:
$ref: "#/components/schemas/NotRemovedSlot"
required: [slots]
NotRemovedSlot:
description: >
A slot the upload did not remove, as it was listed in `not_in_file`.
It stays on the timetable with all its days.
allOf:
- $ref: "#/components/schemas/OrphanSlot"
- type: object
properties:
reason:
type: string
description: >
Why it was left, naming the dates of the days ahead that carry
attendance or a note. Act on it with `POST /schedule/slots/{id}/retire`,
which keeps those days.
required: [reason]
PasswordResetResponse:
type: object
properties:
user_id:
type: string
initial_password:
type: string
description: >
Plain text, returned only here. Never stored and never logged.
required: [user_id, initial_password]
UserStatusUpdate:
type: object
required: [status]
properties:
status:
$ref: "#/components/schemas/AccessReadiness"
UserResponse:
type: object
properties:
id:
type: string
full_name:
type: string
email_address:
type: string
role_type:
$ref: "#/components/schemas/InstitutionalRole"
unit_code:
type: string
nullable: true
assigned_base_station:
type: string
nullable: true
current_occupancy_index:
$ref: "#/components/schemas/AccessReadiness"
reporting_line_manager:
type: string
nullable: true
deactivated_at:
type: string
format: date-time
nullable: true
description: When the account was deactivated, or null while it is active.
organization_id:
type: string
description: >
The organization the account belongs to. Everything the account
reads and writes is in this organization.
OpenItems:
type: object
description: >
What still names a deactivated account. Deactivating changes none of
it and is never refused because of it; calling deactivate again
counts afresh.
required:
- pending_absence_requests
- direct_reports
- slots_led
- ledger_rows_ahead
properties:
pending_absence_requests:
type: integer
description: >
Absence requests sent to the account that nobody has decided. An
admin decides them from `GET /attendance/absence/pending`.
direct_reports:
type: integer
description: Active accounts that name it as their manager.
slots_led:
type: integer
description: Slots it leads in a cycle that has not ended, drafts included.
ledger_rows_ahead:
type: integer
description: Ledger rows dated today or later that it leads or covers.
DeactivatedUserResponse:
allOf:
- $ref: "#/components/schemas/UserResponse"
- type: object
required: [open_items]
properties:
open_items:
$ref: "#/components/schemas/OpenItems"
# ── API keys ─────────────────────────────
ApiKeyCreate:
type: object
required: [label, user_id]
properties:
label:
type: string
minLength: 1
maxLength: 100
description: What this key is for, so it can be recognized in the list.
example: Hospital information system
user_id:
type: string
description: >
The user this key acts as. The key can never do more than that
user can, whatever its scopes say.
example: SVC001
scopes:
type: array
nullable: true
minItems: 1
items:
type: string
pattern: "^(\\*|impersonate|[a-z][a-z-]*:(read|write))$"
description: >
Areas this key may reach. Omit the field for an unrestricted key;
an empty array is refused, since a key that can reach nothing is
not a key anybody wants. Stored sorted and deduplicated. The
scope `impersonate` lets the key act for a named person in its
organization (header `X-Chronos-Actor`); it is granted only by
naming it, and `*` does not include it.
example: [schedule:read, resources:read]
expires_at:
type: string
format: date-time
nullable: true
description: >
When the key stops working. Omit for a key that never does. A time
already past is refused at creation.
example: "2027-01-01T00:00:00Z"
ApiKeyResponse:
type: object
properties:
id:
type: integer
key_prefix:
type: string
description: The first 12 characters, enough to tell two keys apart.
example: ck_8Kd2mQ7x
label:
type: string
user_id:
type: string
scopes:
type: string
description: >
Comma separated, or `*` for a key that was never narrowed. May
include `impersonate`, which `*` does not stand for.
example: resources:read,schedule:read
expires_at:
type: string
format: date-time
nullable: true
created_at:
type: string
format: date-time
nullable: true
ApiKeyCreated:
allOf:
- $ref: "#/components/schemas/ApiKeyResponse"
- type: object
required: [api_key]
properties:
api_key:
type: string
description: >
The raw key. Returned exactly once, here. Only its hash is
stored, so it cannot be shown again and a lost key has to be
revoked and reissued.
example: ck_8Kd2mQ7xR3nL9vB5tY1wZ0aC6eF4gH2jK8mN
# ── Federation ────────────────────────────
IssuerCreate:
type: object
required: [issuer, display_name, audience]
properties:
issuer:
type: string
maxLength: 255
description: >
The exact `iss` value notes will carry. Compared, never parsed:
nothing here fetches it, so it is an identifier that happens to
look like a URL.
example: https://sso.example.internal
display_name:
type: string
maxLength: 100
description: What an administrator calls this issuer in a list.
example: Campus SSO
audience:
type: string
maxLength: 255
description: >
The `aud` this instance answers to. An issuer serving several
relying parties should give each one its own value, so a note
minted for another one is refused here.
example: chronos-ledger
enabled:
type: boolean
default: true
description: >
False is refused the same way an unknown issuer is, so turning an
issuer off does not mean deleting what it was allowed to assert.
IssuerUpdate:
type: object
description: >
Every field is optional and one left out is unchanged. `issuer` cannot
be changed: it is the value notes already in the wild carry, and
editing it would retarget a registration rather than register another.
properties:
display_name:
type: string
maxLength: 100
audience:
type: string
maxLength: 255
enabled:
type: boolean
IssuerResponse:
type: object
properties:
id:
type: integer
example: 3
issuer:
type: string
example: https://sso.example.internal
display_name:
type: string
example: Campus SSO
audience:
type: string
example: chronos-ledger
enabled:
type: boolean
example: true
created_at:
type: string
format: date-time
nullable: true
IssuerKeyCreate:
type: object
required: [kid, public_key]
properties:
kid:
type: string
maxLength: 100
description: >
The `kid` the note header will carry. A note is verified against
the key it names and no other, so an overlap during a rotation is
two registered keys rather than two candidates per note.
example: 2026-key-a
public_key:
type: string
description: >
An Ed25519 public key in PEM form. Loaded when it is registered, so
a key that cannot be read is refused here rather than turning every
note that names it into a 401 nobody can explain.
example: |
-----BEGIN PUBLIC KEY-----
MCowBQYDK2VwAyEAWJyyHHtL1RwC53ABtyd229BalcSDxdE3P02wXuDoeV4=
-----END PUBLIC KEY-----
not_before:
type: string
format: date-time
nullable: true
description: When the key starts being accepted. Omitted means now.
not_after:
type: string
format: date-time
nullable: true
description: >
When it stops. Omitted is a key with no planned retirement, which
is the ordinary case until a rotation gives it one.
IssuerKeyRetire:
type: object
required: [not_after]
properties:
not_after:
type: string
format: date-time
description: >
The moment the key stops being accepted. A moment in the past stops
it now, which is what a leaked key wants; a moment in the future is
the overlap a planned rotation wants.
IssuerKeyResponse:
type: object
properties:
id:
type: integer
issuer_id:
type: integer
kid:
type: string
public_key:
type: string
description: >
Read back in full. It is a public key, so there is nothing here a
leak would cost anybody, and an integrator comparing what was
registered against what is being signed with needs to see it.
not_before:
type: string
format: date-time
not_after:
type: string
format: date-time
nullable: true
created_at:
type: string
format: date-time
nullable: true
RoleMapEntryCreate:
type: object
required: [group_claim_value, role_type]
properties:
group_claim_value:
type: string
maxLength: 200
description: >
One value out of the note's `groups` claim, matched exactly. A group
with no entry lands on `MEMBER`, so an issuer trusted to say who
somebody is has not thereby been trusted to say what they may do.
example: library-staff
role_type:
type: string
enum: [STAFF, MEMBER]
description: >
`ORG_ADMIN` and `UNIT_ADMIN` are refused with a 422, and refused
again by a check constraint. It is the one rule whose failure would
hand an outside system this instance.
example: STAFF
unit_code:
type: string
maxLength: 50
nullable: true
description: The unit somebody in this group belongs to, if any.
example: LIB
RoleMapEntryResponse:
type: object
properties:
id:
type: integer
issuer_id:
type: integer
group_claim_value:
type: string
role_type:
type: string
enum: [STAFF, MEMBER]
unit_code:
type: string
nullable: true
LinkCreate:
type: object
required: [issuer_id, subject, user_id]
properties:
issuer_id:
type: integer
description: The registration the subject belongs to.
example: 3
subject:
type: string
maxLength: 255
description: >
The `sub` notes for this person will carry. Opaque and scoped to its
issuer: two issuers may use the same string for different people,
which is why the pair is what has to be unique.
example: u-4417
user_id:
type: string
maxLength: 50
description: >
The account that subject signs in as. An `ORG_ADMIN` or `UNIT_ADMIN`
account is refused: the role map cannot grant either role, and a
link would be a way around that.
example: EMP1042
LinkResponse:
type: object
properties:
id:
type: integer
issuer_id:
type: integer
subject:
type: string
user_id:
type: string
created_at:
type: string
format: date-time
nullable: true
# ── Resource classes ──────────────────────
ResourceClassResponse:
type: object
required: [id, code, name, active, seeded, created_at]
properties:
id:
type: integer
code:
type: string
description: The stable identifier. Uppercase, unique in the organization, never changed.
example: ROOM
name:
type: string
description: What is shown. Free to change.
example: Room
active:
type: boolean
description: >
Whether a new resource or requirement may name the class.
Switching it off leaves the ones that already do as they are.
seeded:
type: boolean
description: >
True for `ROOM` and `PERSON`, which every organization has and
which can be renamed but not removed or switched off. They are
also where the engine's older behaviour is anchored: an import
files rooms under `ROOM`. Any other class carries no behaviour,
it is a label that resources are filed under and requirements
can ask for.
created_at:
type: string
format: date-time
ResourceClassCreate:
type: object
required: [code, name]
properties:
code:
type: string
pattern: "^[A-Z][A-Z0-9_]*$"
minLength: 1
maxLength: 30
description: Uppercase letters, digits and underscores, starting with a letter.
example: EQUIPMENT_CART
name:
type: string
minLength: 1
maxLength: 120
example: Equipment cart
ResourceClassUpdate:
type: object
description: >
Every field is optional and one left out is left alone. Neither can be
null. code is absent on purpose: it never changes.
properties:
name:
type: string
minLength: 1
maxLength: 120
active:
type: boolean
# ── Resources ─────────────────────────────
ResourceResponse:
type: object
properties:
id:
type: integer
code:
type: string
description: The importer's match key. Not editable.
example: LH-3
label:
type: string
example: Lecture Hall 3
resource_type:
type: string
description: >
The code of one of the organization's resource classes. `ROOM`
and `PERSON` exist everywhere; see `GET /api/v1/resource-classes/`
for the rest.
example: ROOM
unit_code:
type: string
nullable: true
capacity:
type: integer
nullable: true
description: >