From f4a68c7878dbe5b07bef051b81d17b93f080f3b6 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Tue, 1 Jul 2025 21:46:35 +0200 Subject: [PATCH] use nested for RAC Signed-off-by: Jens Langhammer --- .../providers/rac/api/connection_tokens.py | 15 +- authentik/providers/rac/api/endpoints.py | 7 +- authentik/providers/rac/urls.py | 9 +- schema.yml | 1092 +++++++++-------- .../providers/rac/ConnectionTokenList.ts | 12 +- web/src/admin/providers/rac/EndpointForm.ts | 11 +- web/src/admin/providers/rac/EndpointList.ts | 12 +- .../RACLaunchEndpointModal.ts | 6 +- 8 files changed, 621 insertions(+), 543 deletions(-) diff --git a/authentik/providers/rac/api/connection_tokens.py b/authentik/providers/rac/api/connection_tokens.py index c6de12b1c2..63f7ec163e 100644 --- a/authentik/providers/rac/api/connection_tokens.py +++ b/authentik/providers/rac/api/connection_tokens.py @@ -40,9 +40,16 @@ class ConnectionTokenViewSet( ): """ConnectionToken Viewset""" - queryset = ConnectionToken.objects.all().select_related("session", "endpoint") + queryset = ConnectionToken.objects.none() serializer_class = ConnectionTokenSerializer - filterset_fields = ["endpoint", "session__user", "provider"] - search_fields = ["endpoint__name", "provider__name"] - ordering = ["endpoint__name", "provider__name"] + filterset_fields = ["endpoint", "session__user"] + search_fields = ["endpoint__name", "session__user__username"] + ordering = ["endpoint__name", "session__user__username"] owner_field = "session__user" + + def get_queryset(self): + return ( + ConnectionToken.objects.all() + .select_related("session", "endpoint") + .filter(provider=self.kwargs["provider_pk"]) + ) diff --git a/authentik/providers/rac/api/endpoints.py b/authentik/providers/rac/api/endpoints.py index 4f63976158..7c676e9313 100644 --- a/authentik/providers/rac/api/endpoints.py +++ b/authentik/providers/rac/api/endpoints.py @@ -65,12 +65,15 @@ class EndpointSerializer(ModelSerializer): class EndpointViewSet(UsedByMixin, ModelViewSet): """Endpoint Viewset""" - queryset = Endpoint.objects.all() + queryset = Endpoint.objects.none() serializer_class = EndpointSerializer - filterset_fields = ["name", "provider"] + filterset_fields = ["name"] search_fields = ["name", "protocol"] ordering = ["name", "protocol"] + def get_queryset(self): + return Endpoint.objects.filter(provider=self.kwargs["provider_pk"]) + def _filter_queryset_for_list(self, queryset: QuerySet) -> QuerySet: """Custom filter_queryset method which ignores guardian, but still supports sorting""" for backend in list(self.filter_backends): diff --git a/authentik/providers/rac/urls.py b/authentik/providers/rac/urls.py index a9322f4400..1993fdb6cb 100644 --- a/authentik/providers/rac/urls.py +++ b/authentik/providers/rac/urls.py @@ -2,6 +2,7 @@ from django.urls import path +from authentik.api.v3.routers import NestedRouter from authentik.outposts.channels import TokenOutpostMiddleware from authentik.providers.rac.api.connection_tokens import ConnectionTokenViewSet from authentik.providers.rac.api.endpoints import EndpointViewSet @@ -38,8 +39,10 @@ websocket_urlpatterns = [ ] api_urlpatterns = [ - ("providers/rac", RACProviderViewSet), + *NestedRouter() + .register("providers/rac", RACProviderViewSet) + .nested("provider", "endpoints", EndpointViewSet) + .nested("provider", "connection_tokens", ConnectionTokenViewSet) + .urls, ("propertymappings/provider/rac", RACPropertyMappingViewSet), - ("rac/endpoints", EndpointViewSet), - ("rac/connection_tokens", ConnectionTokenViewSet), ] diff --git a/schema.yml b/schema.yml index aa49a98751..897fd6596b 100644 --- a/schema.yml +++ b/schema.yml @@ -22137,6 +22137,581 @@ paths: schema: $ref: '#/components/schemas/GenericError' description: '' + /providers/rac/{provider_pk}/connection_tokens/: + get: + operationId: providers_rac_connection_tokens_list + description: ConnectionToken Viewset + parameters: + - in: query + name: endpoint + schema: + type: string + format: uuid + - name: ordering + required: false + in: query + description: Which field to use when ordering the results. + schema: + type: string + - name: page + required: false + in: query + description: A page number within the paginated result set. + schema: + type: integer + - name: page_size + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - in: path + name: provider_pk + schema: + type: integer + required: true + - name: search + required: false + in: query + description: A search term. + schema: + type: string + - in: query + name: session__user + schema: + type: integer + tags: + - providers + security: + - authentik: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedConnectionTokenList' + description: '' + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: '' + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/GenericError' + description: '' + /providers/rac/{provider_pk}/connection_tokens/{connection_token_uuid}/: + get: + operationId: providers_rac_connection_tokens_retrieve + description: ConnectionToken Viewset + parameters: + - in: path + name: connection_token_uuid + schema: + type: string + format: uuid + description: A UUID string identifying this RAC Connection token. + required: true + - in: path + name: provider_pk + schema: + type: integer + required: true + tags: + - providers + security: + - authentik: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ConnectionToken' + description: '' + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: '' + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/GenericError' + description: '' + put: + operationId: providers_rac_connection_tokens_update + description: ConnectionToken Viewset + parameters: + - in: path + name: connection_token_uuid + schema: + type: string + format: uuid + description: A UUID string identifying this RAC Connection token. + required: true + - in: path + name: provider_pk + schema: + type: integer + required: true + tags: + - providers + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ConnectionTokenRequest' + required: true + security: + - authentik: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ConnectionToken' + description: '' + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: '' + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/GenericError' + description: '' + patch: + operationId: providers_rac_connection_tokens_partial_update + description: ConnectionToken Viewset + parameters: + - in: path + name: connection_token_uuid + schema: + type: string + format: uuid + description: A UUID string identifying this RAC Connection token. + required: true + - in: path + name: provider_pk + schema: + type: integer + required: true + tags: + - providers + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PatchedConnectionTokenRequest' + security: + - authentik: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ConnectionToken' + description: '' + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: '' + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/GenericError' + description: '' + delete: + operationId: providers_rac_connection_tokens_destroy + description: ConnectionToken Viewset + parameters: + - in: path + name: connection_token_uuid + schema: + type: string + format: uuid + description: A UUID string identifying this RAC Connection token. + required: true + - in: path + name: provider_pk + schema: + type: integer + required: true + tags: + - providers + security: + - authentik: [] + responses: + '204': + description: No response body + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: '' + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/GenericError' + description: '' + /providers/rac/{provider_pk}/connection_tokens/{connection_token_uuid}/used_by/: + get: + operationId: providers_rac_connection_tokens_used_by_list + description: Get a list of all objects that use this object + parameters: + - in: path + name: connection_token_uuid + schema: + type: string + format: uuid + description: A UUID string identifying this RAC Connection token. + required: true + - in: path + name: provider_pk + schema: + type: integer + required: true + tags: + - providers + security: + - authentik: [] + responses: + '200': + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/UsedBy' + description: '' + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: '' + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/GenericError' + description: '' + /providers/rac/{provider_pk}/endpoints/: + get: + operationId: providers_rac_endpoints_list + description: List accessible endpoints + parameters: + - in: query + name: name + schema: + type: string + - name: ordering + required: false + in: query + description: Which field to use when ordering the results. + schema: + type: string + - name: page + required: false + in: query + description: A page number within the paginated result set. + schema: + type: integer + - name: page_size + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - in: path + name: provider_pk + schema: + type: integer + required: true + - in: query + name: search + schema: + type: string + - in: query + name: superuser_full_list + schema: + type: boolean + tags: + - providers + security: + - authentik: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedEndpointList' + description: '' + '400': + description: Bad request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/GenericError' + description: '' + post: + operationId: providers_rac_endpoints_create + description: Endpoint Viewset + parameters: + - in: path + name: provider_pk + schema: + type: integer + required: true + tags: + - providers + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/EndpointRequest' + required: true + security: + - authentik: [] + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/Endpoint' + description: '' + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: '' + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/GenericError' + description: '' + /providers/rac/{provider_pk}/endpoints/{pbm_uuid}/: + get: + operationId: providers_rac_endpoints_retrieve + description: Endpoint Viewset + parameters: + - in: path + name: pbm_uuid + schema: + type: string + format: uuid + description: A UUID string identifying this RAC Endpoint. + required: true + - in: path + name: provider_pk + schema: + type: integer + required: true + tags: + - providers + security: + - authentik: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Endpoint' + description: '' + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: '' + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/GenericError' + description: '' + put: + operationId: providers_rac_endpoints_update + description: Endpoint Viewset + parameters: + - in: path + name: pbm_uuid + schema: + type: string + format: uuid + description: A UUID string identifying this RAC Endpoint. + required: true + - in: path + name: provider_pk + schema: + type: integer + required: true + tags: + - providers + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/EndpointRequest' + required: true + security: + - authentik: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Endpoint' + description: '' + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: '' + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/GenericError' + description: '' + patch: + operationId: providers_rac_endpoints_partial_update + description: Endpoint Viewset + parameters: + - in: path + name: pbm_uuid + schema: + type: string + format: uuid + description: A UUID string identifying this RAC Endpoint. + required: true + - in: path + name: provider_pk + schema: + type: integer + required: true + tags: + - providers + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PatchedEndpointRequest' + security: + - authentik: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Endpoint' + description: '' + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: '' + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/GenericError' + description: '' + delete: + operationId: providers_rac_endpoints_destroy + description: Endpoint Viewset + parameters: + - in: path + name: pbm_uuid + schema: + type: string + format: uuid + description: A UUID string identifying this RAC Endpoint. + required: true + - in: path + name: provider_pk + schema: + type: integer + required: true + tags: + - providers + security: + - authentik: [] + responses: + '204': + description: No response body + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: '' + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/GenericError' + description: '' + /providers/rac/{provider_pk}/endpoints/{pbm_uuid}/used_by/: + get: + operationId: providers_rac_endpoints_used_by_list + description: Get a list of all objects that use this object + parameters: + - in: path + name: pbm_uuid + schema: + type: string + format: uuid + description: A UUID string identifying this RAC Endpoint. + required: true + - in: path + name: provider_pk + schema: + type: integer + required: true + tags: + - providers + security: + - authentik: [] + responses: + '200': + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/UsedBy' + description: '' + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: '' + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/GenericError' + description: '' /providers/radius/: get: operationId: providers_radius_list @@ -23939,523 +24514,6 @@ paths: schema: $ref: '#/components/schemas/GenericError' description: '' - /rac/connection_tokens/: - get: - operationId: rac_connection_tokens_list - description: ConnectionToken Viewset - parameters: - - in: query - name: endpoint - schema: - type: string - format: uuid - - name: ordering - required: false - in: query - description: Which field to use when ordering the results. - schema: - type: string - - name: page - required: false - in: query - description: A page number within the paginated result set. - schema: - type: integer - - name: page_size - required: false - in: query - description: Number of results to return per page. - schema: - type: integer - - in: query - name: provider - schema: - type: integer - - name: search - required: false - in: query - description: A search term. - schema: - type: string - - in: query - name: session__user - schema: - type: integer - tags: - - rac - security: - - authentik: [] - responses: - '200': - content: - application/json: - schema: - $ref: '#/components/schemas/PaginatedConnectionTokenList' - description: '' - '400': - content: - application/json: - schema: - $ref: '#/components/schemas/ValidationError' - description: '' - '403': - content: - application/json: - schema: - $ref: '#/components/schemas/GenericError' - description: '' - /rac/connection_tokens/{connection_token_uuid}/: - get: - operationId: rac_connection_tokens_retrieve - description: ConnectionToken Viewset - parameters: - - in: path - name: connection_token_uuid - schema: - type: string - format: uuid - description: A UUID string identifying this RAC Connection token. - required: true - tags: - - rac - security: - - authentik: [] - responses: - '200': - content: - application/json: - schema: - $ref: '#/components/schemas/ConnectionToken' - description: '' - '400': - content: - application/json: - schema: - $ref: '#/components/schemas/ValidationError' - description: '' - '403': - content: - application/json: - schema: - $ref: '#/components/schemas/GenericError' - description: '' - put: - operationId: rac_connection_tokens_update - description: ConnectionToken Viewset - parameters: - - in: path - name: connection_token_uuid - schema: - type: string - format: uuid - description: A UUID string identifying this RAC Connection token. - required: true - tags: - - rac - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/ConnectionTokenRequest' - required: true - security: - - authentik: [] - responses: - '200': - content: - application/json: - schema: - $ref: '#/components/schemas/ConnectionToken' - description: '' - '400': - content: - application/json: - schema: - $ref: '#/components/schemas/ValidationError' - description: '' - '403': - content: - application/json: - schema: - $ref: '#/components/schemas/GenericError' - description: '' - patch: - operationId: rac_connection_tokens_partial_update - description: ConnectionToken Viewset - parameters: - - in: path - name: connection_token_uuid - schema: - type: string - format: uuid - description: A UUID string identifying this RAC Connection token. - required: true - tags: - - rac - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/PatchedConnectionTokenRequest' - security: - - authentik: [] - responses: - '200': - content: - application/json: - schema: - $ref: '#/components/schemas/ConnectionToken' - description: '' - '400': - content: - application/json: - schema: - $ref: '#/components/schemas/ValidationError' - description: '' - '403': - content: - application/json: - schema: - $ref: '#/components/schemas/GenericError' - description: '' - delete: - operationId: rac_connection_tokens_destroy - description: ConnectionToken Viewset - parameters: - - in: path - name: connection_token_uuid - schema: - type: string - format: uuid - description: A UUID string identifying this RAC Connection token. - required: true - tags: - - rac - security: - - authentik: [] - responses: - '204': - description: No response body - '400': - content: - application/json: - schema: - $ref: '#/components/schemas/ValidationError' - description: '' - '403': - content: - application/json: - schema: - $ref: '#/components/schemas/GenericError' - description: '' - /rac/connection_tokens/{connection_token_uuid}/used_by/: - get: - operationId: rac_connection_tokens_used_by_list - description: Get a list of all objects that use this object - parameters: - - in: path - name: connection_token_uuid - schema: - type: string - format: uuid - description: A UUID string identifying this RAC Connection token. - required: true - tags: - - rac - security: - - authentik: [] - responses: - '200': - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/UsedBy' - description: '' - '400': - content: - application/json: - schema: - $ref: '#/components/schemas/ValidationError' - description: '' - '403': - content: - application/json: - schema: - $ref: '#/components/schemas/GenericError' - description: '' - /rac/endpoints/: - get: - operationId: rac_endpoints_list - description: List accessible endpoints - parameters: - - in: query - name: name - schema: - type: string - - name: ordering - required: false - in: query - description: Which field to use when ordering the results. - schema: - type: string - - name: page - required: false - in: query - description: A page number within the paginated result set. - schema: - type: integer - - name: page_size - required: false - in: query - description: Number of results to return per page. - schema: - type: integer - - in: query - name: provider - schema: - type: integer - - in: query - name: search - schema: - type: string - - in: query - name: superuser_full_list - schema: - type: boolean - tags: - - rac - security: - - authentik: [] - responses: - '200': - content: - application/json: - schema: - $ref: '#/components/schemas/PaginatedEndpointList' - description: '' - '400': - description: Bad request - '403': - content: - application/json: - schema: - $ref: '#/components/schemas/GenericError' - description: '' - post: - operationId: rac_endpoints_create - description: Endpoint Viewset - tags: - - rac - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/EndpointRequest' - required: true - security: - - authentik: [] - responses: - '201': - content: - application/json: - schema: - $ref: '#/components/schemas/Endpoint' - description: '' - '400': - content: - application/json: - schema: - $ref: '#/components/schemas/ValidationError' - description: '' - '403': - content: - application/json: - schema: - $ref: '#/components/schemas/GenericError' - description: '' - /rac/endpoints/{pbm_uuid}/: - get: - operationId: rac_endpoints_retrieve - description: Endpoint Viewset - parameters: - - in: path - name: pbm_uuid - schema: - type: string - format: uuid - description: A UUID string identifying this RAC Endpoint. - required: true - tags: - - rac - security: - - authentik: [] - responses: - '200': - content: - application/json: - schema: - $ref: '#/components/schemas/Endpoint' - description: '' - '400': - content: - application/json: - schema: - $ref: '#/components/schemas/ValidationError' - description: '' - '403': - content: - application/json: - schema: - $ref: '#/components/schemas/GenericError' - description: '' - put: - operationId: rac_endpoints_update - description: Endpoint Viewset - parameters: - - in: path - name: pbm_uuid - schema: - type: string - format: uuid - description: A UUID string identifying this RAC Endpoint. - required: true - tags: - - rac - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/EndpointRequest' - required: true - security: - - authentik: [] - responses: - '200': - content: - application/json: - schema: - $ref: '#/components/schemas/Endpoint' - description: '' - '400': - content: - application/json: - schema: - $ref: '#/components/schemas/ValidationError' - description: '' - '403': - content: - application/json: - schema: - $ref: '#/components/schemas/GenericError' - description: '' - patch: - operationId: rac_endpoints_partial_update - description: Endpoint Viewset - parameters: - - in: path - name: pbm_uuid - schema: - type: string - format: uuid - description: A UUID string identifying this RAC Endpoint. - required: true - tags: - - rac - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/PatchedEndpointRequest' - security: - - authentik: [] - responses: - '200': - content: - application/json: - schema: - $ref: '#/components/schemas/Endpoint' - description: '' - '400': - content: - application/json: - schema: - $ref: '#/components/schemas/ValidationError' - description: '' - '403': - content: - application/json: - schema: - $ref: '#/components/schemas/GenericError' - description: '' - delete: - operationId: rac_endpoints_destroy - description: Endpoint Viewset - parameters: - - in: path - name: pbm_uuid - schema: - type: string - format: uuid - description: A UUID string identifying this RAC Endpoint. - required: true - tags: - - rac - security: - - authentik: [] - responses: - '204': - description: No response body - '400': - content: - application/json: - schema: - $ref: '#/components/schemas/ValidationError' - description: '' - '403': - content: - application/json: - schema: - $ref: '#/components/schemas/GenericError' - description: '' - /rac/endpoints/{pbm_uuid}/used_by/: - get: - operationId: rac_endpoints_used_by_list - description: Get a list of all objects that use this object - parameters: - - in: path - name: pbm_uuid - schema: - type: string - format: uuid - description: A UUID string identifying this RAC Endpoint. - required: true - tags: - - rac - security: - - authentik: [] - responses: - '200': - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/UsedBy' - description: '' - '400': - content: - application/json: - schema: - $ref: '#/components/schemas/ValidationError' - description: '' - '403': - content: - application/json: - schema: - $ref: '#/components/schemas/GenericError' - description: '' /rbac/initial_permissions/: get: operationId: rbac_initial_permissions_list diff --git a/web/src/admin/providers/rac/ConnectionTokenList.ts b/web/src/admin/providers/rac/ConnectionTokenList.ts index 42a36ba1fa..755d343cb0 100644 --- a/web/src/admin/providers/rac/ConnectionTokenList.ts +++ b/web/src/admin/providers/rac/ConnectionTokenList.ts @@ -12,7 +12,7 @@ import { customElement, property } from "lit/decorators.js"; import PFDescriptionList from "@patternfly/patternfly/components/DescriptionList/description-list.css"; -import { ConnectionToken, RACProvider, RacApi } from "@goauthentik/api"; +import { ConnectionToken, ProvidersApi, RACProvider } from "@goauthentik/api"; @customElement("ak-rac-connection-token-list") export class ConnectionTokenListPage extends Table { @@ -37,9 +37,9 @@ export class ConnectionTokenListPage extends Table { } async apiEndpoint(): Promise> { - return new RacApi(DEFAULT_CONFIG).racConnectionTokensList({ + return new ProvidersApi(DEFAULT_CONFIG).providersRacConnectionTokensList({ ...(await this.defaultEndpointConfig()), - provider: this.provider?.pk, + providerPk: this.provider!.pk, sessionUser: this.userId, }); } @@ -56,12 +56,14 @@ export class ConnectionTokenListPage extends Table { ]; }} .usedBy=${(item: ConnectionToken) => { - return new RacApi(DEFAULT_CONFIG).racConnectionTokensUsedByList({ + return new ProvidersApi(DEFAULT_CONFIG).providersRacConnectionTokensUsedByList({ + providerPk: this.provider!.pk, connectionTokenUuid: item.pk || "", }); }} .delete=${(item: ConnectionToken) => { - return new RacApi(DEFAULT_CONFIG).racConnectionTokensDestroy({ + return new ProvidersApi(DEFAULT_CONFIG).providersRacConnectionTokensDestroy({ + providerPk: this.provider!.pk, connectionTokenUuid: item.pk || "", }); }} diff --git a/web/src/admin/providers/rac/EndpointForm.ts b/web/src/admin/providers/rac/EndpointForm.ts index 216ba562e3..42d0538bf8 100644 --- a/web/src/admin/providers/rac/EndpointForm.ts +++ b/web/src/admin/providers/rac/EndpointForm.ts @@ -12,7 +12,7 @@ import { TemplateResult, html } from "lit"; import { customElement, property } from "lit/decorators.js"; import { ifDefined } from "lit/directives/if-defined.js"; -import { AuthModeEnum, Endpoint, ProtocolEnum, RacApi } from "@goauthentik/api"; +import { AuthModeEnum, Endpoint, ProtocolEnum, ProvidersApi } from "@goauthentik/api"; import { propertyMappingsProvider, propertyMappingsSelector } from "./RACProviderFormHelpers.js"; @@ -22,7 +22,8 @@ export class EndpointForm extends ModelForm { providerID?: number; loadInstance(pk: string): Promise { - return new RacApi(DEFAULT_CONFIG).racEndpointsRetrieve({ + return new ProvidersApi(DEFAULT_CONFIG).providersRacEndpointsRetrieve({ + providerPk: this.providerID!, pbmUuid: pk, }); } @@ -41,12 +42,14 @@ export class EndpointForm extends ModelForm { data.provider = this.instance.provider; } if (this.instance) { - return new RacApi(DEFAULT_CONFIG).racEndpointsPartialUpdate({ + return new ProvidersApi(DEFAULT_CONFIG).providersRacEndpointsPartialUpdate({ + providerPk: this.providerID!, pbmUuid: this.instance.pk || "", patchedEndpointRequest: data, }); } - return new RacApi(DEFAULT_CONFIG).racEndpointsCreate({ + return new ProvidersApi(DEFAULT_CONFIG).providersRacEndpointsCreate({ + providerPk: this.providerID!, endpointRequest: data, }); } diff --git a/web/src/admin/providers/rac/EndpointList.ts b/web/src/admin/providers/rac/EndpointList.ts index 56c8aa1037..d563b652ea 100644 --- a/web/src/admin/providers/rac/EndpointList.ts +++ b/web/src/admin/providers/rac/EndpointList.ts @@ -17,8 +17,8 @@ import PFDescriptionList from "@patternfly/patternfly/components/DescriptionList import { Endpoint, + ProvidersApi, RACProvider, - RacApi, RbacPermissionsAssignedByUsersListModelEnum, } from "@goauthentik/api"; @@ -43,9 +43,9 @@ export class EndpointListPage extends Table { } async apiEndpoint(): Promise> { - return new RacApi(DEFAULT_CONFIG).racEndpointsList({ + return new ProvidersApi(DEFAULT_CONFIG).providersRacEndpointsList({ ...(await this.defaultEndpointConfig()), - provider: this.provider?.pk, + providerPk: this.provider!.pk, superuserFullList: true, }); } @@ -70,12 +70,14 @@ export class EndpointListPage extends Table { ]; }} .usedBy=${(item: Endpoint) => { - return new RacApi(DEFAULT_CONFIG).racEndpointsUsedByList({ + return new ProvidersApi(DEFAULT_CONFIG).providersRacEndpointsUsedByList({ + providerPk: this.provider!.pk, pbmUuid: item.pk, }); }} .delete=${(item: Endpoint) => { - return new RacApi(DEFAULT_CONFIG).racEndpointsDestroy({ + return new ProvidersApi(DEFAULT_CONFIG).providersRacEndpointsDestroy({ + providerPk: this.provider!.pk, pbmUuid: item.pk, }); }} diff --git a/web/src/user/LibraryApplication/RACLaunchEndpointModal.ts b/web/src/user/LibraryApplication/RACLaunchEndpointModal.ts index 92d53810d3..4dae76839b 100644 --- a/web/src/user/LibraryApplication/RACLaunchEndpointModal.ts +++ b/web/src/user/LibraryApplication/RACLaunchEndpointModal.ts @@ -6,7 +6,7 @@ import { msg } from "@lit/localize"; import { TemplateResult, html } from "lit"; import { customElement, property } from "lit/decorators.js"; -import { Application, Endpoint, RacApi } from "@goauthentik/api"; +import { Application, Endpoint, ProvidersApi } from "@goauthentik/api"; @customElement("ak-library-rac-endpoint-launch") export class RACLaunchEndpointModal extends TableModal { @@ -30,9 +30,9 @@ export class RACLaunchEndpointModal extends TableModal { app?: Application; async apiEndpoint(): Promise> { - const endpoints = await new RacApi(DEFAULT_CONFIG).racEndpointsList({ + const endpoints = await new ProvidersApi(DEFAULT_CONFIG).providersRacEndpointsList({ ...(await this.defaultEndpointConfig()), - provider: this.app?.provider || 0, + providerPk: this.app?.provider || 0, }); if (this.open && endpoints.pagination.count === 1) { this.clickHandler(endpoints.results[0]);