summaryrefslogtreecommitdiff
path: root/users/app/controllers/application_controller.rb
diff options
context:
space:
mode:
authorjessib <jessib@riseup.net>2012-10-17 10:12:11 -0700
committerjessib <jessib@riseup.net>2012-10-17 10:12:11 -0700
commitc072a2fe1d50715bad1cd8c14213cba6aa1cc8ff (patch)
tree14a599dadbe440952c0de73c487113bc09aa9142 /users/app/controllers/application_controller.rb
parent171d07a64d3f76e68c22f0fb4cc3795daad806d1 (diff)
parentd9a510fa2126c29f0af58c6bbeff35802777eee6 (diff)
Merge branch 'develop' into help_develop
Diffstat (limited to 'users/app/controllers/application_controller.rb')
-rw-r--r--users/app/controllers/application_controller.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/users/app/controllers/application_controller.rb b/users/app/controllers/application_controller.rb
new file mode 100644
index 0000000..64e1a55
--- /dev/null
+++ b/users/app/controllers/application_controller.rb
@@ -0,0 +1,14 @@
+class ApplicationController < ActionController::Base
+ protect_from_forgery
+
+ private
+
+ def current_user
+ @current_user ||= User.find(session[:user_id]) if session[:user_id]
+ end
+ helper_method :current_user
+
+ def authorize
+ redirect_to login_url, alert: "Not authorized" if current_user.nil?
+ end
+end