small fixes, runs
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
parent
425575ef99
commit
d11721805a
|
@ -39,9 +39,14 @@ class ManagedAppConfig(AppConfig):
|
||||||
if not meth_name.startswith(prefix):
|
if not meth_name.startswith(prefix):
|
||||||
continue
|
continue
|
||||||
name = meth_name.replace(prefix, "")
|
name = meth_name.replace(prefix, "")
|
||||||
tenants = Tenant.objects.all()
|
tenants = Tenant.objects.filter(ready=True)
|
||||||
if meth_name.startswith(tenant_prefix):
|
if not meth_name.startswith(tenant_prefix):
|
||||||
tenants = Tenant.objects.get(schema_name=get_public_schema_name())
|
tenants = Tenant.objects.filter(schema_name=get_public_schema_name())
|
||||||
|
try:
|
||||||
|
tenants = list(tenants)
|
||||||
|
except (DatabaseError, ProgrammingError, InternalError) as exc:
|
||||||
|
self._logger.debug("Failed to get tenants to run reconcile", name=name, exc=exc)
|
||||||
|
continue
|
||||||
for tenant in tenants:
|
for tenant in tenants:
|
||||||
with tenant:
|
with tenant:
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -76,7 +76,7 @@ class BlueprintEventHandler(FileSystemEventHandler):
|
||||||
return
|
return
|
||||||
if event.is_directory:
|
if event.is_directory:
|
||||||
return
|
return
|
||||||
for tenant in Tenant.objects.all():
|
for tenant in Tenant.objects.filter(ready=True):
|
||||||
with tenant:
|
with tenant:
|
||||||
if isinstance(event, FileCreatedEvent):
|
if isinstance(event, FileCreatedEvent):
|
||||||
LOGGER.debug("new blueprint file created, starting discovery")
|
LOGGER.debug("new blueprint file created, starting discovery")
|
||||||
|
|
|
@ -69,13 +69,13 @@ class Themes(models.TextChoices):
|
||||||
DARK = "dark"
|
DARK = "dark"
|
||||||
|
|
||||||
|
|
||||||
class CurrentBrandSerializer(PassiveSerializer):
|
|
||||||
"""Partial brand information for styling"""
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_default_ui_footer_links():
|
def get_default_ui_footer_links():
|
||||||
return get_current_tenant().footer_links
|
return get_current_tenant().footer_links
|
||||||
|
|
||||||
|
|
||||||
|
class CurrentBrandSerializer(PassiveSerializer):
|
||||||
|
"""Partial brand information for styling"""
|
||||||
|
|
||||||
matched_domain = CharField(source="domain")
|
matched_domain = CharField(source="domain")
|
||||||
branding_title = CharField()
|
branding_title = CharField()
|
||||||
branding_logo = CharField()
|
branding_logo = CharField()
|
||||||
|
|
|
@ -17,7 +17,9 @@ class InterfaceView(TemplateView):
|
||||||
"""Base interface view"""
|
"""Base interface view"""
|
||||||
|
|
||||||
def get_context_data(self, **kwargs: Any) -> dict[str, Any]:
|
def get_context_data(self, **kwargs: Any) -> dict[str, Any]:
|
||||||
kwargs["config_json"] = dumps(ConfigView(request=Request(self.request)).get_config().data)
|
kwargs["config_json"] = dumps(
|
||||||
|
ConfigView(request=Request(self.request)).get_config(self.request).data
|
||||||
|
)
|
||||||
kwargs["brand_json"] = dumps(CurrentBrandSerializer(self.request.brand).data)
|
kwargs["brand_json"] = dumps(CurrentBrandSerializer(self.request.brand).data)
|
||||||
kwargs["version_family"] = f"{LOCAL_VERSION.major}.{LOCAL_VERSION.minor}"
|
kwargs["version_family"] = f"{LOCAL_VERSION.major}.{LOCAL_VERSION.minor}"
|
||||||
kwargs["version_subdomain"] = f"version-{LOCAL_VERSION.major}-{LOCAL_VERSION.minor}"
|
kwargs["version_subdomain"] = f"version-{LOCAL_VERSION.major}-{LOCAL_VERSION.minor}"
|
||||||
|
|
|
@ -119,7 +119,7 @@ def worker_ready_hook(*args, **kwargs):
|
||||||
_run_task(task)
|
_run_task(task)
|
||||||
|
|
||||||
for task in _get_startup_tasks_all_tenants():
|
for task in _get_startup_tasks_all_tenants():
|
||||||
for tenant in Tenant.objects.all():
|
for tenant in Tenant.objects.filter(ready=True):
|
||||||
with tenant:
|
with tenant:
|
||||||
_run_task(task)
|
_run_task(task)
|
||||||
|
|
||||||
|
|
|
@ -228,7 +228,7 @@ MIDDLEWARE = [
|
||||||
"django_tenants.middleware.default.DefaultTenantMiddleware",
|
"django_tenants.middleware.default.DefaultTenantMiddleware",
|
||||||
"authentik.root.middleware.LoggingMiddleware",
|
"authentik.root.middleware.LoggingMiddleware",
|
||||||
"django_prometheus.middleware.PrometheusBeforeMiddleware",
|
"django_prometheus.middleware.PrometheusBeforeMiddleware",
|
||||||
"authentik.brands.middleware.TenantMiddleware",
|
"authentik.brands.middleware.BrandMiddleware",
|
||||||
"authentik.root.middleware.SessionMiddleware",
|
"authentik.root.middleware.SessionMiddleware",
|
||||||
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
||||||
"authentik.core.middleware.RequestIDMiddleware",
|
"authentik.core.middleware.RequestIDMiddleware",
|
||||||
|
|
|
@ -16,6 +16,7 @@ def create_default_tenant(apps, schema_editor):
|
||||||
tenant = Tenant.objects.using(db_alias).create(
|
tenant = Tenant.objects.using(db_alias).create(
|
||||||
schema_name="public",
|
schema_name="public",
|
||||||
name="Default",
|
name="Default",
|
||||||
|
ready=True,
|
||||||
avatars=CONFIG.get("avatars", "gravatar,initials"),
|
avatars=CONFIG.get("avatars", "gravatar,initials"),
|
||||||
default_user_change_name=CONFIG.get_bool("default_user_change_name", True),
|
default_user_change_name=CONFIG.get_bool("default_user_change_name", True),
|
||||||
default_user_change_email=CONFIG.get_bool("default_user_change_email", False),
|
default_user_change_email=CONFIG.get_bool("default_user_change_email", False),
|
||||||
|
@ -54,6 +55,7 @@ class Migration(migrations.Migration):
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
("name", models.TextField()),
|
("name", models.TextField()),
|
||||||
|
("ready", models.BooleanField(default=False)),
|
||||||
(
|
(
|
||||||
"avatars",
|
"avatars",
|
||||||
models.TextField(
|
models.TextField(
|
||||||
|
|
|
@ -30169,7 +30169,6 @@ components:
|
||||||
items:
|
items:
|
||||||
$ref: '#/components/schemas/FooterLink'
|
$ref: '#/components/schemas/FooterLink'
|
||||||
readOnly: true
|
readOnly: true
|
||||||
default: []
|
|
||||||
ui_theme:
|
ui_theme:
|
||||||
allOf:
|
allOf:
|
||||||
- $ref: '#/components/schemas/UiThemeEnum'
|
- $ref: '#/components/schemas/UiThemeEnum'
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import "@goauthentik/admin/common/ak-crypto-certificate-search";
|
import "@goauthentik/admin/common/ak-crypto-certificate-search";
|
||||||
import "@goauthentik/admin/common/ak-flow-search/ak-branted-flow-search";
|
import "@goauthentik/admin/common/ak-flow-search/ak-branded-flow-search";
|
||||||
import {
|
import {
|
||||||
clientTypeOptions,
|
clientTypeOptions,
|
||||||
issuerModeOptions,
|
issuerModeOptions,
|
||||||
|
|
Reference in New Issue