Created
July 14, 2010 18:04
-
-
Save noahhendrix/475776 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 Ability | |
include CanCan::Ability | |
def initialize(user) | |
if user.is? :admin | |
can :read, :all | |
can :manage, Activity, :user_id => [user.id, *user.asm_ids] | |
elsif user.is? :supervisor | |
can :manage, Activity, :user_id => [user.id, *user.asm_ids] | |
elsif user.is? :ASM | |
can :manage, Activity, :user_id => user.id | |
end | |
can :read, Contact | |
can :manage, Contact do |contact| | |
contact && user.contact_ids.include?(contact.id) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment