101 lines
6.2 KiB
YAML
101 lines
6.2 KiB
YAML
get:
|
|
operationId: GetOrganization
|
|
summary: Read an organization of which the caller is a member.
|
|
description: |-
|
|
Requires the session cookie of an employer account with an active membership in `org_id`. The organization comes from the path and is checked against the membership that the server holds for the session account on every request; the identifier itself grants nothing.
|
|
|
|
Returns the profile with its current `version`, the verification level (`verification`), and the card as a candidate sees it (`candidate_card`). The verification level is always the one the server holds: it never rises because the profile is complete, because the organization has members, or because of an email domain. The role of the caller is not part of this resource; ListMyOrganizations returns it with the membership.
|
|
|
|
In the MVP the profile is readable by any active member; every member is an owner, because the operations that add members are planned. The roles of PRD FR07 that read a company card without managing it change no field of this contract.
|
|
|
|
Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated; a candidate account answers 403 forbidden; an account without an active membership in the organization, including a `suspended`, `removed`, or `left` one, and an unknown organization all answer 404 not_found, so organizations cannot be enumerated. A malformed `org_id` answers 400 validation_failed with the path pointer.
|
|
security:
|
|
- sessionCookie: []
|
|
tags:
|
|
- organization
|
|
parameters:
|
|
- $ref: ../components/parameters.yml#/OrganizationId
|
|
responses:
|
|
"200":
|
|
description: The organization.
|
|
headers:
|
|
Cache-Control:
|
|
$ref: ../components/headers.yml#/CacheControlNoStore
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: ../components/schemas.yml#/Organization
|
|
examples:
|
|
name_only:
|
|
$ref: ../components/examples.yml#/OrganizationNameOnly
|
|
complete_card:
|
|
$ref: ../components/examples.yml#/OrganizationCompleteCard
|
|
"400":
|
|
$ref: ../components/responses.yml#/ValidationFailed
|
|
"401":
|
|
$ref: ../components/responses.yml#/Unauthenticated
|
|
"403":
|
|
$ref: ../components/responses.yml#/Forbidden
|
|
"404":
|
|
$ref: ../components/responses.yml#/NotFound
|
|
default:
|
|
$ref: ../components/responses.yml#/Problem
|
|
patch:
|
|
operationId: UpdateOrganization
|
|
summary: Change the profile of an organization.
|
|
description: |-
|
|
Requires the session cookie of an employer account with an active membership in `org_id`, the CSRF token of that session in X-CSRF-Token, and an allowed Origin. Only the owner manages the organization (the FR07 matrix gives this to no other role), so a member with another role answers 403 forbidden. The role comes from the server-side membership; the body has no organization, membership, role, owner, or verification field.
|
|
|
|
Merge rules: the body is `application/json` with explicit field replacement, not JSON Merge Patch. Each field present replaces that field as a whole and an absent field stays unchanged; `contacts` and `representatives` are replaced entirely and never merged. `description` and `sphere` sent as null become unset; `name`, `contacts`, and `representatives` cannot be null.
|
|
|
|
The body can change the profile only. The verification level, its basis, the card, the members, and every role are not fields of it, and unknown fields fail validation, so the owner can neither raise the trust level of the organization nor the rights of anyone by editing the profile; a longer description, a verified-looking website, or a new representative leaves the level unchanged. The level and the roles change only through processes of the server.
|
|
|
|
Versions: every committed change creates version `expected_version + 1` and answers 200 with the organization. `expected_version` is the `version` the client read; when it is not current, the server answers 412 version_conflict and changes nothing, and the client reads the organization again and reapplies its edits. The version travels in the body rather than in If-Match because the generated client cannot read the ETag response header yet, as for needs. A body that changes nothing when applied to the current profile keeps the version and answers 200 with the current organization even when `expected_version` is older, so the operation needs no Idempotency-Key and a retry of a change that already succeeded is harmless.
|
|
|
|
Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400), account scenario (403 forbidden for a candidate account), membership (404 not_found) and role (403 forbidden), a body that changes nothing (200), the version (412), domain rules (400 with a pointer such as `/contacts/website`, `/name`, or `/representatives/0/job_title`). The general rate limit can answer 429 with Retry-After before any check.
|
|
security:
|
|
- sessionCookie: []
|
|
sessionCsrf: []
|
|
tags:
|
|
- organization
|
|
parameters:
|
|
- $ref: ../components/parameters.yml#/OrganizationId
|
|
requestBody:
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: ../components/schemas.yml#/OrganizationUpdate
|
|
examples:
|
|
complete_card:
|
|
$ref: ../components/examples.yml#/OrganizationUpdateCompleteCard
|
|
responses:
|
|
"200":
|
|
description: >-
|
|
The organization after the change, or the current organization when
|
|
the body changes nothing.
|
|
headers:
|
|
Cache-Control:
|
|
$ref: ../components/headers.yml#/CacheControlNoStore
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: ../components/schemas.yml#/Organization
|
|
examples:
|
|
complete_card:
|
|
$ref: ../components/examples.yml#/OrganizationCompleteCard
|
|
"400":
|
|
$ref: ../components/responses.yml#/OrganizationValidationFailed
|
|
"401":
|
|
$ref: ../components/responses.yml#/Unauthenticated
|
|
"403":
|
|
$ref: ../components/responses.yml#/CsrfCheckFailedOrForbidden
|
|
"404":
|
|
$ref: ../components/responses.yml#/NotFound
|
|
"412":
|
|
$ref: ../components/responses.yml#/OrganizationVersionConflict
|
|
"429":
|
|
$ref: ../components/responses.yml#/TooManyRequests
|
|
default:
|
|
$ref: ../components/responses.yml#/Problem
|