Commit f6032538

mo khan <mo@mokhan.ca>
2013-12-30 04:23:44
boot people out of the admin section.
1 parent 5be3648
Changed files (2)
app
controllers
models
app/controllers/admin/users_controller.rb
@@ -1,6 +1,14 @@
 module Admin
   class UsersController < ApplicationController
+    before_filter :restrict_access!
+
     def index
     end
+
+    private
+
+    def restrict_access!
+      redirect_to root_path unless current_user.is_admin?
+    end
   end
 end
app/models/user.rb
@@ -44,6 +44,10 @@ class User < ActiveRecord::Base
     "#{id}-#{name.gsub(/[^a-z0-9]+/i, '-')}"
   end
 
+  def is_admin?
+    true
+  end
+
   def self.ordered
     User.order(:creations_count => :desc)
   end