authentik.stages.deny.models

deny stage models

 1"""deny stage models"""
 2
 3from django.db import models
 4from django.utils.translation import gettext_lazy as _
 5from django.views import View
 6from rest_framework.serializers import BaseSerializer
 7
 8from authentik.flows.models import Stage
 9
10
11class DenyStage(Stage):
12    """Cancels the current flow."""
13
14    deny_message = models.TextField(blank=True, default="")
15
16    @property
17    def serializer(self) -> type[BaseSerializer]:
18        from authentik.stages.deny.api import DenyStageSerializer
19
20        return DenyStageSerializer
21
22    @property
23    def view(self) -> type[View]:
24        from authentik.stages.deny.stage import DenyStageView
25
26        return DenyStageView
27
28    @property
29    def component(self) -> str:
30        return "ak-stage-deny-form"
31
32    class Meta:
33        verbose_name = _("Deny Stage")
34        verbose_name_plural = _("Deny Stages")
class DenyStage(authentik.flows.models.Stage):
12class DenyStage(Stage):
13    """Cancels the current flow."""
14
15    deny_message = models.TextField(blank=True, default="")
16
17    @property
18    def serializer(self) -> type[BaseSerializer]:
19        from authentik.stages.deny.api import DenyStageSerializer
20
21        return DenyStageSerializer
22
23    @property
24    def view(self) -> type[View]:
25        from authentik.stages.deny.stage import DenyStageView
26
27        return DenyStageView
28
29    @property
30    def component(self) -> str:
31        return "ak-stage-deny-form"
32
33    class Meta:
34        verbose_name = _("Deny Stage")
35        verbose_name_plural = _("Deny Stages")

Cancels the current flow.

def deny_message(unknown):

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

serializer: type[rest_framework.serializers.BaseSerializer]
17    @property
18    def serializer(self) -> type[BaseSerializer]:
19        from authentik.stages.deny.api import DenyStageSerializer
20
21        return DenyStageSerializer

Get serializer for this model

view: type[django.views.generic.base.View]
23    @property
24    def view(self) -> type[View]:
25        from authentik.stages.deny.stage import DenyStageView
26
27        return DenyStageView

Return StageView class that implements logic for this stage

component: str
29    @property
30    def component(self) -> str:
31        return "ak-stage-deny-form"

Return component used to edit this object

stage_ptr_id
stage_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example::

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

class DenyStage.DoesNotExist(authentik.flows.models.Stage.DoesNotExist):

The requested object does not exist

class DenyStage.MultipleObjectsReturned(authentik.flows.models.Stage.MultipleObjectsReturned):

The query returned multiple objects when only one was expected.