Merged in feature/textExtractionsPart4 (pull request #197)
implement GET /identity * GET /identity
This commit is contained in:
@@ -1377,6 +1377,44 @@ paths:
|
||||
$ref: "#/components/responses/TooManyRequests"
|
||||
"500":
|
||||
$ref: "#/components/responses/InternalError"
|
||||
|
||||
/identity:
|
||||
get:
|
||||
operationId: getIdentity
|
||||
tags:
|
||||
- AuthService
|
||||
summary: Get current user identity and roles
|
||||
description: >-
|
||||
Returns the authenticated user's assigned roles from Permit.io,
|
||||
including the permissions granted by each role.
|
||||
Any authenticated user can call this endpoint to discover their own roles.
|
||||
security:
|
||||
- jwtAuth: []
|
||||
responses:
|
||||
"200":
|
||||
description: User roles and permissions retrieved successfully.
|
||||
headers:
|
||||
RateLimit:
|
||||
$ref: "#/components/headers/RateLimit"
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/IdentityResponse"
|
||||
"400":
|
||||
$ref: "#/components/responses/InvalidRequest"
|
||||
"401":
|
||||
$ref: "#/components/responses/Unauthorized"
|
||||
"429":
|
||||
$ref: "#/components/responses/TooManyRequests"
|
||||
"500":
|
||||
$ref: "#/components/responses/InternalError"
|
||||
"502":
|
||||
description: Failed to retrieve roles from Permit.io
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/ErrorMessage"
|
||||
|
||||
/home:
|
||||
get:
|
||||
operationId: getHomePage
|
||||
@@ -2702,6 +2740,55 @@ components:
|
||||
example:
|
||||
message: you must include a message
|
||||
|
||||
# Identity API schemas
|
||||
IdentityRole:
|
||||
type: object
|
||||
description: A role assigned to the user with its permissions
|
||||
required:
|
||||
- key
|
||||
- name
|
||||
- permissions
|
||||
properties:
|
||||
key:
|
||||
type: string
|
||||
description: The role key/identifier
|
||||
maxLength: 128
|
||||
pattern: "^[a-z0-9_-]+$"
|
||||
example: "auditor"
|
||||
name:
|
||||
type: string
|
||||
description: Human-readable role name
|
||||
maxLength: 256
|
||||
pattern: "^.+$"
|
||||
example: "Auditor"
|
||||
description:
|
||||
type: string
|
||||
description: Optional description of the role
|
||||
maxLength: 1024
|
||||
example: "Read-only access to view documents and exports"
|
||||
permissions:
|
||||
type: array
|
||||
description: List of permissions granted by this role
|
||||
maxItems: 500
|
||||
items:
|
||||
type: string
|
||||
maxLength: 128
|
||||
pattern: "^[a-z0-9_-]+:[a-z0-9_-]+$"
|
||||
example: ["document:read", "document:list", "export:read"]
|
||||
|
||||
IdentityResponse:
|
||||
type: object
|
||||
description: Response containing the user's roles and their permissions
|
||||
required:
|
||||
- roles
|
||||
properties:
|
||||
roles:
|
||||
type: array
|
||||
description: List of roles assigned to the user with their permissions
|
||||
maxItems: 100
|
||||
items:
|
||||
$ref: "#/components/schemas/IdentityRole"
|
||||
|
||||
# Admin API schemas
|
||||
AdminUserCreate:
|
||||
description: Request body for creating a new user with email, name, and role assignments
|
||||
|
||||
Reference in New Issue
Block a user