mirror of
https://github.com/goauthentik/authentik
synced 2026-05-11 09:26:22 +02:00
api: allow configuring default page_size and max_page_size (#18158)
This commit is contained in:
@@ -5,6 +5,7 @@ from rest_framework import pagination
|
||||
from rest_framework.response import Response
|
||||
|
||||
from authentik.api.v3.schema.response import PAGINATION
|
||||
from authentik.lib.config import CONFIG
|
||||
|
||||
|
||||
class Pagination(pagination.PageNumberPagination):
|
||||
@@ -12,6 +13,7 @@ class Pagination(pagination.PageNumberPagination):
|
||||
|
||||
page_query_param = "page"
|
||||
page_size_query_param = "page_size"
|
||||
max_page_size = CONFIG.get("pagination.max_page_size")
|
||||
|
||||
def get_paginated_response(self, data):
|
||||
previous_page_number = 0
|
||||
|
||||
@@ -92,6 +92,9 @@ throttle:
|
||||
device: 20/hour
|
||||
default: 1000/second
|
||||
|
||||
pagination:
|
||||
page_size: 100
|
||||
|
||||
outposts:
|
||||
# Placeholders:
|
||||
# %(type)s: Outpost type; proxy, ldap, etc
|
||||
|
||||
@@ -205,7 +205,7 @@ SPECTACULAR_SETTINGS = {
|
||||
|
||||
REST_FRAMEWORK = {
|
||||
"DEFAULT_PAGINATION_CLASS": "authentik.api.pagination.Pagination",
|
||||
"PAGE_SIZE": 100,
|
||||
"PAGE_SIZE": CONFIG.get("pagination.page_size", 100),
|
||||
"DEFAULT_FILTER_BACKENDS": [
|
||||
"authentik.rbac.filters.ObjectFilter",
|
||||
"django_filters.rest_framework.DjangoFilterBackend",
|
||||
|
||||
@@ -483,6 +483,16 @@ Configure how long unauthenticated sessions last for. Does not impact how long a
|
||||
|
||||
Defaults to `days=1`.
|
||||
|
||||
### `AUTHENTIK_PAGINATION__PAGE_SIZE`:ak-version[2026.2]
|
||||
|
||||
Configure the default number of items per page returned on paginated endpoints.
|
||||
|
||||
Defaults to `100`.
|
||||
|
||||
### `AUTHENTIK_PAGINATION__MAX_PAGE_SIZE`:ak-version[2026.2]
|
||||
|
||||
Configure the maximum number of items per page returned on paginated endpoints.
|
||||
|
||||
### `AUTHENTIK_WEB__WORKERS`
|
||||
|
||||
Configure how many gunicorn worker processes should be started (see https://docs.gunicorn.org/en/stable/design.html).
|
||||
|
||||
Reference in New Issue
Block a user