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.

class Models(django.db.models.enums.TextChoices):

Class for creating enumerated string choices.

Inherited Members
Models.authentik_tenants
domain
Models.authentik_core
group
user
application
applicationentitlement
token
Models.authentik_crypto
certificatekeypair
Models.authentik_endpoints
deviceuserbinding
deviceaccessgroup
endpointstage
Models.authentik_endpoints_connectors_agent
agentconnector
agentdeviceuserbinding
enrollmenttoken
Models.authentik_enterprise
license
Models.authentik_events
event
notificationtransport
notification
notificationrule
notificationwebhookmapping
Models.authentik_flows
flow
flowstagebinding
Models.authentik_outposts
dockerserviceconnection
kubernetesserviceconnection
outpost
Models.authentik_policies_dummy
dummypolicy
Models.authentik_policies_event_matcher
eventmatcherpolicy
Models.authentik_policies_expiry
passwordexpirypolicy
Models.authentik_policies_expression
expressionpolicy
Models.authentik_policies_geoip
geoippolicy
Models.authentik_policies_password
passwordpolicy
Models.authentik_policies_reputation
reputationpolicy
Models.authentik_policies
policybinding
Models.authentik_providers_ldap
ldapprovider
Models.authentik_providers_oauth2
scopemapping
oauth2provider
Models.authentik_providers_proxy
proxyprovider
Models.authentik_providers_rac
racprovider
endpoint
racpropertymapping
Models.authentik_providers_radius
radiusprovider
radiusproviderpropertymapping
Models.authentik_providers_saml
samlprovider
samlpropertymapping
Models.authentik_providers_scim
scimprovider
scimmapping
Models.authentik_rbac
role
initialpermissions
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
Models.authentik_sources_scim
scimsource
scimsourcepropertymapping
Models.authentik_sources_telegram
telegramsource
telegramsourcepropertymapping
usertelegramsourceconnection
grouptelegramsourceconnection
Models.authentik_stages_authenticator_duo
authenticatorduostage
duodevice
Models.authentik_stages_authenticator_email
authenticatoremailstage
emaildevice
Models.authentik_stages_authenticator_sms
authenticatorsmsstage
smsdevice
Models.authentik_stages_authenticator_static
authenticatorstaticstage
staticdevice
Models.authentik_stages_authenticator_totp
authenticatortotpstage
totpdevice
Models.authentik_stages_authenticator_validate
authenticatorvalidatestage
Models.authentik_stages_authenticator_webauthn
authenticatorwebauthnstage
webauthndevice
Models.authentik_stages_captcha
captchastage
Models.authentik_stages_consent
consentstage
Models.authentik_stages_deny
denystage
Models.authentik_stages_dummy
dummystage
Models.authentik_stages_email
emailstage
Models.authentik_stages_identification
identificationstage
Models.authentik_stages_invitation
invitationstage
invitation
Models.authentik_stages_password
passwordstage
Models.authentik_stages_prompt
prompt
promptstage
Models.authentik_stages_redirect
redirectstage
Models.authentik_stages_user_delete
userdeletestage
Models.authentik_stages_user_login
userloginstage
Models.authentik_stages_user_logout
userlogoutstage
Models.authentik_stages_user_write
userwritestage
Models.authentik_tasks_schedules
schedule
Models.authentik_brands
brand
Models.authentik_blueprints
blueprintinstance
Models.authentik_endpoints_connectors_fleet
fleetconnector
Models.authentik_endpoints_connectors_google_chrome
googlechromeconnector
Models.authentik_lifecycle
lifecyclerule
lifecycleiteration
review
Models.authentik_policies_unique_password
uniquepasswordpolicy
Models.authentik_providers_google_workspace
googleworkspaceprovider
googleworkspaceprovidermapping
Models.authentik_providers_microsoft_entra
microsoftentraprovider
microsoftentraprovidermapping
Models.authentik_providers_ssf
ssfprovider
Models.authentik_providers_ws_federation
wsfederationprovider
Models.authentik_reports
dataexport
Models.authentik_stages_authenticator_endpoint_gdtc
authenticatorendpointgdtcstage
Models.authentik_stages_mtls
mutualtlsstage
Models.authentik_stages_source
sourcestage