Sha256: d63a4088d3ce5072b9565c888556641d5d2b1b454762ce51216f95e436fc0c4c

Contents?: true

Size: 348 Bytes

Versions: 4

Compression:

Stored size: 348 Bytes

Contents

class Entity < ActiveRecord::Base
  include Heimdallr::Model

  restrict do |user, record|
    if user.admin
      scope :fetch
      scope :delete
      can [:view, :create, :update]
    else
      scope :fetch,  -> { where('public = ? or owner_id = ?', true, user.id) }
      scope :delete, -> { where('owner_id = ?', user.id) }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
heimdallr-resource-1.0.3 spec/dummy/app/models/entity.rb
heimdallr-resource-1.0.2 spec/dummy/app/models/entity.rb
heimdallr-resource-1.0.1 spec/dummy/app/models/entity.rb
heimdallr-resource-1.0.0 spec/dummy/app/models/entity.rb