Change the default route to the login page
[cs356-p2-videostore.git] / app / controllers / application.rb
index e9da3d0..aaf37b3 100644 (file)
@@ -13,4 +13,12 @@ class ApplicationController < ActionController::Base
       redirect_to :controller => "login", :action => "login"
     end
   end
+
+  def manager
+    user = User.find_by_id(session[:user_id])
+    unless user and user.manager
+      flash[:notice] = "You must be a manager to access this page"
+      redirect_to :controller => "login", :action => "index"
+    end
+  end
 end