From bc73ed9ee7af3b6f7dcf708ae8055fa2c452fd0a Mon Sep 17 00:00:00 2001 From: tobes Date: Fri, 9 Nov 2012 14:10:48 +0000 Subject: [PATCH] [#3012] Simplify unauthorized user context --- ckan/controllers/user.py | 2 +- ckan/lib/base.py | 2 -- ckan/templates/header.html | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/ckan/controllers/user.py b/ckan/controllers/user.py index 58d96d356e3..fea213aae4c 100644 --- a/ckan/controllers/user.py +++ b/ckan/controllers/user.py @@ -296,7 +296,7 @@ def login(self, error=None): return render('user/login.html', extra_vars=vars) else: # if the user is unauthorized display appropriate page - if c.unauthorized_user: + if c.unauthorized_userobj: return render('user/unauthorized.html') return render('user/logout_first.html') diff --git a/ckan/lib/base.py b/ckan/lib/base.py index a8817e64a7b..c2495759841 100644 --- a/ckan/lib/base.py +++ b/ckan/lib/base.py @@ -269,12 +269,10 @@ def _identify_user(self): # If ckan is configured to only allow authorized users we check this # here. Sysadmins are always authorized. If not authorized we # remove c.userobj and set the c.unauthorized_user flag. - c.unauthorized_user = False if c.userobj and g.authorized_users_only: if not (c.userobj.authorized or c.userobj.sysadmin): c.unauthorized_userobj = c.userobj c.userobj = None - c.unauthorized_user = True if c.user: c.author = c.user diff --git a/ckan/templates/header.html b/ckan/templates/header.html index 54db84f70a4..1885486066d 100644 --- a/ckan/templates/header.html +++ b/ckan/templates/header.html @@ -15,7 +15,7 @@

{% endif %}
- {% if c.userobj or c.unauthorized_user %} + {% if c.userobj or c.unauthorized_userobj %}