Skip to content

Commit

Permalink
[#3012] Simplify unauthorized user context
Browse files Browse the repository at this point in the history
  • Loading branch information
tobes committed Nov 9, 2012
1 parent 8c09a04 commit bc73ed9
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ckan/controllers/user.py
Expand Up @@ -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')

Expand Down
2 changes: 0 additions & 2 deletions ckan/lib/base.py
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ckan/templates/header.html
Expand Up @@ -15,7 +15,7 @@ <h1>
{% endif %}
</hgroup>
<div class="content">
{% if c.userobj or c.unauthorized_user %}
{% if c.userobj or c.unauthorized_userobj %}
<div class="account section avatar authed dropdown" data-me="{{ c.userobj.id }}">
<a href="#" class="image dropdown-toggle" data-toggle="dropdown">
{{ h.gravatar((c.userobj.email_hash if c and c.userobj else ''),size=25) }}
Expand Down

0 comments on commit bc73ed9

Please sign in to comment.