Sha256: dd5c906f45498d25a5cacb166d51b3eb7b55164809d9f07961ab1425ccd0aada

Contents?: true

Size: 637 Bytes

Versions: 15

Compression:

Stored size: 637 Bytes

Contents

module License
  class Base
    attr_reader :permit
    
    def initialize permit
      @permit = permit
    end

    def enforce!
      raise "enforce! must be implemented by subclass of License::Base"
    end
    
    def can(action, subject, conditions = nil, &block)
      permit.can action, subject, conditions, &block
    end
        
    def cannot(action, subject, conditions = nil, &block)
      permit.cannot action, subject, conditions, &block
    end
    
    def owns(user, clazz, ownership_relation = :user_id, user_id_attribute = :id)
      permit.owns user, clazz, ownership_relation, user_id_attribute
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
cancan-permits-0.3.4 lib/cancan-permits/license/base_license.rb
cancan-permits-0.3.2 lib/cancan-permits/license/base_license.rb
cancan-permits-0.3.1 lib/cancan-permits/license/base_license.rb
cancan-permits-0.3.0 lib/cancan-permits/license/base_license.rb
cancan-permits-0.2.9 lib/cancan-permits/license/base_license.rb
cancan-permits-0.2.8 lib/cancan-permits/license/base_license.rb
cancan-permits-0.2.7 lib/cancan-permits/license/base_license.rb
cancan-permits-0.2.5 lib/cancan-permits/permit/base_license.rb
cancan-permits-0.2.3 lib/cancan-permits/permit/base_license.rb
cancan-permits-0.2.2 lib/cancan-permits/permit/base_license.rb
cancan-permits-0.2.1 lib/cancan-permits/permit/base_license.rb
cancan-permits-0.1.4 lib/cancan-permits/permit/base_license.rb
cancan-permits-0.1.3 lib/cancan-permits/permit/base_license.rb
cancan-permits-0.1.2 lib/cancan-permits/permit/base_license.rb
cancan-permits-0.1.1 lib/cancan-permits/permit/base_license.rb