Created
October 13, 2008 21:16
-
-
Save technicalpickles/16605 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DownloadsController < ApplicationController | |
before_filter :redirect_to_root, :unless => :can_create?, :only => [:new, :create] | |
before_filter :redirect_to_root, :unless => :can_edit?, :only => [:edit, :update, :destroy] | |
resources_controller_for :downloads | |
def redirect_to_root | |
flash[:notice] = "DENIED!!!11one" | |
redirect_to root_url | |
end | |
helper_method :can_create?, :can_edit? | |
def can_create? | |
return !!(current_user && current_user.superuser?) | |
end | |
def can_edit? | |
return !!(current_user && current_user.superuser?) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment