feat(consent): add versioned append-only consent ledger C1-C5
This commit is contained in:
1 parent
008254e44a
commit
de49f93b0b
64 files changed
+9244
-132
No files matched your search
@@ -3521,3 +3521,62 @@ InvitationSendBlocked:
|
||||
code: state_conflict
|
||||
detail: The resource is in a state that does not allow this operation.
|
||||
trace_id: 5b6c7d8e-9f0a-4b1c-8d2e-4f5a6b7c8d9e
|
||||
ConsentRecordListPage:
|
||||
summary: The whole consent history of a candidate on one page
|
||||
description: C1 was accepted at registration and again for a newer text version, so the first record is superseded; the version c1-2026-10-05 is an illustration, since the migration publishes only c1-2026-10-01 so far. C2 was granted and revoked. C4 was given in the acceptance of one invitation with the email only; the organization name is the one the consent text showed.
|
||||
value:
|
||||
items:
|
||||
- id: 01928f7a-9c0d-7e1f-8a2b-3c4d5e6f7a80
|
||||
purpose: c4
|
||||
state: active
|
||||
text_version: c4-2026-10-01
|
||||
source: invitation_acceptance
|
||||
granted_at: "2026-10-06T10:15:00Z"
|
||||
revoked_at: null
|
||||
revocation_source: null
|
||||
organization:
|
||||
id: 01928f7a-1a2b-7c3d-8e4f-5a6b7c8d9e01
|
||||
name: ООО Пример Платежи
|
||||
fields:
|
||||
- email
|
||||
invitation_id: 01928f7a-7a8b-7c9d-8e0f-1a2b3c4d5e6f
|
||||
invitation_terms_version: 3
|
||||
- id: 01928f7a-8b9c-7d0e-9f1a-2b3c4d5e6f70
|
||||
purpose: c1
|
||||
state: active
|
||||
text_version: c1-2026-10-05
|
||||
source: consent_settings
|
||||
granted_at: "2026-10-05T12:00:00Z"
|
||||
revoked_at: null
|
||||
revocation_source: null
|
||||
organization: null
|
||||
fields: null
|
||||
invitation_id: null
|
||||
invitation_terms_version: null
|
||||
- id: 01928f7a-7a8b-7c9d-8e0f-1a2b3c4d5e60
|
||||
purpose: c2
|
||||
state: revoked
|
||||
text_version: c2-2026-10-01
|
||||
source: consent_settings
|
||||
granted_at: "2026-10-02T09:00:00Z"
|
||||
revoked_at: "2026-10-04T18:30:00Z"
|
||||
revocation_source: consent_settings
|
||||
organization: null
|
||||
fields: null
|
||||
invitation_id: null
|
||||
invitation_terms_version: null
|
||||
- id: 01928f7a-6f7a-7b8c-9d0e-1f2a3b4c5d50
|
||||
purpose: c1
|
||||
state: superseded
|
||||
text_version: c1-2026-10-01
|
||||
source: registration
|
||||
granted_at: "2026-10-01T08:00:00Z"
|
||||
revoked_at: null
|
||||
revocation_source: null
|
||||
organization: null
|
||||
fields: null
|
||||
invitation_id: null
|
||||
invitation_terms_version: null
|
||||
page:
|
||||
has_more: false
|
||||
next_cursor: null
|
||||
@@ -1395,6 +1395,174 @@ SpecializationCatalog:
|
||||
description: Grade scale in ascending order.
|
||||
items:
|
||||
$ref: '#/CatalogGrade'
|
||||
ConsentPurposeCode:
|
||||
type: string
|
||||
description: 'One of the independent consents of PRD FR01. A grant or a revocation of one purpose never changes another.
|
||||
|
||||
|
||||
- c1: processing of personal data, given at registration.
|
||||
|
||||
- c2: publication of the candidate card. The record proves the consent to the published text; which fields were published and when is evidence of the publication history (TASK-088), not of this record. Adding a field scope to c2 records later is an additive change.
|
||||
|
||||
- c3: automatic categorization. Without it the candidate can request a manual assessment by the same rubric.
|
||||
|
||||
- c4: transfer of the selected contact data to one organization, currently given only in an invitation acceptance.
|
||||
|
||||
- c5: import of FSP results.
|
||||
|
||||
|
||||
ConsentPurpose lists the subset whose text the client may read before an account exists.'
|
||||
enum:
|
||||
- c1
|
||||
- c2
|
||||
- c3
|
||||
- c4
|
||||
- c5
|
||||
ConsentState:
|
||||
type: string
|
||||
description: 'State of a consent record, computed from the ledger.
|
||||
|
||||
|
||||
- active: the consent holds. For c1, c2, c3, and c5 it is the newest unrevoked record of its purpose; every unrevoked c4 record is active, one per accepted invitation.
|
||||
|
||||
- superseded: the subject later accepted another text version of the same purpose and has not revoked either. The record stays as evidence for its own time; it never applies to c4.
|
||||
|
||||
- revoked: the consent was revoked. The record keeps its grant and its one revocation time; a later grant is a new record and never reopens it.'
|
||||
enum:
|
||||
- active
|
||||
- superseded
|
||||
- revoked
|
||||
ConsentSource:
|
||||
type: string
|
||||
description: 'Where the subject gave the consent.
|
||||
|
||||
|
||||
- registration: the c1 acceptance of RegisterAccount.
|
||||
|
||||
- consent_settings: the consent settings of the account, for c1, c2, c3, and c5 (planned, TASK-063 and TASK-064).
|
||||
|
||||
- invitation_acceptance: the c4 acceptance of AcceptMyInvitation.
|
||||
|
||||
|
||||
A c4 given when sending an application (PRD Q9) is planned as an additional value.'
|
||||
enum:
|
||||
- registration
|
||||
- consent_settings
|
||||
- invitation_acceptance
|
||||
ConsentRevocationSource:
|
||||
type: string
|
||||
description: 'Who recorded a revocation.
|
||||
|
||||
|
||||
- consent_settings: the subject revoked the consent in the product.
|
||||
|
||||
- support_request: an operator recorded a revocation that the subject requested through support.'
|
||||
enum:
|
||||
- consent_settings
|
||||
- support_request
|
||||
ConsentOrganization:
|
||||
type: object
|
||||
description: Organization of a c4 consent as the consent recorded it. `name` is a snapshot of the name that the shown consent text carried at the time of the consent, and the stored text hash proves that text with this name; a later rename of the organization does not change it, so it can differ from the current name.
|
||||
additionalProperties: false
|
||||
required:
|
||||
- id
|
||||
- name
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
format: uuid
|
||||
description: Identifier of the organization.
|
||||
name:
|
||||
type: string
|
||||
minLength: 1
|
||||
maxLength: 200
|
||||
description: Name of the organization in the consent text at the time of the consent. Plain text; clients show it as text, never as HTML.
|
||||
ConsentRecord:
|
||||
type: object
|
||||
description: 'One record of the consent ledger as its subject reads it: the purpose, the text version the subject accepted, where and when the consent was given, its state, and the revocation. A c4 record also names the organization, the contact fields, and the invitation with its terms version; these fields are null for every other purpose. The server also stores the SHA-256 hash of exactly the text the subject saw, which a client never sends or receives.'
|
||||
additionalProperties: false
|
||||
required:
|
||||
- id
|
||||
- purpose
|
||||
- state
|
||||
- text_version
|
||||
- source
|
||||
- granted_at
|
||||
- revoked_at
|
||||
- revocation_source
|
||||
- organization
|
||||
- fields
|
||||
- invitation_id
|
||||
- invitation_terms_version
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
format: uuid
|
||||
description: Identifier of the record.
|
||||
purpose:
|
||||
$ref: '#/ConsentPurposeCode'
|
||||
state:
|
||||
$ref: '#/ConsentState'
|
||||
text_version:
|
||||
description: Version of the consent text that the subject accepted.
|
||||
allOf:
|
||||
- $ref: '#/ConsentTextVersion'
|
||||
source:
|
||||
$ref: '#/ConsentSource'
|
||||
granted_at:
|
||||
$ref: '#/Timestamp'
|
||||
revoked_at:
|
||||
description: Moment of the revocation, or null unless `state` is `revoked`.
|
||||
oneOf:
|
||||
- $ref: '#/Timestamp'
|
||||
- type: 'null'
|
||||
revocation_source:
|
||||
description: Who recorded the revocation, or null unless `state` is `revoked`.
|
||||
oneOf:
|
||||
- $ref: '#/ConsentRevocationSource'
|
||||
- type: 'null'
|
||||
organization:
|
||||
description: Organization that a c4 consent allows to read the fields, with the name the consent text showed, or null for every other purpose.
|
||||
oneOf:
|
||||
- $ref: '#/ConsentOrganization'
|
||||
- type: 'null'
|
||||
fields:
|
||||
type:
|
||||
- array
|
||||
- 'null'
|
||||
minItems: 1
|
||||
maxItems: 4
|
||||
uniqueItems: true
|
||||
description: Contact fields that a c4 consent covers, or null for every other purpose. One kind never implies another.
|
||||
items:
|
||||
$ref: '#/ContactFieldKind'
|
||||
invitation_id:
|
||||
type:
|
||||
- string
|
||||
- 'null'
|
||||
format: uuid
|
||||
description: Invitation whose acceptance gave a c4 consent, or null for every other purpose.
|
||||
invitation_terms_version:
|
||||
description: Terms version that the acceptance accepted, or null for every other purpose.
|
||||
oneOf:
|
||||
- $ref: '#/InvitationTermsVersion'
|
||||
- type: 'null'
|
||||
ConsentRecordList:
|
||||
type: object
|
||||
description: One page of the consent ledger of the current account, newest grant first.
|
||||
additionalProperties: false
|
||||
required:
|
||||
- items
|
||||
- page
|
||||
properties:
|
||||
items:
|
||||
type: array
|
||||
maxItems: 100
|
||||
description: Records of the page.
|
||||
items:
|
||||
$ref: '#/ConsentRecord'
|
||||
page:
|
||||
$ref: '#/PageInfo'
|
||||
ContactFieldKind:
|
||||
type: string
|
||||
description: 'Kind of personal data that the consent C4 can disclose to one organization (PRD FR01 and FR12). The candidate selects each kind separately; one kind never implies another.
|
||||
|
||||
@@ -0,0 +1,182 @@
|
||||
schemas:
|
||||
ConsentPurposeCode:
|
||||
type: string
|
||||
description: |-
|
||||
One of the independent consents of PRD FR01. A grant or a revocation of one purpose never changes another.
|
||||
|
||||
- c1: processing of personal data, given at registration.
|
||||
- c2: publication of the candidate card. The record proves the consent to the published text; which fields were published and when is evidence of the publication history (TASK-088), not of this record. Adding a field scope to c2 records later is an additive change.
|
||||
- c3: automatic categorization. Without it the candidate can request a manual assessment by the same rubric.
|
||||
- c4: transfer of the selected contact data to one organization, currently given only in an invitation acceptance.
|
||||
- c5: import of FSP results.
|
||||
|
||||
ConsentPurpose lists the subset whose text the client may read before an account exists.
|
||||
enum:
|
||||
- c1
|
||||
- c2
|
||||
- c3
|
||||
- c4
|
||||
- c5
|
||||
ConsentState:
|
||||
type: string
|
||||
description: |-
|
||||
State of a consent record, computed from the ledger.
|
||||
|
||||
- active: the consent holds. For c1, c2, c3, and c5 it is the newest unrevoked record of its purpose; every unrevoked c4 record is active, one per accepted invitation.
|
||||
- superseded: the subject later accepted another text version of the same purpose and has not revoked either. The record stays as evidence for its own time; it never applies to c4.
|
||||
- revoked: the consent was revoked. The record keeps its grant and its one revocation time; a later grant is a new record and never reopens it.
|
||||
enum:
|
||||
- active
|
||||
- superseded
|
||||
- revoked
|
||||
ConsentSource:
|
||||
type: string
|
||||
description: |-
|
||||
Where the subject gave the consent.
|
||||
|
||||
- registration: the c1 acceptance of RegisterAccount.
|
||||
- consent_settings: the consent settings of the account, for c1, c2, c3, and c5 (planned, TASK-063 and TASK-064).
|
||||
- invitation_acceptance: the c4 acceptance of AcceptMyInvitation.
|
||||
|
||||
A c4 given when sending an application (PRD Q9) is planned as an additional value.
|
||||
enum:
|
||||
- registration
|
||||
- consent_settings
|
||||
- invitation_acceptance
|
||||
ConsentRevocationSource:
|
||||
type: string
|
||||
description: |-
|
||||
Who recorded a revocation.
|
||||
|
||||
- consent_settings: the subject revoked the consent in the product.
|
||||
- support_request: an operator recorded a revocation that the subject requested through support.
|
||||
enum:
|
||||
- consent_settings
|
||||
- support_request
|
||||
ConsentOrganization:
|
||||
type: object
|
||||
description: >-
|
||||
Organization of a c4 consent as the consent recorded it. `name` is a
|
||||
snapshot of the name that the shown consent text carried at the time
|
||||
of the consent, and the stored text hash proves that text with this
|
||||
name; a later rename of the organization does not change it, so it
|
||||
can differ from the current name.
|
||||
additionalProperties: false
|
||||
required:
|
||||
- id
|
||||
- name
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
format: uuid
|
||||
description: Identifier of the organization.
|
||||
name:
|
||||
type: string
|
||||
minLength: 1
|
||||
maxLength: 200
|
||||
description: >-
|
||||
Name of the organization in the consent text at the time of the
|
||||
consent. Plain text; clients show it as text, never as HTML.
|
||||
ConsentRecord:
|
||||
type: object
|
||||
description: >-
|
||||
One record of the consent ledger as its subject reads it: the purpose,
|
||||
the text version the subject accepted, where and when the consent was
|
||||
given, its state, and the revocation. A c4 record also names the
|
||||
organization, the contact fields, and the invitation with its terms
|
||||
version; these fields are null for every other purpose. The server
|
||||
also stores the SHA-256 hash of exactly the text the subject saw,
|
||||
which a client never sends or receives.
|
||||
additionalProperties: false
|
||||
required:
|
||||
- id
|
||||
- purpose
|
||||
- state
|
||||
- text_version
|
||||
- source
|
||||
- granted_at
|
||||
- revoked_at
|
||||
- revocation_source
|
||||
- organization
|
||||
- fields
|
||||
- invitation_id
|
||||
- invitation_terms_version
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
format: uuid
|
||||
description: Identifier of the record.
|
||||
purpose:
|
||||
$ref: "#/schemas/ConsentPurposeCode"
|
||||
state:
|
||||
$ref: "#/schemas/ConsentState"
|
||||
text_version:
|
||||
description: Version of the consent text that the subject accepted.
|
||||
allOf:
|
||||
- $ref: "./identity_schemas.yml#/schemas/ConsentTextVersion"
|
||||
source:
|
||||
$ref: "#/schemas/ConsentSource"
|
||||
granted_at:
|
||||
$ref: "./common_schemas.yml#/schemas/Timestamp"
|
||||
revoked_at:
|
||||
description: Moment of the revocation, or null unless `state` is `revoked`.
|
||||
oneOf:
|
||||
- $ref: "./common_schemas.yml#/schemas/Timestamp"
|
||||
- type: "null"
|
||||
revocation_source:
|
||||
description: Who recorded the revocation, or null unless `state` is `revoked`.
|
||||
oneOf:
|
||||
- $ref: "#/schemas/ConsentRevocationSource"
|
||||
- type: "null"
|
||||
organization:
|
||||
description: >-
|
||||
Organization that a c4 consent allows to read the fields, with the
|
||||
name the consent text showed, or null for every other purpose.
|
||||
oneOf:
|
||||
- $ref: "#/schemas/ConsentOrganization"
|
||||
- type: "null"
|
||||
fields:
|
||||
type:
|
||||
- array
|
||||
- "null"
|
||||
minItems: 1
|
||||
maxItems: 4
|
||||
uniqueItems: true
|
||||
description: >-
|
||||
Contact fields that a c4 consent covers, or null for every other
|
||||
purpose. One kind never implies another.
|
||||
items:
|
||||
$ref: "./contact_grant_schemas.yml#/schemas/ContactFieldKind"
|
||||
invitation_id:
|
||||
type:
|
||||
- string
|
||||
- "null"
|
||||
format: uuid
|
||||
description: >-
|
||||
Invitation whose acceptance gave a c4 consent, or null for every
|
||||
other purpose.
|
||||
invitation_terms_version:
|
||||
description: >-
|
||||
Terms version that the acceptance accepted, or null for every
|
||||
other purpose.
|
||||
oneOf:
|
||||
- $ref: "./invitation_schemas.yml#/schemas/InvitationTermsVersion"
|
||||
- type: "null"
|
||||
ConsentRecordList:
|
||||
type: object
|
||||
description: >-
|
||||
One page of the consent ledger of the current account, newest grant
|
||||
first.
|
||||
additionalProperties: false
|
||||
required:
|
||||
- items
|
||||
- page
|
||||
properties:
|
||||
items:
|
||||
type: array
|
||||
maxItems: 100
|
||||
description: Records of the page.
|
||||
items:
|
||||
$ref: "#/schemas/ConsentRecord"
|
||||
page:
|
||||
$ref: "./common_schemas.yml#/schemas/PageInfo"
|
||||
Reference in new issue
Block a user