40 lines
2.8 KiB
YAML
40 lines
2.8 KiB
YAML
get:
|
|
operationId: ListMyOrganizations
|
|
summary: List the organizations available to the current account.
|
|
description: |-
|
|
Requires the session cookie of an employer account. The account comes from the session, never from a request parameter, so the response holds only the caller's own memberships and no request can name another account.
|
|
|
|
Returns a page of the organizations in which the caller has an `active` membership, newest membership first with the organization identifier as the tie-breaker, with cursor pagination. Each item names the organization (`OrganizationSummary`) and holds the caller's role and state in it (`OrganizationMembership`). A membership in another state (`suspended`, `removed`, `left`) does not list its organization, so an organization the caller cannot enter is never named, and one that the caller was removed from disappears from the list at once.
|
|
|
|
The list is the directory of the active organization context. The context is not stored on the server: every organization-scoped operation names its organization in the path `org_id`, and the server checks that identifier against the caller's active membership on every request, so a switch between organizations is a different `org_id` in the client's routes and cannot outlive a revoked membership. A client picks the context from this list, may remember the last choice in the browser as a convenience, and must read the list again after any answer 404 `not_found` from an organization path. An account with several memberships sees all of them here and works in one at a time; the rights and the data of the organizations stay separate.
|
|
|
|
Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated; a candidate account answers 403 forbidden. An employer account without an organization gets an empty page, which tells the client to offer CreateOrganization. A malformed `limit` or `cursor` answers 400 validation_failed.
|
|
security:
|
|
- sessionCookie: []
|
|
tags:
|
|
- organization
|
|
parameters:
|
|
- $ref: ../components/parameters.yml#/PageLimit
|
|
- $ref: ../components/parameters.yml#/PageCursor
|
|
responses:
|
|
"200":
|
|
description: A page of the organizations available to the current account.
|
|
headers:
|
|
Cache-Control:
|
|
$ref: ../components/headers.yml#/CacheControlNoStore
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: ../components/schemas.yml#/MyOrganizationList
|
|
examples:
|
|
one_organization:
|
|
$ref: ../components/examples.yml#/MyOrganizationListPage
|
|
"400":
|
|
$ref: ../components/responses.yml#/ValidationFailed
|
|
"401":
|
|
$ref: ../components/responses.yml#/Unauthenticated
|
|
"403":
|
|
$ref: ../components/responses.yml#/Forbidden
|
|
default:
|
|
$ref: ../components/responses.yml#/Problem
|