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_invitations,
stages_prompts,
tokens,
users,
)
from authentik.providers.saml.views.metadata import MetadataImportView
@ -47,17 +46,6 @@ urlpatterns = [
applications.ApplicationUpdateView.as_view(),
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
path("sources/create/", sources.SourceCreateView.as_view(), name="source-create"),
path(
@ -65,11 +53,6 @@ urlpatterns = [
sources.SourceUpdateView.as_view(),
name="source-update",
),
path(
"sources/<uuid:pk>/delete/",
sources.SourceDeleteView.as_view(),
name="source-delete",
),
# Policies
path("policies/create/", policies.PolicyCreateView.as_view(), name="policy-create"),
path(
@ -77,11 +60,6 @@ urlpatterns = [
policies.PolicyUpdateView.as_view(),
name="policy-update",
),
path(
"policies/<uuid:pk>/delete/",
policies.PolicyDeleteView.as_view(),
name="policy-delete",
),
path(
"policies/<uuid:pk>/test/",
policies.PolicyTestView.as_view(),
@ -98,11 +76,6 @@ urlpatterns = [
policies_bindings.PolicyBindingUpdateView.as_view(),
name="policy-binding-update",
),
path(
"policies/bindings/<uuid:pk>/delete/",
policies_bindings.PolicyBindingDeleteView.as_view(),
name="policy-binding-delete",
),
# Providers
path(
"providers/create/",
@ -119,11 +92,6 @@ urlpatterns = [
providers.ProviderUpdateView.as_view(),
name="provider-update",
),
path(
"providers/<int:pk>/delete/",
providers.ProviderDeleteView.as_view(),
name="provider-delete",
),
# Stages
path("stages/create/", stages.StageCreateView.as_view(), name="stage-create"),
path(
@ -131,11 +99,6 @@ urlpatterns = [
stages.StageUpdateView.as_view(),
name="stage-update",
),
path(
"stages/<uuid:pk>/delete/",
stages.StageDeleteView.as_view(),
name="stage-delete",
),
# Stage bindings
path(
"stages/bindings/create/",
@ -147,11 +110,6 @@ urlpatterns = [
stages_bindings.StageBindingUpdateView.as_view(),
name="stage-binding-update",
),
path(
"stages/bindings/<uuid:pk>/delete/",
stages_bindings.StageBindingDeleteView.as_view(),
name="stage-binding-delete",
),
# Stage Prompts
path(
"stages_prompts/create/",
@ -163,22 +121,12 @@ urlpatterns = [
stages_prompts.PromptUpdateView.as_view(),
name="stage-prompt-update",
),
path(
"stages_prompts/<uuid:pk>/delete/",
stages_prompts.PromptDeleteView.as_view(),
name="stage-prompt-delete",
),
# Stage Invitations
path(
"stages/invitations/create/",
stages_invitations.InvitationCreateView.as_view(),
name="stage-invitation-create",
),
path(
"stages/invitations/<uuid:pk>/delete/",
stages_invitations.InvitationDeleteView.as_view(),
name="stage-invitation-delete",
),
# Flows
path(
"flows/create/",
@ -205,11 +153,6 @@ urlpatterns = [
flows.FlowExportView.as_view(),
name="flow-export",
),
path(
"flows/<uuid:pk>/delete/",
flows.FlowDeleteView.as_view(),
name="flow-delete",
),
# Property Mappings
path(
"property-mappings/create/",
@ -221,11 +164,6 @@ urlpatterns = [
property_mappings.PropertyMappingUpdateView.as_view(),
name="property-mapping-update",
),
path(
"property-mappings/<uuid:pk>/delete/",
property_mappings.PropertyMappingDeleteView.as_view(),
name="property-mapping-delete",
),
path(
"property-mappings/<uuid:pk>/test/",
property_mappings.PropertyMappingTestView.as_view(),
@ -234,7 +172,6 @@ urlpatterns = [
# Users
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>/delete/", users.UserDeleteView.as_view(), name="user-delete"),
path(
"users/<int:pk>/disable/", users.UserDisableView.as_view(), name="user-disable"
),
@ -251,11 +188,6 @@ urlpatterns = [
groups.GroupUpdateView.as_view(),
name="group-update",
),
path(
"groups/<uuid:pk>/delete/",
groups.GroupDeleteView.as_view(),
name="group-delete",
),
# Certificate-Key Pairs
path(
"crypto/certificates/create/",
@ -272,11 +204,6 @@ urlpatterns = [
certificate_key_pair.CertificateKeyPairUpdateView.as_view(),
name="certificatekeypair-update",
),
path(
"crypto/certificates/<uuid:pk>/delete/",
certificate_key_pair.CertificateKeyPairDeleteView.as_view(),
name="certificatekeypair-delete",
),
# Outposts
path(
"outposts/create/",
@ -288,11 +215,6 @@ urlpatterns = [
outposts.OutpostUpdateView.as_view(),
name="outpost-update",
),
path(
"outposts/<uuid:pk>/delete/",
outposts.OutpostDeleteView.as_view(),
name="outpost-delete",
),
# Outpost Service Connections
path(
"outpost_service_connections/create/",
@ -304,11 +226,6 @@ urlpatterns = [
outposts_service_connections.OutpostServiceConnectionUpdateView.as_view(),
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
path(
"events/transports/create/",
@ -320,11 +237,6 @@ urlpatterns = [
events_notifications_transports.NotificationTransportUpdateView.as_view(),
name="notification-transport-update",
),
path(
"events/transports/<uuid:pk>/delete/",
events_notifications_transports.NotificationTransportDeleteView.as_view(),
name="notification-transport-delete",
),
# Event Notification Rules
path(
"events/rules/create/",
@ -336,9 +248,4 @@ urlpatterns = [
events_notifications_rules.NotificationRuleUpdateView.as_view(),
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.shortcuts import get_objects_for_user
from authentik.admin.views.utils import DeleteMessageView
from authentik.core.forms.applications import ApplicationForm
from authentik.core.models import Application
from authentik.lib.views import CreateAssignPermView
@ -65,16 +64,3 @@ class ApplicationUpdateView(
success_url = "/"
template_name = "generic/update.html"
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 guardian.mixins import PermissionRequiredMixin
from authentik.admin.views.utils import DeleteMessageView
from authentik.crypto.builder import CertificateBuilder
from authentik.crypto.forms import (
CertificateKeyPairForm,
@ -80,16 +79,3 @@ class CertificateKeyPairUpdateView(
template_name = "generic/update.html"
success_url = reverse_lazy("authentik_core:shell")
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 guardian.mixins import PermissionRequiredMixin
from authentik.admin.views.utils import DeleteMessageView
from authentik.events.forms import NotificationRuleForm
from authentik.events.models import NotificationRule
from authentik.lib.views import CreateAssignPermView
@ -46,16 +45,3 @@ class NotificationRuleUpdateView(
success_url = "/"
template_name = "generic/update.html"
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 guardian.mixins import PermissionRequiredMixin
from authentik.admin.views.utils import DeleteMessageView
from authentik.events.forms import NotificationTransportForm
from authentik.events.models import NotificationTransport
from authentik.lib.views import CreateAssignPermView
@ -44,15 +43,3 @@ class NotificationTransportUpdateView(
success_url = "/"
template_name = "generic/update.html"
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 guardian.mixins import PermissionRequiredMixin
from authentik.admin.views.utils import DeleteMessageView
from authentik.flows.exceptions import FlowNonApplicableException
from authentik.flows.forms import FlowForm, FlowImportForm
from authentik.flows.models import Flow
@ -58,17 +57,6 @@ class FlowUpdateView(
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):
"""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 guardian.mixins import PermissionRequiredMixin
from authentik.admin.views.utils import DeleteMessageView
from authentik.core.forms.groups import GroupForm
from authentik.core.models import Group
from authentik.lib.views import CreateAssignPermView
@ -47,14 +46,3 @@ class GroupUpdateView(
template_name = "generic/update.html"
success_url = reverse_lazy("authentik_core:shell")
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 guardian.mixins import PermissionRequiredMixin
from authentik.admin.views.utils import DeleteMessageView
from authentik.lib.views import CreateAssignPermView
from authentik.outposts.forms import OutpostForm
from authentik.outposts.models import Outpost, OutpostConfig
@ -54,13 +53,3 @@ class OutpostUpdateView(
success_url = "/"
template_name = "generic/update.html"
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 guardian.mixins import PermissionRequiredMixin
from authentik.admin.views.utils import (
DeleteMessageView,
InheritanceCreateView,
InheritanceUpdateView,
)
from authentik.admin.views.utils import InheritanceCreateView, InheritanceUpdateView
from authentik.outposts.models import OutpostServiceConnection
@ -46,16 +42,3 @@ class OutpostServiceConnectionUpdateView(
template_name = "generic/update.html"
success_url = reverse_lazy("authentik_core:shell")
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 authentik.admin.forms.policies import PolicyTestForm
from authentik.admin.views.utils import (
DeleteMessageView,
InheritanceCreateView,
InheritanceUpdateView,
)
from authentik.admin.views.utils import InheritanceCreateView, InheritanceUpdateView
from authentik.policies.models import Policy, PolicyBinding
from authentik.policies.process import PolicyProcess, PolicyRequest
@ -55,17 +51,6 @@ class PolicyUpdateView(
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):
"""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 guardian.mixins import PermissionRequiredMixin
from authentik.admin.views.utils import DeleteMessageView
from authentik.lib.views import CreateAssignPermView
from authentik.policies.forms import PolicyBindingForm
from authentik.policies.models import PolicyBinding, PolicyBindingModel
@ -66,16 +65,3 @@ class PolicyBindingUpdateView(
template_name = "generic/update.html"
success_url = reverse_lazy("authentik_core:shell")
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 authentik.admin.forms.policies import PolicyTestForm
from authentik.admin.views.utils import (
DeleteMessageView,
InheritanceCreateView,
InheritanceUpdateView,
)
from authentik.admin.views.utils import InheritanceCreateView, InheritanceUpdateView
from authentik.core.models import PropertyMapping
@ -52,18 +48,6 @@ class PropertyMappingUpdateView(
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(
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 guardian.mixins import PermissionRequiredMixin
from authentik.admin.views.utils import (
DeleteMessageView,
InheritanceCreateView,
InheritanceUpdateView,
)
from authentik.admin.views.utils import InheritanceCreateView, InheritanceUpdateView
from authentik.core.models import Provider
@ -43,15 +39,3 @@ class ProviderUpdateView(
success_url = "/"
template_name = "generic/update.html"
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 guardian.mixins import PermissionRequiredMixin
from authentik.admin.views.utils import (
DeleteMessageView,
InheritanceCreateView,
InheritanceUpdateView,
)
from authentik.admin.views.utils import InheritanceCreateView, InheritanceUpdateView
from authentik.core.models import Source
@ -45,14 +41,3 @@ class SourceUpdateView(
success_url = "/"
template_name = "generic/update.html"
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 guardian.mixins import PermissionRequiredMixin
from authentik.admin.views.utils import (
DeleteMessageView,
InheritanceCreateView,
InheritanceUpdateView,
)
from authentik.admin.views.utils import InheritanceCreateView, InheritanceUpdateView
from authentik.flows.models import Stage
@ -45,13 +41,3 @@ class StageUpdateView(
template_name = "generic/update.html"
success_url = reverse_lazy("authentik_core:shell")
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 guardian.mixins import PermissionRequiredMixin
from authentik.admin.views.utils import DeleteMessageView
from authentik.flows.forms import FlowStageBindingForm
from authentik.flows.models import Flow, FlowStageBinding
from authentik.lib.views import CreateAssignPermView
@ -64,16 +63,3 @@ class StageBindingUpdateView(
template_name = "generic/update.html"
success_url = reverse_lazy("authentik_core:shell")
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.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.lib.views import CreateAssignPermView
from authentik.stages.invitation.forms import InvitationForm
from authentik.stages.invitation.models import Invitation
@ -36,16 +34,3 @@ class InvitationCreateView(
obj.created_by = self.request.user
obj.save()
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 guardian.mixins import PermissionRequiredMixin
from authentik.admin.views.utils import DeleteMessageView
from authentik.lib.views import CreateAssignPermView
from authentik.stages.prompt.forms import PromptAdminForm
from authentik.stages.prompt.models import Prompt
@ -47,14 +46,3 @@ class PromptUpdateView(
template_name = "generic/update.html"
success_url = reverse_lazy("authentik_core:shell")
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")
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):
"""Disable user"""