From 1684adbd4dd7572d14774fe4be5a5536ef06f161 Mon Sep 17 00:00:00 2001 From: Tom Teichler <tom.teichler@teckids.org> Date: Thu, 13 Jan 2022 22:40:25 +0100 Subject: [PATCH] Fix permission checker --- aleksis/core/views.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/aleksis/core/views.py b/aleksis/core/views.py index 45167450e..ec38875ad 100644 --- a/aleksis/core/views.py +++ b/aleksis/core/views.py @@ -56,7 +56,6 @@ from oauth2_provider.models import get_application_model from oauth2_provider.views import AuthorizationView from reversion import set_user from reversion.views import RevisionMixin -from rules import test_rule from rules.contrib.views import PermissionRequiredMixin, permission_required from two_factor.views.core import LoginView as AllAuthLoginView @@ -1409,7 +1408,9 @@ class AccountRegisterView(SignupView): success_url = "index" def dispatch(self, request, *args, **kwargs): - if not test_rule("core.can_register") and not request.session.get("account_verified_email"): + if not request.user.has_perm("core.can_register") and not request.session.get( + "account_verified_email" + ): raise PermissionDenied() return super(AccountRegisterView, self).dispatch(request, *args, **kwargs) -- GitLab