-
-
Save isaacsanders/1257007 to your computer and use it in GitHub Desktop.
For Jon Hogue
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
roles do | |
role :admin, [:read, :write, :execute] | |
role :user do |r| | |
action :read | |
end | |
end |
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 User | |
include ReUser | |
roles do | |
role :god {|r| r.actions :manage_all, :new_user_session, :destroy_user_session} | |
role :registrant {|r| r.action :read_event} | |
role :observer {|r| r.action :read_event} | |
role :admin {|r| r.action :manage_event} | |
mail_actions = [ :show_user, :read_todo, :box_mail, :show_mail ] | |
role :teacher {|r| r.actions mail_actions} | |
role :student {|r| r.actions mail_actions} #I think this is already valid syntax... | |
end | |
def initialize(role) | |
@role = role | |
end | |
# More User stuff | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment