Sha256: 08d77e4fd567414ae309363c7585e5f1f91532d1da03d1a719e8fc32ac63da8d

Contents?: true

Size: 836 Bytes

Versions: 20

Compression:

Stored size: 836 Bytes

Contents

class AuthorizationExtent < ActiveRecord::Base
  belongs_to :authorization

  def extent
    if extent_objid
      default_extent_class.find_by_id(extent_objid)
    end
  end

  def extent=(ext_label)
    # find asp
    extent_obj = default_extent_class.find_by_id(ext_label)
    if new_record?
      self.extent_objid = extent_obj.id
      self.extent_type = extent_obj.class.name
    else
      set_extent(extent_obj)
    end
  end

  def match_extent(extent_object)
    extent_type == extent_object.class.name && extent_objid == extent_object.id
  end

  def set_extent(extent_object)
    update_attributes(:extent_objid => extent_object.id, :extent_type => extent_object.class.name)
  end
  
  private

  def default_extent_class
    @@default_extent_class ||= Kernel.const_get(::VIGILANTE_CONFIG['default_extent_class'])
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
vigilante-1.0.19 app/models/authorization_extent.rb
vigilante-1.0.18 app/models/authorization_extent.rb
vigilante-1.0.17 app/models/authorization_extent.rb
vigilante-1.0.16 app/models/authorization_extent.rb
vigilante-1.0.15 app/models/authorization_extent.rb
vigilante-1.0.14 app/models/authorization_extent.rb
vigilante-1.0.13 app/models/authorization_extent.rb
vigilante-1.0.12 app/models/authorization_extent.rb
vigilante-1.0.11 app/models/authorization_extent.rb
vigilante-1.0.10 app/models/authorization_extent.rb
vigilante-1.0.9 app/models/authorization_extent.rb
vigilante-1.0.8 app/models/authorization_extent.rb
vigilante-1.0.7 app/models/authorization_extent.rb
vigilante-1.0.6 app/models/authorization_extent.rb
vigilante-1.0.5 app/models/authorization_extent.rb
vigilante-1.0.4 app/models/authorization_extent.rb
vigilante-1.0.3 app/models/authorization_extent.rb
vigilante-1.0.2 app/models/authorization_extent.rb
vigilante-1.0.1 app/models/authorization_extent.rb
vigilante-1.0.0 app/models/authorization_extent.rb