authentik.lib.api
1from django.apps.registry import apps 2from django.db.models import TextChoices 3from django.utils.encoding import force_str 4 5from authentik.blueprints.v1.importer import is_model_allowed 6from authentik.blueprints.v1.meta.registry import BaseMetaModel 7 8 9def app_choices() -> TextChoices: 10 """Get a list of all installed applications that create events. 11 Returns a list of tuples containing (dotted.app.path, name)""" 12 choices = {} 13 for app in apps.get_app_configs(): 14 if app.label.startswith("authentik"): 15 choices[app.name] = (app.name, force_str(app.verbose_name)) 16 return TextChoices("Apps", choices) 17 18 19def model_choices() -> TextChoices: 20 """Get a list of all installed models 21 Returns a list of tuples containing (dotted.model.path, name)""" 22 choices = {} 23 for model in apps.get_models(): 24 if not is_model_allowed(model) or issubclass(model, BaseMetaModel): 25 continue 26 name = f"{model._meta.app_label}.{model._meta.model_name}" 27 choices[name] = (name, force_str(model._meta.verbose_name)) 28 return TextChoices("Models", choices) 29 30 31Apps = app_choices() 32Models = model_choices()
def
app_choices() -> django.db.models.enums.TextChoices:
10def app_choices() -> TextChoices: 11 """Get a list of all installed applications that create events. 12 Returns a list of tuples containing (dotted.app.path, name)""" 13 choices = {} 14 for app in apps.get_app_configs(): 15 if app.label.startswith("authentik"): 16 choices[app.name] = (app.name, force_str(app.verbose_name)) 17 return TextChoices("Apps", choices)
Get a list of all installed applications that create events. Returns a list of tuples containing (dotted.app.path, name)
def
model_choices() -> django.db.models.enums.TextChoices:
20def model_choices() -> TextChoices: 21 """Get a list of all installed models 22 Returns a list of tuples containing (dotted.model.path, name)""" 23 choices = {} 24 for model in apps.get_models(): 25 if not is_model_allowed(model) or issubclass(model, BaseMetaModel): 26 continue 27 name = f"{model._meta.app_label}.{model._meta.model_name}" 28 choices[name] = (name, force_str(model._meta.verbose_name)) 29 return TextChoices("Models", choices)
Get a list of all installed models Returns a list of tuples containing (dotted.model.path, name)
class
Apps(django.db.models.enums.TextChoices):
Class for creating enumerated string choices.
Inherited Members
- Apps.authentik
- commands
- tenants
- tasks
- admin
- api
- core
- crypto
- endpoints
- enterprise
- events
- flows
- outposts
- policies
- rbac
- recovery
- brands
- blueprints
- Apps.authentik.stages
- dummy
- password
- authenticator
- authenticator_duo
- authenticator_email
- authenticator_sms
- authenticator_static
- authenticator_totp
- authenticator_validate
- authenticator_webauthn
- captcha
- consent
- deny
- identification
- invitation
- prompt
- redirect
- user_delete
- user_login
- user_logout
- user_write
class
Models(django.db.models.enums.TextChoices):
Class for creating enumerated string choices.
Inherited Members
- Models.authentik_events
- event
- notificationtransport
- notification
- notificationrule
- notificationwebhookmapping
- Models.authentik_sources_kerberos
- kerberossource
- kerberossourcepropertymapping
- userkerberossourceconnection
- groupkerberossourceconnection
- Models.authentik_sources_ldap
- ldapsource
- ldapsourcepropertymapping
- userldapsourceconnection
- groupldapsourceconnection
- Models.authentik_sources_oauth
- oauthsource
- oauthsourcepropertymapping
- useroauthsourceconnection
- groupoauthsourceconnection
- Models.authentik_sources_plex
- plexsource
- plexsourcepropertymapping
- userplexsourceconnection
- groupplexsourceconnection
- Models.authentik_sources_saml
- samlsource
- samlsourcepropertymapping
- usersamlsourceconnection
- groupsamlsourceconnection