core: add additional filters to source viewset
https://github.com/goauthentik/terraform-provider-authentik/issues/184 Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
210775776f
commit
817d538b8f
|
@ -8,7 +8,7 @@ from rest_framework.decorators import action
|
||||||
from rest_framework.filters import OrderingFilter, SearchFilter
|
from rest_framework.filters import OrderingFilter, SearchFilter
|
||||||
from rest_framework.request import Request
|
from rest_framework.request import Request
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework.serializers import ModelSerializer, SerializerMethodField
|
from rest_framework.serializers import ModelSerializer, SerializerMethodField, ReadOnlyField
|
||||||
from rest_framework.viewsets import GenericViewSet
|
from rest_framework.viewsets import GenericViewSet
|
||||||
from structlog.stdlib import get_logger
|
from structlog.stdlib import get_logger
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ LOGGER = get_logger()
|
||||||
class SourceSerializer(ModelSerializer, MetaNameSerializer):
|
class SourceSerializer(ModelSerializer, MetaNameSerializer):
|
||||||
"""Source Serializer"""
|
"""Source Serializer"""
|
||||||
|
|
||||||
|
managed = ReadOnlyField()
|
||||||
component = SerializerMethodField()
|
component = SerializerMethodField()
|
||||||
|
|
||||||
def get_component(self, obj: Source) -> str:
|
def get_component(self, obj: Source) -> str:
|
||||||
|
@ -51,6 +52,7 @@ class SourceSerializer(ModelSerializer, MetaNameSerializer):
|
||||||
"meta_model_name",
|
"meta_model_name",
|
||||||
"policy_engine_mode",
|
"policy_engine_mode",
|
||||||
"user_matching_mode",
|
"user_matching_mode",
|
||||||
|
"managed",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,6 +69,7 @@ class SourceViewSet(
|
||||||
serializer_class = SourceSerializer
|
serializer_class = SourceSerializer
|
||||||
lookup_field = "slug"
|
lookup_field = "slug"
|
||||||
search_fields = ["slug", "name"]
|
search_fields = ["slug", "name"]
|
||||||
|
filterset_fields = ["slug", "name", "managed"]
|
||||||
|
|
||||||
def get_queryset(self): # pragma: no cover
|
def get_queryset(self): # pragma: no cover
|
||||||
return Source.objects.select_subclasses()
|
return Source.objects.select_subclasses()
|
||||||
|
|
62
schema.yml
62
schema.yml
|
@ -11862,6 +11862,14 @@ paths:
|
||||||
operationId: sources_all_list
|
operationId: sources_all_list
|
||||||
description: Source Viewset
|
description: Source Viewset
|
||||||
parameters:
|
parameters:
|
||||||
|
- in: query
|
||||||
|
name: managed
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
- in: query
|
||||||
|
name: name
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
- name: ordering
|
- name: ordering
|
||||||
required: false
|
required: false
|
||||||
in: query
|
in: query
|
||||||
|
@ -11886,6 +11894,10 @@ paths:
|
||||||
description: A search term.
|
description: A search term.
|
||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
|
- in: query
|
||||||
|
name: slug
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
tags:
|
tags:
|
||||||
- sources
|
- sources
|
||||||
security:
|
security:
|
||||||
|
@ -22678,6 +22690,15 @@ components:
|
||||||
- $ref: '#/components/schemas/UserMatchingModeEnum'
|
- $ref: '#/components/schemas/UserMatchingModeEnum'
|
||||||
description: How the source determines if an existing user should be authenticated
|
description: How the source determines if an existing user should be authenticated
|
||||||
or a new user enrolled.
|
or a new user enrolled.
|
||||||
|
managed:
|
||||||
|
type: string
|
||||||
|
nullable: true
|
||||||
|
title: Managed by authentik
|
||||||
|
description: Objects which are managed by authentik. These objects are created
|
||||||
|
and updated automatically. This is flag only indicates that an object
|
||||||
|
can be overwritten by migrations. You can still modify the objects via
|
||||||
|
the API, but expect changes to be overwritten in a later update.
|
||||||
|
readOnly: true
|
||||||
server_uri:
|
server_uri:
|
||||||
type: string
|
type: string
|
||||||
format: uri
|
format: uri
|
||||||
|
@ -22740,6 +22761,7 @@ components:
|
||||||
required:
|
required:
|
||||||
- base_dn
|
- base_dn
|
||||||
- component
|
- component
|
||||||
|
- managed
|
||||||
- meta_model_name
|
- meta_model_name
|
||||||
- name
|
- name
|
||||||
- pk
|
- pk
|
||||||
|
@ -23394,6 +23416,15 @@ components:
|
||||||
- $ref: '#/components/schemas/UserMatchingModeEnum'
|
- $ref: '#/components/schemas/UserMatchingModeEnum'
|
||||||
description: How the source determines if an existing user should be authenticated
|
description: How the source determines if an existing user should be authenticated
|
||||||
or a new user enrolled.
|
or a new user enrolled.
|
||||||
|
managed:
|
||||||
|
type: string
|
||||||
|
nullable: true
|
||||||
|
title: Managed by authentik
|
||||||
|
description: Objects which are managed by authentik. These objects are created
|
||||||
|
and updated automatically. This is flag only indicates that an object
|
||||||
|
can be overwritten by migrations. You can still modify the objects via
|
||||||
|
the API, but expect changes to be overwritten in a later update.
|
||||||
|
readOnly: true
|
||||||
provider_type:
|
provider_type:
|
||||||
$ref: '#/components/schemas/ProviderTypeEnum'
|
$ref: '#/components/schemas/ProviderTypeEnum'
|
||||||
request_token_url:
|
request_token_url:
|
||||||
|
@ -23439,6 +23470,7 @@ components:
|
||||||
- callback_url
|
- callback_url
|
||||||
- component
|
- component
|
||||||
- consumer_key
|
- consumer_key
|
||||||
|
- managed
|
||||||
- meta_model_name
|
- meta_model_name
|
||||||
- name
|
- name
|
||||||
- pk
|
- pk
|
||||||
|
@ -28620,6 +28652,15 @@ components:
|
||||||
- $ref: '#/components/schemas/UserMatchingModeEnum'
|
- $ref: '#/components/schemas/UserMatchingModeEnum'
|
||||||
description: How the source determines if an existing user should be authenticated
|
description: How the source determines if an existing user should be authenticated
|
||||||
or a new user enrolled.
|
or a new user enrolled.
|
||||||
|
managed:
|
||||||
|
type: string
|
||||||
|
nullable: true
|
||||||
|
title: Managed by authentik
|
||||||
|
description: Objects which are managed by authentik. These objects are created
|
||||||
|
and updated automatically. This is flag only indicates that an object
|
||||||
|
can be overwritten by migrations. You can still modify the objects via
|
||||||
|
the API, but expect changes to be overwritten in a later update.
|
||||||
|
readOnly: true
|
||||||
client_id:
|
client_id:
|
||||||
type: string
|
type: string
|
||||||
description: Client identifier used to talk to Plex.
|
description: Client identifier used to talk to Plex.
|
||||||
|
@ -28637,6 +28678,7 @@ components:
|
||||||
description: Plex token used to check friends
|
description: Plex token used to check friends
|
||||||
required:
|
required:
|
||||||
- component
|
- component
|
||||||
|
- managed
|
||||||
- meta_model_name
|
- meta_model_name
|
||||||
- name
|
- name
|
||||||
- pk
|
- pk
|
||||||
|
@ -30011,6 +30053,15 @@ components:
|
||||||
- $ref: '#/components/schemas/UserMatchingModeEnum'
|
- $ref: '#/components/schemas/UserMatchingModeEnum'
|
||||||
description: How the source determines if an existing user should be authenticated
|
description: How the source determines if an existing user should be authenticated
|
||||||
or a new user enrolled.
|
or a new user enrolled.
|
||||||
|
managed:
|
||||||
|
type: string
|
||||||
|
nullable: true
|
||||||
|
title: Managed by authentik
|
||||||
|
description: Objects which are managed by authentik. These objects are created
|
||||||
|
and updated automatically. This is flag only indicates that an object
|
||||||
|
can be overwritten by migrations. You can still modify the objects via
|
||||||
|
the API, but expect changes to be overwritten in a later update.
|
||||||
|
readOnly: true
|
||||||
pre_authentication_flow:
|
pre_authentication_flow:
|
||||||
type: string
|
type: string
|
||||||
format: uuid
|
format: uuid
|
||||||
|
@ -30059,6 +30110,7 @@ components:
|
||||||
doesn''t log out manually. (Format: hours=1;minutes=2;seconds=3).'
|
doesn''t log out manually. (Format: hours=1;minutes=2;seconds=3).'
|
||||||
required:
|
required:
|
||||||
- component
|
- component
|
||||||
|
- managed
|
||||||
- meta_model_name
|
- meta_model_name
|
||||||
- name
|
- name
|
||||||
- pk
|
- pk
|
||||||
|
@ -30437,8 +30489,18 @@ components:
|
||||||
- $ref: '#/components/schemas/UserMatchingModeEnum'
|
- $ref: '#/components/schemas/UserMatchingModeEnum'
|
||||||
description: How the source determines if an existing user should be authenticated
|
description: How the source determines if an existing user should be authenticated
|
||||||
or a new user enrolled.
|
or a new user enrolled.
|
||||||
|
managed:
|
||||||
|
type: string
|
||||||
|
nullable: true
|
||||||
|
title: Managed by authentik
|
||||||
|
description: Objects which are managed by authentik. These objects are created
|
||||||
|
and updated automatically. This is flag only indicates that an object
|
||||||
|
can be overwritten by migrations. You can still modify the objects via
|
||||||
|
the API, but expect changes to be overwritten in a later update.
|
||||||
|
readOnly: true
|
||||||
required:
|
required:
|
||||||
- component
|
- component
|
||||||
|
- managed
|
||||||
- meta_model_name
|
- meta_model_name
|
||||||
- name
|
- name
|
||||||
- pk
|
- pk
|
||||||
|
|
Reference in New Issue