Sha256: f34d6a97c6d50be70d26b081d01c22a5be40e55ad66c6b0ef4886d0abef370db

Contents?: true

Size: 940 Bytes

Versions: 42

Compression:

Stored size: 940 Bytes

Contents

# API key to access the RPC.
class Mdm::ApiKey < ActiveRecord::Base
  
  #
  # Attributes
  #

  # @!attribute [rw] created_at
  #   When this API Key was created.
  #
  #   @return [DateTime]

  # @!attribute [rw] token
  #   The API Key to authenicate to the RPC.
  #
  #   @return [String]

  # @!attribute [rw] updated_at
  #   The last time this API Key was updated.
  #
  #   @return [DateTime]

  #
  #
  # Validations
  #
  #

  #
  # Method Validations
  #

  validate :supports_api

  #
  # Attribute Validations
  #

  validates :token, :presence => true, :length => { :minimum => 8 }

  #
  # Instance Methods
  #

  protected


  # Validates whether License supports API.
  #
  # @return [void]
  # @todo MSP-2724
  def supports_api
    license = License.get

    if license and not license.supports_api?
      errors[:license] = " - this product does not support API access"
    end
  end

  Metasploit::Concern.run(self)
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
metasploit_data_models-3.0.10 app/models/mdm/api_key.rb
metasploit_data_models-3.0.9 app/models/mdm/api_key.rb
metasploit_data_models-3.0.8 app/models/mdm/api_key.rb
metasploit_data_models-3.0.7 app/models/mdm/api_key.rb
metasploit_data_models-3.0.6 app/models/mdm/api_key.rb
metasploit_data_models-3.0.5 app/models/mdm/api_key.rb
metasploit_data_models-2.0.17 app/models/mdm/api_key.rb
metasploit_data_models-3.0.4 app/models/mdm/api_key.rb
metasploit_data_models-3.0.2 app/models/mdm/api_key.rb
metasploit_data_models-3.0.1 app/models/mdm/api_key.rb
metasploit_data_models-3.0.0 app/models/mdm/api_key.rb
metasploit_data_models-2.0.16 app/models/mdm/api_key.rb
metasploit_data_models-2.0.15 app/models/mdm/api_key.rb
metasploit_data_models-2.0.14 app/models/mdm/api_key.rb
metasploit_data_models-2.0.13 app/models/mdm/api_key.rb
metasploit_data_models-2.0.12 app/models/mdm/api_key.rb
metasploit_data_models-2.0.11 app/models/mdm/api_key.rb
metasploit_data_models-2.0.10 app/models/mdm/api_key.rb
metasploit_data_models-2.0.9 app/models/mdm/api_key.rb
metasploit_data_models-2.0.8 app/models/mdm/api_key.rb