admin: remove delete views

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-03-18 12:37:22 +01:00
parent 48443e3e09
commit db9aa5d9dc
20 changed files with 6 additions and 369 deletions

View File

@ -20,7 +20,6 @@ from authentik.admin.views import (
stages_bindings, stages_bindings,
stages_invitations, stages_invitations,
stages_prompts, stages_prompts,
tokens,
users, users,
) )
from authentik.providers.saml.views.metadata import MetadataImportView from authentik.providers.saml.views.metadata import MetadataImportView
@ -47,17 +46,6 @@ urlpatterns = [
applications.ApplicationUpdateView.as_view(), applications.ApplicationUpdateView.as_view(),
name="application-update", name="application-update",
), ),
path(
"applications/<uuid:pk>/delete/",
applications.ApplicationDeleteView.as_view(),
name="application-delete",
),
# Tokens
path(
"tokens/<uuid:pk>/delete/",
tokens.TokenDeleteView.as_view(),
name="token-delete",
),
# Sources # Sources
path("sources/create/", sources.SourceCreateView.as_view(), name="source-create"), path("sources/create/", sources.SourceCreateView.as_view(), name="source-create"),
path( path(
@ -65,11 +53,6 @@ urlpatterns = [
sources.SourceUpdateView.as_view(), sources.SourceUpdateView.as_view(),
name="source-update", name="source-update",
), ),
path(
"sources/<uuid:pk>/delete/",
sources.SourceDeleteView.as_view(),
name="source-delete",
),
# Policies # Policies
path("policies/create/", policies.PolicyCreateView.as_view(), name="policy-create"), path("policies/create/", policies.PolicyCreateView.as_view(), name="policy-create"),
path( path(
@ -77,11 +60,6 @@ urlpatterns = [
policies.PolicyUpdateView.as_view(), policies.PolicyUpdateView.as_view(),
name="policy-update", name="policy-update",
), ),
path(
"policies/<uuid:pk>/delete/",
policies.PolicyDeleteView.as_view(),
name="policy-delete",
),
path( path(
"policies/<uuid:pk>/test/", "policies/<uuid:pk>/test/",
policies.PolicyTestView.as_view(), policies.PolicyTestView.as_view(),
@ -98,11 +76,6 @@ urlpatterns = [
policies_bindings.PolicyBindingUpdateView.as_view(), policies_bindings.PolicyBindingUpdateView.as_view(),
name="policy-binding-update", name="policy-binding-update",
), ),
path(
"policies/bindings/<uuid:pk>/delete/",
policies_bindings.PolicyBindingDeleteView.as_view(),
name="policy-binding-delete",
),
# Providers # Providers
path( path(
"providers/create/", "providers/create/",
@ -119,11 +92,6 @@ urlpatterns = [
providers.ProviderUpdateView.as_view(), providers.ProviderUpdateView.as_view(),
name="provider-update", name="provider-update",
), ),
path(
"providers/<int:pk>/delete/",
providers.ProviderDeleteView.as_view(),
name="provider-delete",
),
# Stages # Stages
path("stages/create/", stages.StageCreateView.as_view(), name="stage-create"), path("stages/create/", stages.StageCreateView.as_view(), name="stage-create"),
path( path(
@ -131,11 +99,6 @@ urlpatterns = [
stages.StageUpdateView.as_view(), stages.StageUpdateView.as_view(),
name="stage-update", name="stage-update",
), ),
path(
"stages/<uuid:pk>/delete/",
stages.StageDeleteView.as_view(),
name="stage-delete",
),
# Stage bindings # Stage bindings
path( path(
"stages/bindings/create/", "stages/bindings/create/",
@ -147,11 +110,6 @@ urlpatterns = [
stages_bindings.StageBindingUpdateView.as_view(), stages_bindings.StageBindingUpdateView.as_view(),
name="stage-binding-update", name="stage-binding-update",
), ),
path(
"stages/bindings/<uuid:pk>/delete/",
stages_bindings.StageBindingDeleteView.as_view(),
name="stage-binding-delete",
),
# Stage Prompts # Stage Prompts
path( path(
"stages_prompts/create/", "stages_prompts/create/",
@ -163,22 +121,12 @@ urlpatterns = [
stages_prompts.PromptUpdateView.as_view(), stages_prompts.PromptUpdateView.as_view(),
name="stage-prompt-update", name="stage-prompt-update",
), ),
path(
"stages_prompts/<uuid:pk>/delete/",
stages_prompts.PromptDeleteView.as_view(),
name="stage-prompt-delete",
),
# Stage Invitations # Stage Invitations
path( path(
"stages/invitations/create/", "stages/invitations/create/",
stages_invitations.InvitationCreateView.as_view(), stages_invitations.InvitationCreateView.as_view(),
name="stage-invitation-create", name="stage-invitation-create",
), ),
path(
"stages/invitations/<uuid:pk>/delete/",
stages_invitations.InvitationDeleteView.as_view(),
name="stage-invitation-delete",
),
# Flows # Flows
path( path(
"flows/create/", "flows/create/",
@ -205,11 +153,6 @@ urlpatterns = [
flows.FlowExportView.as_view(), flows.FlowExportView.as_view(),
name="flow-export", name="flow-export",
), ),
path(
"flows/<uuid:pk>/delete/",
flows.FlowDeleteView.as_view(),
name="flow-delete",
),
# Property Mappings # Property Mappings
path( path(
"property-mappings/create/", "property-mappings/create/",
@ -221,11 +164,6 @@ urlpatterns = [
property_mappings.PropertyMappingUpdateView.as_view(), property_mappings.PropertyMappingUpdateView.as_view(),
name="property-mapping-update", name="property-mapping-update",
), ),
path(
"property-mappings/<uuid:pk>/delete/",
property_mappings.PropertyMappingDeleteView.as_view(),
name="property-mapping-delete",
),
path( path(
"property-mappings/<uuid:pk>/test/", "property-mappings/<uuid:pk>/test/",
property_mappings.PropertyMappingTestView.as_view(), property_mappings.PropertyMappingTestView.as_view(),
@ -234,7 +172,6 @@ urlpatterns = [
# Users # Users
path("users/create/", users.UserCreateView.as_view(), name="user-create"), path("users/create/", users.UserCreateView.as_view(), name="user-create"),
path("users/<int:pk>/update/", users.UserUpdateView.as_view(), name="user-update"), path("users/<int:pk>/update/", users.UserUpdateView.as_view(), name="user-update"),
path("users/<int:pk>/delete/", users.UserDeleteView.as_view(), name="user-delete"),
path( path(
"users/<int:pk>/disable/", users.UserDisableView.as_view(), name="user-disable" "users/<int:pk>/disable/", users.UserDisableView.as_view(), name="user-disable"
), ),
@ -251,11 +188,6 @@ urlpatterns = [
groups.GroupUpdateView.as_view(), groups.GroupUpdateView.as_view(),
name="group-update", name="group-update",
), ),
path(
"groups/<uuid:pk>/delete/",
groups.GroupDeleteView.as_view(),
name="group-delete",
),
# Certificate-Key Pairs # Certificate-Key Pairs
path( path(
"crypto/certificates/create/", "crypto/certificates/create/",
@ -272,11 +204,6 @@ urlpatterns = [
certificate_key_pair.CertificateKeyPairUpdateView.as_view(), certificate_key_pair.CertificateKeyPairUpdateView.as_view(),
name="certificatekeypair-update", name="certificatekeypair-update",
), ),
path(
"crypto/certificates/<uuid:pk>/delete/",
certificate_key_pair.CertificateKeyPairDeleteView.as_view(),
name="certificatekeypair-delete",
),
# Outposts # Outposts
path( path(
"outposts/create/", "outposts/create/",
@ -288,11 +215,6 @@ urlpatterns = [
outposts.OutpostUpdateView.as_view(), outposts.OutpostUpdateView.as_view(),
name="outpost-update", name="outpost-update",
), ),
path(
"outposts/<uuid:pk>/delete/",
outposts.OutpostDeleteView.as_view(),
name="outpost-delete",
),
# Outpost Service Connections # Outpost Service Connections
path( path(
"outpost_service_connections/create/", "outpost_service_connections/create/",
@ -304,11 +226,6 @@ urlpatterns = [
outposts_service_connections.OutpostServiceConnectionUpdateView.as_view(), outposts_service_connections.OutpostServiceConnectionUpdateView.as_view(),
name="outpost-service-connection-update", name="outpost-service-connection-update",
), ),
path(
"outpost_service_connections/<uuid:pk>/delete/",
outposts_service_connections.OutpostServiceConnectionDeleteView.as_view(),
name="outpost-service-connection-delete",
),
# Event Notification Transpots # Event Notification Transpots
path( path(
"events/transports/create/", "events/transports/create/",
@ -320,11 +237,6 @@ urlpatterns = [
events_notifications_transports.NotificationTransportUpdateView.as_view(), events_notifications_transports.NotificationTransportUpdateView.as_view(),
name="notification-transport-update", name="notification-transport-update",
), ),
path(
"events/transports/<uuid:pk>/delete/",
events_notifications_transports.NotificationTransportDeleteView.as_view(),
name="notification-transport-delete",
),
# Event Notification Rules # Event Notification Rules
path( path(
"events/rules/create/", "events/rules/create/",
@ -336,9 +248,4 @@ urlpatterns = [
events_notifications_rules.NotificationRuleUpdateView.as_view(), events_notifications_rules.NotificationRuleUpdateView.as_view(),
name="notification-rule-update", name="notification-rule-update",
), ),
path(
"events/rules/<uuid:pk>/delete/",
events_notifications_rules.NotificationRuleDeleteView.as_view(),
name="notification-rule-delete",
),
] ]

View File

@ -11,7 +11,6 @@ from django.views.generic import UpdateView
from guardian.mixins import PermissionRequiredMixin from guardian.mixins import PermissionRequiredMixin
from guardian.shortcuts import get_objects_for_user from guardian.shortcuts import get_objects_for_user
from authentik.admin.views.utils import DeleteMessageView
from authentik.core.forms.applications import ApplicationForm from authentik.core.forms.applications import ApplicationForm
from authentik.core.models import Application from authentik.core.models import Application
from authentik.lib.views import CreateAssignPermView from authentik.lib.views import CreateAssignPermView
@ -65,16 +64,3 @@ class ApplicationUpdateView(
success_url = "/" success_url = "/"
template_name = "generic/update.html" template_name = "generic/update.html"
success_message = _("Successfully updated Application") success_message = _("Successfully updated Application")
class ApplicationDeleteView(
LoginRequiredMixin, PermissionRequiredMixin, DeleteMessageView
):
"""Delete application"""
model = Application
permission_required = "authentik_core.delete_application"
success_url = "/"
template_name = "generic/delete.html"
success_message = _("Successfully deleted Application")

View File

@ -11,7 +11,6 @@ from django.views.generic import UpdateView
from django.views.generic.edit import FormView from django.views.generic.edit import FormView
from guardian.mixins import PermissionRequiredMixin from guardian.mixins import PermissionRequiredMixin
from authentik.admin.views.utils import DeleteMessageView
from authentik.crypto.builder import CertificateBuilder from authentik.crypto.builder import CertificateBuilder
from authentik.crypto.forms import ( from authentik.crypto.forms import (
CertificateKeyPairForm, CertificateKeyPairForm,
@ -80,16 +79,3 @@ class CertificateKeyPairUpdateView(
template_name = "generic/update.html" template_name = "generic/update.html"
success_url = reverse_lazy("authentik_core:shell") success_url = reverse_lazy("authentik_core:shell")
success_message = _("Successfully updated Certificate-Key Pair") success_message = _("Successfully updated Certificate-Key Pair")
class CertificateKeyPairDeleteView(
LoginRequiredMixin, PermissionRequiredMixin, DeleteMessageView
):
"""Delete certificatekeypair"""
model = CertificateKeyPair
permission_required = "authentik_crypto.delete_certificatekeypair"
template_name = "generic/delete.html"
success_url = reverse_lazy("authentik_core:shell")
success_message = _("Successfully deleted Certificate-Key Pair")

View File

@ -8,7 +8,6 @@ from django.utils.translation import gettext as _
from django.views.generic import UpdateView from django.views.generic import UpdateView
from guardian.mixins import PermissionRequiredMixin from guardian.mixins import PermissionRequiredMixin
from authentik.admin.views.utils import DeleteMessageView
from authentik.events.forms import NotificationRuleForm from authentik.events.forms import NotificationRuleForm
from authentik.events.models import NotificationRule from authentik.events.models import NotificationRule
from authentik.lib.views import CreateAssignPermView from authentik.lib.views import CreateAssignPermView
@ -46,16 +45,3 @@ class NotificationRuleUpdateView(
success_url = "/" success_url = "/"
template_name = "generic/update.html" template_name = "generic/update.html"
success_message = _("Successfully updated Notification Rule") success_message = _("Successfully updated Notification Rule")
class NotificationRuleDeleteView(
LoginRequiredMixin, PermissionRequiredMixin, DeleteMessageView
):
"""Delete application"""
model = NotificationRule
permission_required = "authentik_events.delete_NotificationRule"
success_url = "/"
template_name = "generic/delete.html"
success_message = _("Successfully deleted Notification Rule")

View File

@ -8,7 +8,6 @@ from django.utils.translation import gettext as _
from django.views.generic import UpdateView from django.views.generic import UpdateView
from guardian.mixins import PermissionRequiredMixin from guardian.mixins import PermissionRequiredMixin
from authentik.admin.views.utils import DeleteMessageView
from authentik.events.forms import NotificationTransportForm from authentik.events.forms import NotificationTransportForm
from authentik.events.models import NotificationTransport from authentik.events.models import NotificationTransport
from authentik.lib.views import CreateAssignPermView from authentik.lib.views import CreateAssignPermView
@ -44,15 +43,3 @@ class NotificationTransportUpdateView(
success_url = "/" success_url = "/"
template_name = "generic/update.html" template_name = "generic/update.html"
success_message = _("Successfully updated Notification Transport") success_message = _("Successfully updated Notification Transport")
class NotificationTransportDeleteView(
LoginRequiredMixin, PermissionRequiredMixin, DeleteMessageView
):
"""Delete application"""
model = NotificationTransport
permission_required = "authentik_events.delete_notificationtransport"
success_url = "/"
template_name = "generic/delete.html"
success_message = _("Successfully deleted Notification Transport")

View File

@ -11,7 +11,6 @@ from django.utils.translation import gettext as _
from django.views.generic import DetailView, FormView, UpdateView from django.views.generic import DetailView, FormView, UpdateView
from guardian.mixins import PermissionRequiredMixin from guardian.mixins import PermissionRequiredMixin
from authentik.admin.views.utils import DeleteMessageView
from authentik.flows.exceptions import FlowNonApplicableException from authentik.flows.exceptions import FlowNonApplicableException
from authentik.flows.forms import FlowForm, FlowImportForm from authentik.flows.forms import FlowForm, FlowImportForm
from authentik.flows.models import Flow from authentik.flows.models import Flow
@ -58,17 +57,6 @@ class FlowUpdateView(
success_message = _("Successfully updated Flow") success_message = _("Successfully updated Flow")
class FlowDeleteView(LoginRequiredMixin, PermissionRequiredMixin, DeleteMessageView):
"""Delete flow"""
model = Flow
permission_required = "authentik_flows.delete_flow"
template_name = "generic/delete.html"
success_url = reverse_lazy("authentik_core:shell")
success_message = _("Successfully deleted Flow")
class FlowDebugExecuteView(LoginRequiredMixin, PermissionRequiredMixin, DetailView): class FlowDebugExecuteView(LoginRequiredMixin, PermissionRequiredMixin, DetailView):
"""Debug exectue flow, setting the current user as pending user""" """Debug exectue flow, setting the current user as pending user"""

View File

@ -9,7 +9,6 @@ from django.utils.translation import gettext as _
from django.views.generic import UpdateView from django.views.generic import UpdateView
from guardian.mixins import PermissionRequiredMixin from guardian.mixins import PermissionRequiredMixin
from authentik.admin.views.utils import DeleteMessageView
from authentik.core.forms.groups import GroupForm from authentik.core.forms.groups import GroupForm
from authentik.core.models import Group from authentik.core.models import Group
from authentik.lib.views import CreateAssignPermView from authentik.lib.views import CreateAssignPermView
@ -47,14 +46,3 @@ class GroupUpdateView(
template_name = "generic/update.html" template_name = "generic/update.html"
success_url = reverse_lazy("authentik_core:shell") success_url = reverse_lazy("authentik_core:shell")
success_message = _("Successfully updated Group") success_message = _("Successfully updated Group")
class GroupDeleteView(LoginRequiredMixin, PermissionRequiredMixin, DeleteMessageView):
"""Delete group"""
model = Group
permission_required = "authentik_flows.delete_group"
template_name = "generic/delete.html"
success_url = reverse_lazy("authentik_core:shell")
success_message = _("Successfully deleted Group")

View File

@ -11,7 +11,6 @@ from django.utils.translation import gettext as _
from django.views.generic import UpdateView from django.views.generic import UpdateView
from guardian.mixins import PermissionRequiredMixin from guardian.mixins import PermissionRequiredMixin
from authentik.admin.views.utils import DeleteMessageView
from authentik.lib.views import CreateAssignPermView from authentik.lib.views import CreateAssignPermView
from authentik.outposts.forms import OutpostForm from authentik.outposts.forms import OutpostForm
from authentik.outposts.models import Outpost, OutpostConfig from authentik.outposts.models import Outpost, OutpostConfig
@ -54,13 +53,3 @@ class OutpostUpdateView(
success_url = "/" success_url = "/"
template_name = "generic/update.html" template_name = "generic/update.html"
success_message = _("Successfully updated Outpost") success_message = _("Successfully updated Outpost")
class OutpostDeleteView(LoginRequiredMixin, PermissionRequiredMixin, DeleteMessageView):
"""Delete outpost"""
model = Outpost
permission_required = "authentik_outposts.delete_outpost"
success_url = "/"
template_name = "generic/delete.html"
success_message = _("Successfully deleted Outpost")

View File

@ -8,11 +8,7 @@ from django.urls import reverse_lazy
from django.utils.translation import gettext as _ from django.utils.translation import gettext as _
from guardian.mixins import PermissionRequiredMixin from guardian.mixins import PermissionRequiredMixin
from authentik.admin.views.utils import ( from authentik.admin.views.utils import InheritanceCreateView, InheritanceUpdateView
DeleteMessageView,
InheritanceCreateView,
InheritanceUpdateView,
)
from authentik.outposts.models import OutpostServiceConnection from authentik.outposts.models import OutpostServiceConnection
@ -46,16 +42,3 @@ class OutpostServiceConnectionUpdateView(
template_name = "generic/update.html" template_name = "generic/update.html"
success_url = reverse_lazy("authentik_core:shell") success_url = reverse_lazy("authentik_core:shell")
success_message = _("Successfully updated Outpost Service Connection") success_message = _("Successfully updated Outpost Service Connection")
class OutpostServiceConnectionDeleteView(
LoginRequiredMixin, PermissionRequiredMixin, DeleteMessageView
):
"""Delete outpostserviceconnection"""
model = OutpostServiceConnection
permission_required = "authentik_outposts.delete_outpostserviceconnection"
template_name = "generic/delete.html"
success_url = reverse_lazy("authentik_core:shell")
success_message = _("Successfully deleted Outpost Service Connection")

View File

@ -14,11 +14,7 @@ from django.views.generic.detail import DetailView
from guardian.mixins import PermissionRequiredMixin from guardian.mixins import PermissionRequiredMixin
from authentik.admin.forms.policies import PolicyTestForm from authentik.admin.forms.policies import PolicyTestForm
from authentik.admin.views.utils import ( from authentik.admin.views.utils import InheritanceCreateView, InheritanceUpdateView
DeleteMessageView,
InheritanceCreateView,
InheritanceUpdateView,
)
from authentik.policies.models import Policy, PolicyBinding from authentik.policies.models import Policy, PolicyBinding
from authentik.policies.process import PolicyProcess, PolicyRequest from authentik.policies.process import PolicyProcess, PolicyRequest
@ -55,17 +51,6 @@ class PolicyUpdateView(
success_message = _("Successfully updated Policy") success_message = _("Successfully updated Policy")
class PolicyDeleteView(LoginRequiredMixin, PermissionRequiredMixin, DeleteMessageView):
"""Delete policy"""
model = Policy
permission_required = "authentik_policies.delete_policy"
template_name = "generic/delete.html"
success_url = reverse_lazy("authentik_core:shell")
success_message = _("Successfully deleted Policy")
class PolicyTestView(LoginRequiredMixin, DetailView, PermissionRequiredMixin, FormView): class PolicyTestView(LoginRequiredMixin, DetailView, PermissionRequiredMixin, FormView):
"""View to test policy(s)""" """View to test policy(s)"""

View File

@ -12,7 +12,6 @@ from django.utils.translation import gettext as _
from django.views.generic import UpdateView from django.views.generic import UpdateView
from guardian.mixins import PermissionRequiredMixin from guardian.mixins import PermissionRequiredMixin
from authentik.admin.views.utils import DeleteMessageView
from authentik.lib.views import CreateAssignPermView from authentik.lib.views import CreateAssignPermView
from authentik.policies.forms import PolicyBindingForm from authentik.policies.forms import PolicyBindingForm
from authentik.policies.models import PolicyBinding, PolicyBindingModel from authentik.policies.models import PolicyBinding, PolicyBindingModel
@ -66,16 +65,3 @@ class PolicyBindingUpdateView(
template_name = "generic/update.html" template_name = "generic/update.html"
success_url = reverse_lazy("authentik_core:shell") success_url = reverse_lazy("authentik_core:shell")
success_message = _("Successfully updated PolicyBinding") success_message = _("Successfully updated PolicyBinding")
class PolicyBindingDeleteView(
LoginRequiredMixin, PermissionRequiredMixin, DeleteMessageView
):
"""Delete policybinding"""
model = PolicyBinding
permission_required = "authentik_policies.delete_policybinding"
template_name = "generic/delete.html"
success_url = reverse_lazy("authentik_core:shell")
success_message = _("Successfully deleted PolicyBinding")

View File

@ -14,11 +14,7 @@ from django.views.generic.detail import DetailView
from guardian.mixins import PermissionRequiredMixin from guardian.mixins import PermissionRequiredMixin
from authentik.admin.forms.policies import PolicyTestForm from authentik.admin.forms.policies import PolicyTestForm
from authentik.admin.views.utils import ( from authentik.admin.views.utils import InheritanceCreateView, InheritanceUpdateView
DeleteMessageView,
InheritanceCreateView,
InheritanceUpdateView,
)
from authentik.core.models import PropertyMapping from authentik.core.models import PropertyMapping
@ -52,18 +48,6 @@ class PropertyMappingUpdateView(
success_message = _("Successfully updated Property Mapping") success_message = _("Successfully updated Property Mapping")
class PropertyMappingDeleteView(
LoginRequiredMixin, PermissionRequiredMixin, DeleteMessageView
):
"""Delete property_mapping"""
model = PropertyMapping
permission_required = "authentik_core.delete_propertymapping"
success_url = "/"
template_name = "generic/delete.html"
success_message = _("Successfully deleted Property Mapping")
class PropertyMappingTestView( class PropertyMappingTestView(
LoginRequiredMixin, DetailView, PermissionRequiredMixin, FormView LoginRequiredMixin, DetailView, PermissionRequiredMixin, FormView
): ):

View File

@ -7,11 +7,7 @@ from django.contrib.messages.views import SuccessMessageMixin
from django.utils.translation import gettext as _ from django.utils.translation import gettext as _
from guardian.mixins import PermissionRequiredMixin from guardian.mixins import PermissionRequiredMixin
from authentik.admin.views.utils import ( from authentik.admin.views.utils import InheritanceCreateView, InheritanceUpdateView
DeleteMessageView,
InheritanceCreateView,
InheritanceUpdateView,
)
from authentik.core.models import Provider from authentik.core.models import Provider
@ -43,15 +39,3 @@ class ProviderUpdateView(
success_url = "/" success_url = "/"
template_name = "generic/update.html" template_name = "generic/update.html"
success_message = _("Successfully updated Provider") success_message = _("Successfully updated Provider")
class ProviderDeleteView(
LoginRequiredMixin, PermissionRequiredMixin, DeleteMessageView
):
"""Delete provider"""
model = Provider
permission_required = "authentik_core.delete_provider"
success_url = "/"
template_name = "generic/delete.html"
success_message = _("Successfully deleted Provider")

View File

@ -7,11 +7,7 @@ from django.contrib.messages.views import SuccessMessageMixin
from django.utils.translation import gettext as _ from django.utils.translation import gettext as _
from guardian.mixins import PermissionRequiredMixin from guardian.mixins import PermissionRequiredMixin
from authentik.admin.views.utils import ( from authentik.admin.views.utils import InheritanceCreateView, InheritanceUpdateView
DeleteMessageView,
InheritanceCreateView,
InheritanceUpdateView,
)
from authentik.core.models import Source from authentik.core.models import Source
@ -45,14 +41,3 @@ class SourceUpdateView(
success_url = "/" success_url = "/"
template_name = "generic/update.html" template_name = "generic/update.html"
success_message = _("Successfully updated Source") success_message = _("Successfully updated Source")
class SourceDeleteView(LoginRequiredMixin, PermissionRequiredMixin, DeleteMessageView):
"""Delete source"""
model = Source
permission_required = "authentik_core.delete_source"
success_url = "/"
template_name = "generic/delete.html"
success_message = _("Successfully deleted Source")

View File

@ -8,11 +8,7 @@ from django.urls import reverse_lazy
from django.utils.translation import gettext as _ from django.utils.translation import gettext as _
from guardian.mixins import PermissionRequiredMixin from guardian.mixins import PermissionRequiredMixin
from authentik.admin.views.utils import ( from authentik.admin.views.utils import InheritanceCreateView, InheritanceUpdateView
DeleteMessageView,
InheritanceCreateView,
InheritanceUpdateView,
)
from authentik.flows.models import Stage from authentik.flows.models import Stage
@ -45,13 +41,3 @@ class StageUpdateView(
template_name = "generic/update.html" template_name = "generic/update.html"
success_url = reverse_lazy("authentik_core:shell") success_url = reverse_lazy("authentik_core:shell")
success_message = _("Successfully updated Stage") success_message = _("Successfully updated Stage")
class StageDeleteView(LoginRequiredMixin, PermissionRequiredMixin, DeleteMessageView):
"""Delete stage"""
model = Stage
template_name = "generic/delete.html"
permission_required = "authentik_flows.delete_stage"
success_url = reverse_lazy("authentik_core:shell")
success_message = _("Successfully deleted Stage")

View File

@ -12,7 +12,6 @@ from django.utils.translation import gettext as _
from django.views.generic import UpdateView from django.views.generic import UpdateView
from guardian.mixins import PermissionRequiredMixin from guardian.mixins import PermissionRequiredMixin
from authentik.admin.views.utils import DeleteMessageView
from authentik.flows.forms import FlowStageBindingForm from authentik.flows.forms import FlowStageBindingForm
from authentik.flows.models import Flow, FlowStageBinding from authentik.flows.models import Flow, FlowStageBinding
from authentik.lib.views import CreateAssignPermView from authentik.lib.views import CreateAssignPermView
@ -64,16 +63,3 @@ class StageBindingUpdateView(
template_name = "generic/update.html" template_name = "generic/update.html"
success_url = reverse_lazy("authentik_core:shell") success_url = reverse_lazy("authentik_core:shell")
success_message = _("Successfully updated StageBinding") success_message = _("Successfully updated StageBinding")
class StageBindingDeleteView(
LoginRequiredMixin, PermissionRequiredMixin, DeleteMessageView
):
"""Delete FlowStageBinding"""
model = FlowStageBinding
permission_required = "authentik_flows.delete_flowstagebinding"
template_name = "generic/delete.html"
success_url = reverse_lazy("authentik_core:shell")
success_message = _("Successfully deleted FlowStageBinding")

View File

@ -7,9 +7,7 @@ from django.contrib.messages.views import SuccessMessageMixin
from django.http import HttpResponseRedirect from django.http import HttpResponseRedirect
from django.urls import reverse_lazy from django.urls import reverse_lazy
from django.utils.translation import gettext as _ from django.utils.translation import gettext as _
from guardian.mixins import PermissionRequiredMixin
from authentik.admin.views.utils import DeleteMessageView
from authentik.lib.views import CreateAssignPermView from authentik.lib.views import CreateAssignPermView
from authentik.stages.invitation.forms import InvitationForm from authentik.stages.invitation.forms import InvitationForm
from authentik.stages.invitation.models import Invitation from authentik.stages.invitation.models import Invitation
@ -36,16 +34,3 @@ class InvitationCreateView(
obj.created_by = self.request.user obj.created_by = self.request.user
obj.save() obj.save()
return HttpResponseRedirect(self.success_url) return HttpResponseRedirect(self.success_url)
class InvitationDeleteView(
LoginRequiredMixin, PermissionRequiredMixin, DeleteMessageView
):
"""Delete invitation"""
model = Invitation
permission_required = "authentik_stages_invitation.delete_invitation"
template_name = "generic/delete.html"
success_url = reverse_lazy("authentik_core:shell")
success_message = _("Successfully deleted Invitation")

View File

@ -9,7 +9,6 @@ from django.utils.translation import gettext as _
from django.views.generic import UpdateView from django.views.generic import UpdateView
from guardian.mixins import PermissionRequiredMixin from guardian.mixins import PermissionRequiredMixin
from authentik.admin.views.utils import DeleteMessageView
from authentik.lib.views import CreateAssignPermView from authentik.lib.views import CreateAssignPermView
from authentik.stages.prompt.forms import PromptAdminForm from authentik.stages.prompt.forms import PromptAdminForm
from authentik.stages.prompt.models import Prompt from authentik.stages.prompt.models import Prompt
@ -47,14 +46,3 @@ class PromptUpdateView(
template_name = "generic/update.html" template_name = "generic/update.html"
success_url = reverse_lazy("authentik_core:shell") success_url = reverse_lazy("authentik_core:shell")
success_message = _("Successfully updated Prompt") success_message = _("Successfully updated Prompt")
class PromptDeleteView(LoginRequiredMixin, PermissionRequiredMixin, DeleteMessageView):
"""Delete prompt"""
model = Prompt
permission_required = "authentik_stages_prompt.delete_prompt"
template_name = "generic/delete.html"
success_url = reverse_lazy("authentik_core:shell")
success_message = _("Successfully deleted Prompt")

View File

@ -1,19 +0,0 @@
"""authentik Token administration"""
from django.contrib.auth.mixins import LoginRequiredMixin
from django.urls import reverse_lazy
from django.utils.translation import gettext as _
from guardian.mixins import PermissionRequiredMixin
from authentik.admin.views.utils import DeleteMessageView
from authentik.core.models import Token
class TokenDeleteView(LoginRequiredMixin, PermissionRequiredMixin, DeleteMessageView):
"""Delete token"""
model = Token
permission_required = "authentik_core.delete_token"
template_name = "generic/delete.html"
success_url = reverse_lazy("authentik_core:shell")
success_message = _("Successfully deleted Token")

View File

@ -56,19 +56,6 @@ class UserUpdateView(
success_message = _("Successfully updated User") success_message = _("Successfully updated User")
class UserDeleteView(LoginRequiredMixin, PermissionRequiredMixin, DeleteMessageView):
"""Delete user"""
model = User
permission_required = "authentik_core.delete_user"
# By default the object's name is user which is used by other checks
context_object_name = "object"
template_name = "generic/delete.html"
success_url = reverse_lazy("authentik_core:shell")
success_message = _("Successfully deleted User")
class UserDisableView(LoginRequiredMixin, PermissionRequiredMixin, DeleteMessageView): class UserDisableView(LoginRequiredMixin, PermissionRequiredMixin, DeleteMessageView):
"""Disable user""" """Disable user"""