admin: remove unneeded code

This commit is contained in:
Jens Langhammer 2021-02-19 19:31:23 +01:00
parent 93478a55d7
commit 9b12895fab
19 changed files with 15 additions and 93 deletions

View File

@ -11,7 +11,7 @@ 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 BackSuccessUrlMixin, DeleteMessageView 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
@ -19,7 +19,6 @@ from authentik.lib.views import CreateAssignPermView
class ApplicationCreateView( class ApplicationCreateView(
SuccessMessageMixin, SuccessMessageMixin,
BackSuccessUrlMixin,
LoginRequiredMixin, LoginRequiredMixin,
DjangoPermissionRequiredMixin, DjangoPermissionRequiredMixin,
CreateAssignPermView, CreateAssignPermView,
@ -52,7 +51,6 @@ class ApplicationCreateView(
class ApplicationUpdateView( class ApplicationUpdateView(
SuccessMessageMixin, SuccessMessageMixin,
BackSuccessUrlMixin,
LoginRequiredMixin, LoginRequiredMixin,
PermissionRequiredMixin, PermissionRequiredMixin,
UpdateView, UpdateView,

View File

@ -10,7 +10,7 @@ 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 BackSuccessUrlMixin, DeleteMessageView 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,
@ -22,7 +22,6 @@ from authentik.lib.views import CreateAssignPermView
class CertificateKeyPairCreateView( class CertificateKeyPairCreateView(
SuccessMessageMixin, SuccessMessageMixin,
BackSuccessUrlMixin,
LoginRequiredMixin, LoginRequiredMixin,
DjangoPermissionRequiredMixin, DjangoPermissionRequiredMixin,
CreateAssignPermView, CreateAssignPermView,
@ -40,7 +39,6 @@ class CertificateKeyPairCreateView(
class CertificateKeyPairGenerateView( class CertificateKeyPairGenerateView(
SuccessMessageMixin, SuccessMessageMixin,
BackSuccessUrlMixin,
LoginRequiredMixin, LoginRequiredMixin,
DjangoPermissionRequiredMixin, DjangoPermissionRequiredMixin,
FormView, FormView,
@ -68,7 +66,6 @@ class CertificateKeyPairGenerateView(
class CertificateKeyPairUpdateView( class CertificateKeyPairUpdateView(
SuccessMessageMixin, SuccessMessageMixin,
BackSuccessUrlMixin,
LoginRequiredMixin, LoginRequiredMixin,
PermissionRequiredMixin, PermissionRequiredMixin,
UpdateView, UpdateView,

View File

@ -8,7 +8,7 @@ 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 BackSuccessUrlMixin, DeleteMessageView 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
@ -16,7 +16,6 @@ from authentik.lib.views import CreateAssignPermView
class NotificationRuleCreateView( class NotificationRuleCreateView(
SuccessMessageMixin, SuccessMessageMixin,
BackSuccessUrlMixin,
LoginRequiredMixin, LoginRequiredMixin,
DjangoPermissionRequiredMixin, DjangoPermissionRequiredMixin,
CreateAssignPermView, CreateAssignPermView,
@ -33,7 +32,6 @@ class NotificationRuleCreateView(
class NotificationRuleUpdateView( class NotificationRuleUpdateView(
SuccessMessageMixin, SuccessMessageMixin,
BackSuccessUrlMixin,
LoginRequiredMixin, LoginRequiredMixin,
PermissionRequiredMixin, PermissionRequiredMixin,
UpdateView, UpdateView,

View File

@ -8,7 +8,7 @@ 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 BackSuccessUrlMixin, DeleteMessageView 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
@ -16,7 +16,6 @@ from authentik.lib.views import CreateAssignPermView
class NotificationTransportCreateView( class NotificationTransportCreateView(
SuccessMessageMixin, SuccessMessageMixin,
BackSuccessUrlMixin,
LoginRequiredMixin, LoginRequiredMixin,
DjangoPermissionRequiredMixin, DjangoPermissionRequiredMixin,
CreateAssignPermView, CreateAssignPermView,
@ -33,7 +32,6 @@ class NotificationTransportCreateView(
class NotificationTransportUpdateView( class NotificationTransportUpdateView(
SuccessMessageMixin, SuccessMessageMixin,
BackSuccessUrlMixin,
LoginRequiredMixin, LoginRequiredMixin,
PermissionRequiredMixin, PermissionRequiredMixin,
UpdateView, UpdateView,

View File

@ -10,7 +10,7 @@ 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 BackSuccessUrlMixin, DeleteMessageView 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
@ -25,7 +25,6 @@ from authentik.lib.views import CreateAssignPermView, bad_request_message
class FlowCreateView( class FlowCreateView(
SuccessMessageMixin, SuccessMessageMixin,
BackSuccessUrlMixin,
LoginRequiredMixin, LoginRequiredMixin,
DjangoPermissionRequiredMixin, DjangoPermissionRequiredMixin,
CreateAssignPermView, CreateAssignPermView,
@ -43,7 +42,6 @@ class FlowCreateView(
class FlowUpdateView( class FlowUpdateView(
SuccessMessageMixin, SuccessMessageMixin,
BackSuccessUrlMixin,
LoginRequiredMixin, LoginRequiredMixin,
PermissionRequiredMixin, PermissionRequiredMixin,
UpdateView, UpdateView,

View File

@ -8,7 +8,7 @@ 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 BackSuccessUrlMixin, DeleteMessageView 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
@ -16,7 +16,6 @@ from authentik.lib.views import CreateAssignPermView
class GroupCreateView( class GroupCreateView(
SuccessMessageMixin, SuccessMessageMixin,
BackSuccessUrlMixin,
LoginRequiredMixin, LoginRequiredMixin,
DjangoPermissionRequiredMixin, DjangoPermissionRequiredMixin,
CreateAssignPermView, CreateAssignPermView,
@ -34,7 +33,6 @@ class GroupCreateView(
class GroupUpdateView( class GroupUpdateView(
SuccessMessageMixin, SuccessMessageMixin,
BackSuccessUrlMixin,
LoginRequiredMixin, LoginRequiredMixin,
PermissionRequiredMixin, PermissionRequiredMixin,
UpdateView, UpdateView,

View File

@ -11,7 +11,7 @@ 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 BackSuccessUrlMixin, DeleteMessageView 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
@ -19,7 +19,6 @@ from authentik.outposts.models import Outpost, OutpostConfig
class OutpostCreateView( class OutpostCreateView(
SuccessMessageMixin, SuccessMessageMixin,
BackSuccessUrlMixin,
LoginRequiredMixin, LoginRequiredMixin,
DjangoPermissionRequiredMixin, DjangoPermissionRequiredMixin,
CreateAssignPermView, CreateAssignPermView,
@ -43,7 +42,6 @@ class OutpostCreateView(
class OutpostUpdateView( class OutpostUpdateView(
SuccessMessageMixin, SuccessMessageMixin,
BackSuccessUrlMixin,
LoginRequiredMixin, LoginRequiredMixin,
PermissionRequiredMixin, PermissionRequiredMixin,
UpdateView, UpdateView,

View File

@ -8,7 +8,6 @@ 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 (
BackSuccessUrlMixin,
DeleteMessageView, DeleteMessageView,
InheritanceCreateView, InheritanceCreateView,
InheritanceUpdateView, InheritanceUpdateView,
@ -18,7 +17,6 @@ from authentik.outposts.models import OutpostServiceConnection
class OutpostServiceConnectionCreateView( class OutpostServiceConnectionCreateView(
SuccessMessageMixin, SuccessMessageMixin,
BackSuccessUrlMixin,
LoginRequiredMixin, LoginRequiredMixin,
DjangoPermissionRequiredMixin, DjangoPermissionRequiredMixin,
InheritanceCreateView, InheritanceCreateView,
@ -35,7 +33,6 @@ class OutpostServiceConnectionCreateView(
class OutpostServiceConnectionUpdateView( class OutpostServiceConnectionUpdateView(
SuccessMessageMixin, SuccessMessageMixin,
BackSuccessUrlMixin,
LoginRequiredMixin, LoginRequiredMixin,
PermissionRequiredMixin, PermissionRequiredMixin,
InheritanceUpdateView, InheritanceUpdateView,

View File

@ -14,7 +14,6 @@ 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 (
BackSuccessUrlMixin,
DeleteMessageView, DeleteMessageView,
InheritanceCreateView, InheritanceCreateView,
InheritanceUpdateView, InheritanceUpdateView,
@ -25,7 +24,6 @@ from authentik.policies.process import PolicyProcess, PolicyRequest
class PolicyCreateView( class PolicyCreateView(
SuccessMessageMixin, SuccessMessageMixin,
BackSuccessUrlMixin,
LoginRequiredMixin, LoginRequiredMixin,
DjangoPermissionRequiredMixin, DjangoPermissionRequiredMixin,
InheritanceCreateView, InheritanceCreateView,
@ -42,7 +40,6 @@ class PolicyCreateView(
class PolicyUpdateView( class PolicyUpdateView(
SuccessMessageMixin, SuccessMessageMixin,
BackSuccessUrlMixin,
LoginRequiredMixin, LoginRequiredMixin,
PermissionRequiredMixin, PermissionRequiredMixin,
InheritanceUpdateView, InheritanceUpdateView,

View File

@ -11,7 +11,7 @@ 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 BackSuccessUrlMixin, DeleteMessageView 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
@ -19,7 +19,6 @@ from authentik.policies.models import PolicyBinding, PolicyBindingModel
class PolicyBindingCreateView( class PolicyBindingCreateView(
SuccessMessageMixin, SuccessMessageMixin,
BackSuccessUrlMixin,
LoginRequiredMixin, LoginRequiredMixin,
DjangoPermissionRequiredMixin, DjangoPermissionRequiredMixin,
CreateAssignPermView, CreateAssignPermView,
@ -53,7 +52,6 @@ class PolicyBindingCreateView(
class PolicyBindingUpdateView( class PolicyBindingUpdateView(
SuccessMessageMixin, SuccessMessageMixin,
BackSuccessUrlMixin,
LoginRequiredMixin, LoginRequiredMixin,
PermissionRequiredMixin, PermissionRequiredMixin,
UpdateView, UpdateView,

View File

@ -15,7 +15,6 @@ 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 (
BackSuccessUrlMixin,
DeleteMessageView, DeleteMessageView,
InheritanceCreateView, InheritanceCreateView,
InheritanceUpdateView, InheritanceUpdateView,
@ -25,7 +24,6 @@ from authentik.core.models import PropertyMapping
class PropertyMappingCreateView( class PropertyMappingCreateView(
SuccessMessageMixin, SuccessMessageMixin,
BackSuccessUrlMixin,
LoginRequiredMixin, LoginRequiredMixin,
DjangoPermissionRequiredMixin, DjangoPermissionRequiredMixin,
InheritanceCreateView, InheritanceCreateView,
@ -41,7 +39,6 @@ class PropertyMappingCreateView(
class PropertyMappingUpdateView( class PropertyMappingUpdateView(
SuccessMessageMixin, SuccessMessageMixin,
BackSuccessUrlMixin,
LoginRequiredMixin, LoginRequiredMixin,
PermissionRequiredMixin, PermissionRequiredMixin,
InheritanceUpdateView, InheritanceUpdateView,

View File

@ -8,7 +8,6 @@ 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 (
BackSuccessUrlMixin,
DeleteMessageView, DeleteMessageView,
InheritanceCreateView, InheritanceCreateView,
InheritanceUpdateView, InheritanceUpdateView,
@ -18,7 +17,6 @@ from authentik.core.models import Provider
class ProviderCreateView( class ProviderCreateView(
SuccessMessageMixin, SuccessMessageMixin,
BackSuccessUrlMixin,
LoginRequiredMixin, LoginRequiredMixin,
DjangoPermissionRequiredMixin, DjangoPermissionRequiredMixin,
InheritanceCreateView, InheritanceCreateView,
@ -34,7 +32,6 @@ class ProviderCreateView(
class ProviderUpdateView( class ProviderUpdateView(
SuccessMessageMixin, SuccessMessageMixin,
BackSuccessUrlMixin,
LoginRequiredMixin, LoginRequiredMixin,
PermissionRequiredMixin, PermissionRequiredMixin,
InheritanceUpdateView, InheritanceUpdateView,

View File

@ -8,7 +8,6 @@ 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 (
BackSuccessUrlMixin,
DeleteMessageView, DeleteMessageView,
InheritanceCreateView, InheritanceCreateView,
InheritanceUpdateView, InheritanceUpdateView,
@ -18,7 +17,6 @@ from authentik.core.models import Source
class SourceCreateView( class SourceCreateView(
SuccessMessageMixin, SuccessMessageMixin,
BackSuccessUrlMixin,
LoginRequiredMixin, LoginRequiredMixin,
DjangoPermissionRequiredMixin, DjangoPermissionRequiredMixin,
InheritanceCreateView, InheritanceCreateView,
@ -34,7 +32,6 @@ class SourceCreateView(
class SourceUpdateView( class SourceUpdateView(
SuccessMessageMixin, SuccessMessageMixin,
BackSuccessUrlMixin,
LoginRequiredMixin, LoginRequiredMixin,
PermissionRequiredMixin, PermissionRequiredMixin,
InheritanceUpdateView, InheritanceUpdateView,

View File

@ -8,7 +8,6 @@ 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 (
BackSuccessUrlMixin,
DeleteMessageView, DeleteMessageView,
InheritanceCreateView, InheritanceCreateView,
InheritanceUpdateView, InheritanceUpdateView,
@ -18,7 +17,6 @@ from authentik.flows.models import Stage
class StageCreateView( class StageCreateView(
SuccessMessageMixin, SuccessMessageMixin,
BackSuccessUrlMixin,
LoginRequiredMixin, LoginRequiredMixin,
DjangoPermissionRequiredMixin, DjangoPermissionRequiredMixin,
InheritanceCreateView, InheritanceCreateView,
@ -35,7 +33,6 @@ class StageCreateView(
class StageUpdateView( class StageUpdateView(
SuccessMessageMixin, SuccessMessageMixin,
BackSuccessUrlMixin,
LoginRequiredMixin, LoginRequiredMixin,
PermissionRequiredMixin, PermissionRequiredMixin,
InheritanceUpdateView, InheritanceUpdateView,

View File

@ -11,7 +11,7 @@ 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 BackSuccessUrlMixin, DeleteMessageView 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
@ -19,7 +19,6 @@ from authentik.lib.views import CreateAssignPermView
class StageBindingCreateView( class StageBindingCreateView(
SuccessMessageMixin, SuccessMessageMixin,
BackSuccessUrlMixin,
LoginRequiredMixin, LoginRequiredMixin,
DjangoPermissionRequiredMixin, DjangoPermissionRequiredMixin,
CreateAssignPermView, CreateAssignPermView,
@ -51,7 +50,6 @@ class StageBindingCreateView(
class StageBindingUpdateView( class StageBindingUpdateView(
SuccessMessageMixin, SuccessMessageMixin,
BackSuccessUrlMixin,
LoginRequiredMixin, LoginRequiredMixin,
PermissionRequiredMixin, PermissionRequiredMixin,
UpdateView, UpdateView,

View File

@ -11,7 +11,6 @@ from django.views.generic import ListView
from guardian.mixins import PermissionListMixin, PermissionRequiredMixin from guardian.mixins import PermissionListMixin, PermissionRequiredMixin
from authentik.admin.views.utils import ( from authentik.admin.views.utils import (
BackSuccessUrlMixin,
DeleteMessageView, DeleteMessageView,
SearchListMixin, SearchListMixin,
UserPaginateListMixin, UserPaginateListMixin,
@ -39,7 +38,6 @@ class InvitationListView(
class InvitationCreateView( class InvitationCreateView(
SuccessMessageMixin, SuccessMessageMixin,
BackSuccessUrlMixin,
LoginRequiredMixin, LoginRequiredMixin,
DjangoPermissionRequiredMixin, DjangoPermissionRequiredMixin,
CreateAssignPermView, CreateAssignPermView,

View File

@ -10,7 +10,6 @@ from django.views.generic import ListView, UpdateView
from guardian.mixins import PermissionListMixin, PermissionRequiredMixin from guardian.mixins import PermissionListMixin, PermissionRequiredMixin
from authentik.admin.views.utils import ( from authentik.admin.views.utils import (
BackSuccessUrlMixin,
DeleteMessageView, DeleteMessageView,
SearchListMixin, SearchListMixin,
UserPaginateListMixin, UserPaginateListMixin,
@ -43,7 +42,6 @@ class PromptListView(
class PromptCreateView( class PromptCreateView(
SuccessMessageMixin, SuccessMessageMixin,
BackSuccessUrlMixin,
LoginRequiredMixin, LoginRequiredMixin,
DjangoPermissionRequiredMixin, DjangoPermissionRequiredMixin,
CreateAssignPermView, CreateAssignPermView,
@ -61,7 +59,6 @@ class PromptCreateView(
class PromptUpdateView( class PromptUpdateView(
SuccessMessageMixin, SuccessMessageMixin,
BackSuccessUrlMixin,
LoginRequiredMixin, LoginRequiredMixin,
PermissionRequiredMixin, PermissionRequiredMixin,
UpdateView, UpdateView,

View File

@ -14,14 +14,13 @@ from django.views.generic import DetailView, UpdateView
from guardian.mixins import PermissionRequiredMixin from guardian.mixins import PermissionRequiredMixin
from authentik.admin.forms.users import UserForm from authentik.admin.forms.users import UserForm
from authentik.admin.views.utils import BackSuccessUrlMixin, DeleteMessageView from authentik.admin.views.utils import DeleteMessageView
from authentik.core.models import Token, User from authentik.core.models import Token, User
from authentik.lib.views import CreateAssignPermView from authentik.lib.views import CreateAssignPermView
class UserCreateView( class UserCreateView(
SuccessMessageMixin, SuccessMessageMixin,
BackSuccessUrlMixin,
LoginRequiredMixin, LoginRequiredMixin,
DjangoPermissionRequiredMixin, DjangoPermissionRequiredMixin,
CreateAssignPermView, CreateAssignPermView,
@ -39,7 +38,6 @@ class UserCreateView(
class UserUpdateView( class UserUpdateView(
SuccessMessageMixin, SuccessMessageMixin,
BackSuccessUrlMixin,
LoginRequiredMixin, LoginRequiredMixin,
PermissionRequiredMixin, PermissionRequiredMixin,
UpdateView, UpdateView,
@ -70,9 +68,7 @@ class UserDeleteView(LoginRequiredMixin, PermissionRequiredMixin, DeleteMessageV
success_message = _("Successfully deleted User") success_message = _("Successfully deleted User")
class UserDisableView( class UserDisableView(LoginRequiredMixin, PermissionRequiredMixin, DeleteMessageView):
LoginRequiredMixin, PermissionRequiredMixin, BackSuccessUrlMixin, DeleteMessageView
):
"""Disable user""" """Disable user"""
object: User object: User
@ -94,9 +90,7 @@ class UserDisableView(
return HttpResponseRedirect(success_url) return HttpResponseRedirect(success_url)
class UserEnableView( class UserEnableView(LoginRequiredMixin, PermissionRequiredMixin, DetailView):
LoginRequiredMixin, PermissionRequiredMixin, BackSuccessUrlMixin, DetailView
):
"""Enable user""" """Enable user"""
object: User object: User
@ -111,10 +105,9 @@ class UserEnableView(
def get(self, request: HttpRequest, *args, **kwargs): def get(self, request: HttpRequest, *args, **kwargs):
self.object: User = self.get_object() self.object: User = self.get_object()
success_url = self.get_success_url()
self.object.is_active = True self.object.is_active = True
self.object.save() self.object.save()
return HttpResponseRedirect(success_url) return HttpResponseRedirect(self.success_url)
class UserPasswordResetView(LoginRequiredMixin, PermissionRequiredMixin, DetailView): class UserPasswordResetView(LoginRequiredMixin, PermissionRequiredMixin, DetailView):

View File

@ -1,6 +1,5 @@
"""authentik admin util views""" """authentik admin util views"""
from typing import Any, Optional from typing import Any
from urllib.parse import urlparse
from django.contrib import messages from django.contrib import messages
from django.contrib.messages.views import SuccessMessageMixin from django.contrib.messages.views import SuccessMessageMixin
@ -8,7 +7,7 @@ from django.contrib.postgres.search import SearchQuery, SearchVector
from django.db.models import QuerySet from django.db.models import QuerySet
from django.http import Http404 from django.http import Http404
from django.http.request import HttpRequest from django.http.request import HttpRequest
from django.views.generic import DeleteView, ListView, UpdateView from django.views.generic import DeleteView, UpdateView
from django.views.generic.list import MultipleObjectMixin from django.views.generic.list import MultipleObjectMixin
from authentik.lib.utils.reflection import all_subclasses from authentik.lib.utils.reflection import all_subclasses
@ -25,17 +24,6 @@ class DeleteMessageView(SuccessMessageMixin, DeleteView):
return super().delete(request, *args, **kwargs) return super().delete(request, *args, **kwargs)
class InheritanceListView(ListView):
"""ListView for objects using InheritanceManager"""
def get_context_data(self, **kwargs):
kwargs["types"] = {x.__name__: x for x in all_subclasses(self.model)}
return super().get_context_data(**kwargs)
def get_queryset(self):
return super().get_queryset().select_subclasses()
class SearchListMixin(MultipleObjectMixin): class SearchListMixin(MultipleObjectMixin):
"""Accept search query using `search` querystring parameter. Requires self.search_fields, """Accept search query using `search` querystring parameter. Requires self.search_fields,
a list of all fields to search. Can contain special lookups like __icontains""" a list of all fields to search. Can contain special lookups like __icontains"""
@ -98,23 +86,6 @@ class InheritanceUpdateView(UpdateView):
) )
class BackSuccessUrlMixin:
"""Checks if a relative URL has been given as ?back param, and redirect to it. Otherwise
default to self.success_url."""
request: HttpRequest
success_url: Optional[str]
def get_success_url(self) -> str:
"""get_success_url from FormMixin"""
back_param = self.request.GET.get("back")
if back_param:
if not bool(urlparse(back_param).netloc):
return back_param
return str(self.success_url)
class UserPaginateListMixin: class UserPaginateListMixin:
"""Get paginate_by value from user's attributes, defaulting to 15""" """Get paginate_by value from user's attributes, defaulting to 15"""