remove Application.user_is_authorized

This commit is contained in:
Jens Langhammer
2019-03-12 10:56:01 +01:00
parent 330118249e
commit 4a7b0ec8a9
3 changed files with 9 additions and 7 deletions

View File

@ -5,6 +5,7 @@ from django.contrib import messages
from django.utils.translation import gettext as _
from passbook.core.models import Application
from passbook.core.policies import PolicyEngine
LOGGER = getLogger(__name__)
@ -28,4 +29,6 @@ class AccessMixin:
def user_has_access(self, application, user):
"""Check if user has access to application."""
LOGGER.debug("Checking permissions of %s on application %s...", user, application)
return application.user_is_authorized(user)
policy_engine = PolicyEngine(application.policies.all())
policy_engine.for_user(user).with_request(self.request).build()
return policy_engine.result