Sha256: 7c081ada845c908839d64ccde7f63c1ad6a3294b68855a1f7c7c7cb0da064b15

Contents?: true

Size: 514 Bytes

Versions: 4

Compression:

Stored size: 514 Bytes

Contents

class GuestPermit < Permit::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
 
    licenses :user_admin, :blogging
    # 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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cancan-permits-0.1.4 spec/cancan-permits/fixtures/permits/guest_permit.rb
cancan-permits-0.1.3 spec/cancan-permits/fixtures/permits/guest_permit.rb
cancan-permits-0.1.2 spec/cancan-permits/fixtures/permits/guest_permit.rb
cancan-permits-0.1.1 spec/cancan-permits/fixtures/permits/guest_permit.rb