Sha256: 5c7fc4879c4e000d634ad5b931e6b1d314fb3907b91fd5a4bd76c1c77a8cadc8

Contents?: true

Size: 484 Bytes

Versions: 1

Compression:

Stored size: 484 Bytes

Contents

class JobTemplateEffectiveUser < ActiveRecord::Base

  attr_accessible :value, :current_user, :overridable

  belongs_to :job_template

  before_validation :set_defaults

  def set_defaults
    self.overridable = true if self.overridable.nil?
    self.current_user = false if self.current_user.nil?
  end

  def compute_value
    if current_user?
      User.current.login
    elsif value.present?
      value
    else
      Setting[:remote_execution_effective_user]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
foreman_remote_execution-1.0.0 app/models/job_template_effective_user.rb