From eb954208b26a2de52d0ca587b4a8f9d12c474dae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Mon, 18 Sep 2017 14:04:52 +0200 Subject: [PATCH] Early reject when user is anonymous. This cuts down on info-level log entries, and prevents some Mongo queries. --- attract/routes.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/attract/routes.py b/attract/routes.py index 7b6517a..2254028 100644 --- a/attract/routes.py +++ b/attract/routes.py @@ -118,6 +118,10 @@ def attract_project_view(extra_project_projections: dict=None, extension_props=F # just pass everything along. return wrapped(project_url, *args, **kwargs) + if current_user.is_anonymous: + log.debug('attract_project_view: Anonymous user never has access to Attract.') + raise wz_exceptions.Forbidden() + api = pillar_api() projection_param = None if full_project else {'projection': projections}