diff options
-rw-r--r-- | app/helpers/application_helper.rb | 7 | ||||
-rw-r--r-- | app/views/layouts/default.rhtml | 4 |
2 files changed, 9 insertions, 2 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5c856383b..6411cf27e 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -112,5 +112,12 @@ module ApplicationHelper return "#{exact_date} (#{ago_text})" end + # Note that if the admin interface is proxied via another server, we can't + # rely on a sesssion being shared between the front end and admin interface, + # so need to check the status of the user. + def is_admin? + return !session[:using_admin].nil? || (!@user.nil? && @user.super?) + end + end diff --git a/app/views/layouts/default.rhtml b/app/views/layouts/default.rhtml index 29ff209b9..8c4ae588b 100644 --- a/app/views/layouts/default.rhtml +++ b/app/views/layouts/default.rhtml @@ -12,7 +12,7 @@ <link rel="shortcut icon" href="/favicon.ico"> <%= render :partial => 'general/stylesheet_includes' %> - <% if session[:using_admin] %> + <% if is_admin? %> <%= stylesheet_link_tag "/adminbootstraptheme/stylesheets/admin", :title => "Main", :rel => "stylesheet" %> <% end %> @@ -63,7 +63,7 @@ </script> <% end %> -<% if session[:using_admin] %> +<% if is_admin? %> <%= render :partial => 'admin_general/admin_navbar' %> <% end %> |