Sha256: c26de452783039155fa31573d8c634b088e7cb6b6c2005112d6f5327ed46bc2f

Contents?: true

Size: 531 Bytes

Versions: 1

Compression:

Stored size: 531 Bytes

Contents

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

    def permit?(user, request=nil) 
      super
      return if !role_match? user
     
      # uses default user_id
      owns(user, Comment)     
      # 
      owns(user, Post, :writer)
      # 
      owns(user, Article, :author, :name)

      # 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/editor_permit.rb