+ + ${gettext("User Settings")} +
+${gettext("Configure settings relevant to your user profile.")}
+diff --git a/authentik/core/templatetags/__init__.py b/authentik/core/templatetags/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/authentik/core/templatetags/authentik_user_settings.py b/authentik/core/templatetags/authentik_user_settings.py deleted file mode 100644 index 054bd0356..000000000 --- a/authentik/core/templatetags/authentik_user_settings.py +++ /dev/null @@ -1,44 +0,0 @@ -"""authentik user settings template tags""" -from typing import Iterable - -from django import template -from django.template.context import RequestContext - -from authentik.core.models import Source -from authentik.flows.models import Stage -from authentik.policies.engine import PolicyEngine - -register = template.Library() - - -@register.simple_tag(takes_context=True) -# pylint: disable=unused-argument -def user_stages(context: RequestContext) -> dict[Stage, str]: - """Return list of all stages which apply to user""" - _all_stages: Iterable[Stage] = Stage.objects.all().select_subclasses() - matching_stages: dict[Stage, str] = {} - for stage in _all_stages: - user_settings = stage.ui_user_settings - if not user_settings: - continue - matching_stages[stage] = user_settings - return matching_stages - - -@register.simple_tag(takes_context=True) -def user_sources(context: RequestContext) -> dict[Source, str]: - """Return a list of all sources which are enabled for the user""" - user = context.get("request").user - _all_sources: Iterable[Source] = Source.objects.filter( - enabled=True - ).select_subclasses() - matching_sources: dict[Source, str] = {} - for source in _all_sources: - user_settings = source.ui_user_settings - if not user_settings: - continue - policy_engine = PolicyEngine(source, user, context.get("request")) - policy_engine.build() - if policy_engine.passing: - matching_sources[source] = user_settings - return matching_sources diff --git a/authentik/core/tests/test_views_user.py b/authentik/core/tests/test_views_user.py index 63a8cef94..bad0ab441 100644 --- a/authentik/core/tests/test_views_user.py +++ b/authentik/core/tests/test_views_user.py @@ -23,12 +23,6 @@ class TestUserViews(TestCase): ) self.client.force_login(self.user) - def test_user_settings(self): - """Test UserSettingsView""" - self.assertEqual( - self.client.get(reverse("authentik_core:user-settings")).status_code, 200 - ) - def test_user_details(self): """Test UserDetailsView""" self.assertEqual( diff --git a/authentik/core/urls.py b/authentik/core/urls.py index e51c01e68..637cd8c1b 100644 --- a/authentik/core/urls.py +++ b/authentik/core/urls.py @@ -6,7 +6,6 @@ from authentik.core.views import impersonate, shell, user urlpatterns = [ path("", shell.ShellView.as_view(), name="shell"), # User views - path("-/user/", user.UserSettingsView.as_view(), name="user-settings"), path("-/user/details/", user.UserDetailsView.as_view(), name="user-details"), path( "-/user/tokens/create/", diff --git a/web/src/elements/Tabs.ts b/web/src/elements/Tabs.ts index 0871f0181..fc599cada 100644 --- a/web/src/elements/Tabs.ts +++ b/web/src/elements/Tabs.ts @@ -29,6 +29,25 @@ export class Tabs extends LitElement { `]; } + observer: MutationObserver; + + constructor() { + super(); + this.observer = new MutationObserver(() => { + this.requestUpdate(); + }); + } + + connectedCallback(): void { + super.connectedCallback(); + this.observer.observe(this, { attributes: true, childList: true, subtree: true }); + } + + disconnectedCallback(): void { + this.observer.disconnect(); + super.disconnectedCallback(); + } + renderTab(page: Element): TemplateResult { const slot = page.attributes.getNamedItem("slot")?.value; return html`
${gettext("Configure settings relevant to your user profile.")}
+