Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ class UserBody(StrictBaseModel):
password: SecretStr


class UserPatchBody(StrictBaseModel):
"""Incoming payload for updating a user (all fields optional)."""

username: str | None = Field(default=None, min_length=1)
email: str | None = Field(default=None, min_length=1)
first_name: str | None = Field(default=None, min_length=1)
last_name: str | None = Field(default=None, min_length=1)
roles: list[Role] | None = None
password: SecretStr | None = None


class UserResponse(BaseModel):
"""Outgoing representation of a user (no password)."""

Expand All @@ -48,3 +59,10 @@ class UserResponse(BaseModel):
fail_login_count: int | None = None
created_on: UtcDateTime | None = None
changed_on: UtcDateTime | None = None


class UserCollectionResponse(BaseModel):
"""Response model for a collection of users."""

users: list[UserResponse]
total_entries: int
Original file line number Diff line number Diff line change
Expand Up @@ -404,12 +404,15 @@ paths:
- FabAuthManager
summary: Create User
operationId: create_user
security:
- OAuth2PasswordBearer: []
- HTTPBearer: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UserBody'
required: true
responses:
'200':
description: Successful Response
Expand All @@ -418,44 +421,278 @@ paths:
schema:
$ref: '#/components/schemas/UserResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPExceptionResponse'
description: Bad Request
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPExceptionResponse'
description: Unauthorized
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPExceptionResponse'
description: Forbidden
'409':
description: Conflict
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPExceptionResponse'
description: Conflict
'500':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPExceptionResponse'
description: Internal Server Error
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
get:
tags:
- FabAuthManager
summary: Get Users
description: List users with pagination and ordering.
operationId: get_users
security:
- OAuth2PasswordBearer: []
- HTTPBearer: []
parameters:
- name: order_by
in: query
required: false
schema:
type: string
description: Field to order by. Prefix with '-' for descending.
default: id
title: Order By
description: Field to order by. Prefix with '-' for descending.
- name: offset
in: query
required: false
schema:
type: integer
minimum: 0
description: Number of items to skip before starting to collect results.
default: 0
title: Offset
description: Number of items to skip before starting to collect results.
- name: limit
in: query
required: false
schema:
type: integer
minimum: 0
default: 100
title: Limit
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/UserCollectionResponse'
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPExceptionResponse'
description: Bad Request
'401':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPExceptionResponse'
description: Unauthorized
'403':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPExceptionResponse'
description: Forbidden
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/auth/fab/v1/users/{username}:
get:
tags:
- FabAuthManager
summary: Get User
description: Get a user by username.
operationId: get_user
security:
- OAuth2PasswordBearer: []
- HTTPBearer: []
parameters:
- name: username
in: path
required: true
schema:
type: string
minLength: 1
title: Username
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/UserResponse'
'401':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPExceptionResponse'
description: Unauthorized
'403':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPExceptionResponse'
description: Forbidden
'404':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPExceptionResponse'
description: Not Found
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
patch:
tags:
- FabAuthManager
summary: Update User
description: Update an existing user.
operationId: update_user
security:
- OAuth2PasswordBearer: []
- HTTPBearer: []
parameters:
- name: username
in: path
required: true
schema:
type: string
minLength: 1
title: Username
- name: update_mask
in: query
required: false
schema:
anyOf:
- type: string
- type: 'null'
description: Comma-separated list of fields to update
title: Update Mask
description: Comma-separated list of fields to update
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UserPatchBody'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/UserResponse'
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPExceptionResponse'
description: Bad Request
'401':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPExceptionResponse'
description: Unauthorized
'403':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPExceptionResponse'
description: Forbidden
'404':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPExceptionResponse'
description: Not Found
'409':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPExceptionResponse'
description: Conflict
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
delete:
tags:
- FabAuthManager
summary: Delete User
description: Delete a user by username.
operationId: delete_user
security:
- OAuth2PasswordBearer: []
- HTTPBearer: []
parameters:
- name: username
in: path
required: true
schema:
type: string
minLength: 1
title: Username
responses:
'204':
description: Successful Response
'401':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPExceptionResponse'
description: Unauthorized
'403':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPExceptionResponse'
description: Forbidden
'404':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPExceptionResponse'
description: Not Found
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
components:
schemas:
Action:
Expand Down Expand Up @@ -620,6 +857,66 @@ components:
- password
title: UserBody
description: Incoming payload for creating a user.
UserCollectionResponse:
properties:
users:
items:
$ref: '#/components/schemas/UserResponse'
type: array
title: Users
total_entries:
type: integer
title: Total Entries
type: object
required:
- users
- total_entries
title: UserCollectionResponse
description: Response model for a collection of users.
UserPatchBody:
properties:
username:
anyOf:
- type: string
minLength: 1
- type: 'null'
title: Username
email:
anyOf:
- type: string
minLength: 1
- type: 'null'
title: Email
first_name:
anyOf:
- type: string
minLength: 1
- type: 'null'
title: First Name
last_name:
anyOf:
- type: string
minLength: 1
- type: 'null'
title: Last Name
roles:
anyOf:
- items:
$ref: '#/components/schemas/Role'
type: array
- type: 'null'
title: Roles
password:
anyOf:
- type: string
format: password
writeOnly: true
- type: 'null'
title: Password
additionalProperties: false
type: object
title: UserPatchBody
description: Incoming payload for updating a user (all fields optional).
UserResponse:
properties:
username:
Expand Down
Loading
Loading