feat(accounts): add consent settings and organization management

This commit is contained in:
TakuyaYagam1 committed 2026-10-07 13:00:39 +03:00
1 parent 24638d46d2
commit 391af7a1ef
83 files changed
+10198 -613

No files matched your search

@@ -0,0 +1,27 @@
post:
operationId: RequestMyAccountDeletion
summary: Revoke C1 and request account deletion.
description: |-
Requires a verified session, its CSRF token in X-CSRF-Token, and the exact configured Origin. The subject comes from the session. In one transaction, revokes any active C1 record, creates or returns the subject's active durable deletion request, and writes the outbox intent. The API does not delete the account synchronously. Repeating the request returns the same active request; a later C1 grant never cancels it.
security:
- sessionCookie: []
sessionCsrf: []
tags:
- consent
responses:
"202":
description: The durable account-deletion request is queued for processing.
headers:
Cache-Control:
$ref: ../components/headers.yml#/CacheControlNoStore
content:
application/json:
schema:
$ref: ../components/schemas.yml#/ConsentDeletionRequest
"401":
$ref: ../components/responses.yml#/Unauthenticated
"403":
description: CSRF or Origin validation failed.
$ref: ../components/responses.yml#/CsrfCheckFailed
default:
$ref: ../components/responses.yml#/Problem
+1 -1
View File
@@ -8,7 +8,7 @@ get:
Without `state` the page lists the whole history; `state=active` lists the consents that hold now, one per purpose for c1, c2, c3, and c5 and one per accepted invitation for c4. A c4 record names the organization with the name its consent text showed (a snapshot that a later rename does not change), the selected contact fields, and the invitation with its terms version; it never carries a contact value. A c2 record proves the consent to the publication text; the published field set and its changes are evidence of the publication history.
Granting c1, c2, c3, and c5 in the consent settings and revoking any purpose are planned operations of this tag; c1 is given at registration and c4 only in AcceptMyInvitation.
Settings grants of c1, c2, c3, and c5 require the currently published text and an explicit acceptance. Revoking c2, c3, or c5 is available in settings; c1 creates a durable account-deletion request, and c4 is revoked only for one organization. C4 is granted only in AcceptMyInvitation.
Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated. A malformed `limit`, `cursor`, or `state` answers 400 validation_failed.
security:
+89
View File
@@ -0,0 +1,89 @@
put:
operationId: GrantMyConsent
summary: Record an explicit consent grant from settings.
description: |-
Requires a verified session, its CSRF token in X-CSRF-Token, and the exact configured Origin. The subject comes from the session. The body names the current text version the user read and requires `accepted: true`; the server verifies that version is still current and stores the hash of the exact text. A stale version answers 400 validation_failed at `/text_version`, without writing a grant.
C1 is available to candidate and employer accounts. C2, C3, and C5 are available only to candidate accounts. C4 is excluded and can be granted only by accepting an invitation. A repeated grant of the same current version returns the existing record; after revocation a grant creates a new record and never reopens a publication or restores an older grant.
security:
- sessionCookie: []
sessionCsrf: []
tags:
- consent
parameters:
- name: purpose
in: path
required: true
description: Independent consent being granted. C4 is not available here.
schema:
$ref: ../components/schemas.yml#/ConsentSettingsPurpose
requestBody:
required: true
content:
application/json:
schema:
$ref: ../components/schemas.yml#/ConsentSettingsGrantRequest
responses:
"200":
description: The created or existing consent record.
headers:
Cache-Control:
$ref: ../components/headers.yml#/CacheControlNoStore
content:
application/json:
schema:
$ref: ../components/schemas.yml#/ConsentRecord
"400":
$ref: ../components/responses.yml#/ValidationFailed
"401":
$ref: ../components/responses.yml#/Unauthenticated
"403":
description: CSRF or Origin validation failed, or an employer tried to grant a candidate-only purpose.
content:
application/problem+json:
schema:
$ref: ../components/schemas.yml#/Problem
examples:
csrf:
$ref: ../components/examples.yml#/CsrfCheckFailed
forbidden:
$ref: ../components/examples.yml#/Forbidden
default:
$ref: ../components/responses.yml#/Problem
delete:
operationId: RevokeMyConsent
summary: Revoke a non-scoped consent from settings.
description: |-
Requires a verified candidate session, its CSRF token in X-CSRF-Token, and the exact configured Origin. The subject comes from the session. Revokes every unrevoked record of c2, c3, or c5, including superseded records, and never changes another purpose. Repeating a revocation is harmless and creates no duplicate event.
Revoking c2 immediately closes the stored publication and records privacy history in the same transaction; a downstream revocation intent is written to the outbox. A later c2 grant does not reopen publication or restore old grants. Revoking c3 does not block the manual assessment path. Revoking c5 makes the consent gate deny further FSP import and writes a durable stop/delete intent; an external FSP deletion adapter is not available yet.
security:
- sessionCookie: []
sessionCsrf: []
tags:
- consent
parameters:
- name: purpose
in: path
required: true
description: Consent being revoked. C1 has a deletion-request operation and C4 requires an organization scope.
schema:
$ref: ../components/schemas.yml#/ConsentSettingsRevokePurpose
responses:
"204":
description: Consent revoked, or it was already revoked.
"401":
$ref: ../components/responses.yml#/Unauthenticated
"403":
description: CSRF or Origin validation failed, or an employer account tried to revoke candidate consent.
content:
application/problem+json:
schema:
$ref: ../components/schemas.yml#/Problem
examples:
csrf:
$ref: ../components/examples.yml#/CsrfCheckFailed
forbidden:
$ref: ../components/examples.yml#/Forbidden
default:
$ref: ../components/responses.yml#/Problem
+39
View File
@@ -0,0 +1,39 @@
delete:
operationId: RevokeMyOrganizationContactConsent
summary: Revoke C4 for one organization.
description: |-
Requires a verified candidate session, its CSRF token in X-CSRF-Token, and the exact configured Origin. The subject comes from the session; `org_id` is the only scope the caller may choose. The server revokes every unrevoked C4 record for this subject and organization, using the fields stored on those records to request downstream grant revocation. It does not affect another organization. Repeating the request is harmless and creates no duplicate event.
security:
- sessionCookie: []
sessionCsrf: []
tags:
- consent
parameters:
- name: org_id
in: path
required: true
description: >-
Organization whose stored C4 grants this account revokes. A well-formed
identifier outside the account's stored records changes nothing and
does not reveal whether that organization exists.
schema:
type: string
format: uuid
responses:
"204":
description: C4 revoked for this organization, or no active C4 was present.
"401":
$ref: ../components/responses.yml#/Unauthenticated
"403":
description: CSRF or Origin validation failed, or the caller is not a candidate.
content:
application/problem+json:
schema:
$ref: ../components/schemas.yml#/Problem
examples:
csrf:
$ref: ../components/examples.yml#/CsrfCheckFailed
forbidden:
$ref: ../components/examples.yml#/Forbidden
default:
$ref: ../components/responses.yml#/Problem
+36
View File
@@ -0,0 +1,36 @@
get:
operationId: GetMyConsentText
summary: Read a current consent text for account settings.
description: >-
Requires a verified session. Returns the current published text and version
of c1, c2, c3, or c5 so the user can read the exact text before an explicit
settings grant. C4 is excluded: its text includes an organization snapshot
and it is granted only during invitation acceptance. The response is
private and is not cached.
security:
- sessionCookie: []
tags:
- consent
parameters:
- name: purpose
in: path
required: true
description: Consent whose current text is requested.
schema:
$ref: ../components/schemas.yml#/ConsentSettingsPurpose
responses:
"200":
description: The current published consent text.
headers:
Cache-Control:
$ref: ../components/headers.yml#/CacheControlNoStore
content:
application/json:
schema:
$ref: ../components/schemas.yml#/ConsentText
"401":
$ref: ../components/responses.yml#/Unauthenticated
"400":
$ref: ../components/responses.yml#/ValidationFailed
default:
$ref: ../components/responses.yml#/Problem