Sha256: 4fa8376532f3435297b76645da8c9de7f6f98d23267d278dded61c8a177f192c

Contents?: true

Size: 528 Bytes

Versions: 1

Compression:

Stored size: 528 Bytes

Contents

module RolePermit
  class Guest < Base
    def initialize(ability)
      super
    end

    def permit?(user, request=nil) 
      super
      return if !role_match? user
      
      can :read, [Comment, Post]
      can [:update, :destroy], [Comment]
      can :create, Article
      
      # owns(user, Comment)
      
      # a user can manage comments he/she created
      # can :manage, Comment do |comment|
      #   comment.try(:user) == user
      # end            
      
      # can :create, Comment
    end  
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cancan-permits-0.1.0 spec/cancan-permits/fixtures/permits/guest_permit.rb