added an administrative method intended to be used as a before filter within the application controller as well as an is_admin? method

This commit is contained in:
Ken Johnson
2013-05-16 17:56:31 -04:00
parent 10956ed316
commit 5f80211580
2 changed files with 13 additions and 2 deletions
+12 -1
View File
@@ -1,7 +1,7 @@
class ApplicationController < ActionController::Base
before_filter :authenticated
helper_method :current_user
helper_method :current_user, :is_admin?
# Our security guy keep talking about sea-surfing, cool story bro.
# protect_from_forgery
@@ -16,4 +16,15 @@ class ApplicationController < ActionController::Base
redirect_to root_url and reset_session if not current_user
end
def is_admin?
admin = current_user.admin if current_user
end
def administrative
if not is_admin?
reset_session
redirect_to login_path
end
end
end