Sha256: 7dfb229462aca9d2cf1470c23f852c071a949f03ca78afa6b20cc64f5123ca42

Contents?: true

Size: 457 Bytes

Versions: 4

Compression:

Stored size: 457 Bytes

Contents

class JobTemplateEffectiveUser < ActiveRecord::Base

  belongs_to :job_template

  before_validation :set_defaults

  belongs_to :job_template

  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

4 entries across 4 versions & 1 rubygems

Version Path
foreman_remote_execution-0.2.3 app/models/job_template_effective_user.rb
foreman_remote_execution-0.2.2 app/models/job_template_effective_user.rb
foreman_remote_execution-0.2.1 app/models/job_template_effective_user.rb
foreman_remote_execution-0.1.2 app/models/job_template_effective_user.rb