Compare commits
5 Commits
linter-fix
...
core/impro
Author | SHA1 | Date | |
---|---|---|---|
36e418436b | |||
8b0058ada0 | |||
3abf1421a2 | |||
70c7454c69 | |||
1eb9d7a9d6 |
@ -7,7 +7,9 @@ from datetime import timedelta
|
|||||||
from django.core.cache import cache
|
from django.core.cache import cache
|
||||||
from django.db.models import QuerySet
|
from django.db.models import QuerySet
|
||||||
from django.db.models.functions import ExtractHour
|
from django.db.models.functions import ExtractHour
|
||||||
|
from django.http import HttpRequest
|
||||||
from django.shortcuts import get_object_or_404
|
from django.shortcuts import get_object_or_404
|
||||||
|
from django.urls import reverse
|
||||||
from drf_spectacular.types import OpenApiTypes
|
from drf_spectacular.types import OpenApiTypes
|
||||||
from drf_spectacular.utils import OpenApiParameter, OpenApiResponse, extend_schema
|
from drf_spectacular.utils import OpenApiParameter, OpenApiResponse, extend_schema
|
||||||
from guardian.shortcuts import get_objects_for_user
|
from guardian.shortcuts import get_objects_for_user
|
||||||
@ -65,10 +67,16 @@ class ApplicationSerializer(ModelSerializer):
|
|||||||
|
|
||||||
def get_launch_url(self, app: Application) -> str | None:
|
def get_launch_url(self, app: Application) -> str | None:
|
||||||
"""Allow formatting of launch URL"""
|
"""Allow formatting of launch URL"""
|
||||||
user = None
|
rel_url = reverse(
|
||||||
|
"authentik_core:application-launch",
|
||||||
|
kwargs={
|
||||||
|
"application_slug": app.slug,
|
||||||
|
},
|
||||||
|
)
|
||||||
if "request" in self.context:
|
if "request" in self.context:
|
||||||
user = self.context["request"].user
|
request: HttpRequest = self.context["request"]
|
||||||
return app.get_launch_url(user)
|
return request.build_absolute_uri(rel_url)
|
||||||
|
return rel_url
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs) -> None:
|
def __init__(self, *args, **kwargs) -> None:
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
@ -90,7 +90,7 @@ export class LibraryApplication extends AKElement {
|
|||||||
if (!this.application) {
|
if (!this.application) {
|
||||||
return html``;
|
return html``;
|
||||||
}
|
}
|
||||||
if (this.application?.launchUrl === "goauthentik.io://providers/rac/launch") {
|
if (this.application?.providerObj.component === "ak-provider-rac-form") {
|
||||||
return html`<ak-library-rac-endpoint-launch .app=${this.application}>
|
return html`<ak-library-rac-endpoint-launch .app=${this.application}>
|
||||||
<a slot="trigger"> ${this.application.name} </a>
|
<a slot="trigger"> ${this.application.name} </a>
|
||||||
</ak-library-rac-endpoint-launch>`;
|
</ak-library-rac-endpoint-launch>`;
|
||||||
|
Reference in New Issue
Block a user