summaryrefslogtreecommitdiff
path: root/app/controllers/admin_controller.rb
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2012-09-16 07:44:54 -0400
committerRobert Speicher <rspeicher@gmail.com>2012-09-16 10:06:29 -0400
commit925183ed7a8eb392e008764483f59c319e22a59c (patch)
tree8b83b70d76864103fddb997adb149dae7cf5c796 /app/controllers/admin_controller.rb
parent83f24de3520ba1c49544b268253a0665831c2bd5 (diff)
downloadgitlab-ce-925183ed7a8eb392e008764483f59c319e22a59c.tar.gz
Add an AdminController base class for Admin controllers
Handles stuff that's shared across admin controllers.
Diffstat (limited to 'app/controllers/admin_controller.rb')
-rw-r--r--app/controllers/admin_controller.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb
new file mode 100644
index 00000000000..bce9f692385
--- /dev/null
+++ b/app/controllers/admin_controller.rb
@@ -0,0 +1,11 @@
+# Provides a base class for Admin controllers to subclass
+#
+# Automatically sets the layout and ensures an administrator is logged in
+class AdminController < ApplicationController
+ layout 'admin'
+ before_filter :authenticate_admin!
+
+ def authenticate_admin!
+ return render_404 unless current_user.is_admin?
+ end
+end