Sha256: ee1219cbc87416c2dba6169520af446bf801fe79bbc8c5adce1b7b3029b6d777

Contents?: true

Size: 597 Bytes

Versions: 5

Compression:

Stored size: 597 Bytes

Contents

class OsParameter < Parameter
  belongs_to :operatingsystem, :foreign_key => :reference_id
  audited :except => [:priority], :associated_with => :operatingsystem
  validates_uniqueness_of :name, :scope => :reference_id

  private
  def enforce_permissions operation
    # We get called again with the operation being set to create
    return true if operation == "edit" and new_record?
    return true if User.current.allowed_to?("#{operation}_operatingsystems".to_sym)

    errors.add(:base, _("You do not have permission to %s this Operating System parameter") % operation)
    false
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
foreman_discovery-1.0.0 test/foreman_app/app/models/os_parameter.rb
foreman_discovery-1.0.0.rc4 test/foreman_app/app/models/os_parameter.rb
foreman_discovery-1.0.0.rc3 test/foreman_app/app/models/os_parameter.rb
foreman_discovery-1.0.0.rc2 test/foreman_app/app/models/os_parameter.rb
foreman_discovery-1.0.0.rc1 test/foreman_app/app/models/os_parameter.rb