Sha256: 463689f409eb34571907de14c777fa5b59d9cf2aab6ba90779d53e3c32beb2e4

Contents?: true

Size: 495 Bytes

Versions: 19

Compression:

Stored size: 495 Bytes

Contents

class GuestPermit < Permit::Base
  def initialize(ability, options = {})
    super
  end

  def permit?(user, options = {}) 
    super    
    return if !role_match? user
    
    can :read, [Comment, Post]
    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

19 entries across 19 versions & 1 rubygems

Version Path
cancan-permits-0.3.12 spec/fixtures/permits/guest_permit.rb
cancan-permits-0.3.11 spec/fixtures/permits/guest_permit.rb
cancan-permits-0.3.10 spec/fixtures/permits/guest_permit.rb
cancan-permits-0.3.9 spec/fixtures/permits/guest_permit.rb
cancan-permits-0.3.8 spec/fixtures/permits/guest_permit.rb
cancan-permits-0.3.7 spec/fixtures/permits/guest_permit.rb
cancan-permits-0.3.6 spec/fixtures/permits/guest_permit.rb
cancan-permits-0.3.5 spec/fixtures/permits/guest_permit.rb
cancan-permits-0.3.4 spec/fixtures/permits/guest_permit.rb
cancan-permits-0.3.2 spec/fixtures/permits/guest_permit.rb
cancan-permits-0.3.1 spec/fixtures/permits/guest_permit.rb
cancan-permits-0.3.0 spec/fixtures/permits/guest_permit.rb
cancan-permits-0.2.9 spec/fixtures/permits/guest_permit.rb
cancan-permits-0.2.8 spec/fixtures/permits/guest_permit.rb
cancan-permits-0.2.7 spec/fixtures/permits/guest_permit.rb
cancan-permits-0.2.5 spec/fixtures/permits/guest_permit.rb
cancan-permits-0.2.3 spec/generic/fixtures/permits/guest_permit.rb
cancan-permits-0.2.2 spec/cancan-permits/fixtures/permits/guest_permit.rb
cancan-permits-0.2.1 spec/cancan-permits/fixtures/permits/guest_permit.rb