mirror of
https://github.com/goauthentik/authentik.git
synced 2026-08-30 18:51:39 -07:00
* move imports * core: add digraph group hierarchy * move to permissions from Group or User to Role * set group parents on frontend * do not serialize `GroupParentageNode` directly * core: enforce unique group name on database level Signed-off-by: Jens Langhammer <jens@goauthentik.io> * use group parents in LDAP provider * add user-role relationship control to frontend * move materialized view to be more discoverable * add guardian to mypy exceptions * make `Role` a `ManagedModel` * fixup! make `Role` a `ManagedModel` * simplify `get_objects_for_user` * fix flaky unit test * rename `django-guardian` fork to `ak-guardian` * add tests around users/groups/roles * remove unused guardian config variable * simplify guardian file structure * clean up frontend * initial docs * remove `mode` from `InitialPermissions` This is no longer needed, since users no longer directly have permissions. * fixup! Merge branch 'main' into core/add-digraph-group-hierarchy * clean up docs for managing permissions * addendums from docs review * fixup! Merge branch 'main' into core/add-digraph-group-hierarchy * tweaks * dewi and tana edits to docs * tweak * truly final tweaks, for now * relabel Role Permissions table * clarify button label * fixup! Merge branch 'main' into core/add-digraph-group-hierarchy * fixup! Merge branch 'main' into core/add-digraph-group-hierarchy * merge migrations * fixup! Merge branch 'main' into core/add-digraph-group-hierarchy --------- Signed-off-by: Jens Langhammer <jens@goauthentik.io> Co-authored-by: Jens Langhammer <jens@goauthentik.io> Co-authored-by: Tana M Berry <tana@goauthentik.io>
32 lines
1.5 KiB
Python
32 lines
1.5 KiB
Python
from django.conf import settings
|
|
from django.core.exceptions import ImproperlyConfigured
|
|
|
|
ANONYMOUS_USER_NAME = getattr(settings, "GUARDIAN_ANONYMOUS_USER_NAME", "AnonymousUser")
|
|
GET_INIT_ANONYMOUS_USER = getattr(
|
|
settings, "GUARDIAN_GET_INIT_ANONYMOUS_USER", "guardian.management.get_init_anonymous_user"
|
|
)
|
|
GET_CONTENT_TYPE = getattr(
|
|
settings, "GUARDIAN_GET_CONTENT_TYPE", "guardian.ctypes.get_default_content_type"
|
|
)
|
|
# Anonymous user cache TTL configuration
|
|
# 0 = no cache (default), positive number = cache TTL in seconds, -1 = cache indefinitely
|
|
ANONYMOUS_USER_CACHE_TTL = getattr(settings, "GUARDIAN_ANONYMOUS_USER_CACHE_TTL", 0)
|
|
# Default to using guardian supplied generic object permission models
|
|
USER_OBJ_PERMS_MODEL = getattr(
|
|
settings, "GUARDIAN_USER_OBJ_PERMS_MODEL", "guardian.UserObjectPermission"
|
|
)
|
|
GROUP_OBJ_PERMS_MODEL = getattr(
|
|
settings, "GUARDIAN_GROUP_OBJ_PERMS_MODEL", "guardian.GroupObjectPermission"
|
|
)
|
|
ROLE_OBJ_PERMS_MODEL = getattr(
|
|
settings, "GUARDIAN_ROLE_OBJ_PERMS_MODEL", "guardian.RoleObjectPermission"
|
|
)
|
|
|
|
# Since get_user_model() causes a circular import if called when app models are
|
|
# being loaded, the user_model_label should be used when possible, with calls
|
|
# to get_user_model deferred to execution time
|
|
user_model_label = getattr(settings, "AUTH_USER_MODEL", "auth.User")
|
|
role_model_label = getattr(settings, "GUARDIAN_ROLE_MODEL", None)
|
|
if role_model_label is None:
|
|
raise ImproperlyConfigured("ak-guardian requires settings.GUARDIAN_ROLE_MODEL")
|