Sha256: b29f2d0742bbabdd94ed0379e1edcb390a318e7d56249ae33d4a2c5347208845

Contents?: true

Size: 523 Bytes

Versions: 61

Compression:

Stored size: 523 Bytes

Contents

# frozen_string_literal: true
default_permissions = Foreman::Plugin.find("foreman_discovery").default_roles

["Discovery Reader", "Discovery Manager"].each do |role_name|
  Role.ignore_locking do
    role = Role.unscoped.find_by_name(role_name) || next
    default_permissions[role_name].each do |permission|
      role.add_permissions(permission) unless role.permission_names.include?(permission.to_sym)
    end
    role.origin = 'discovery'
    role.description = 'Discovery plugin built-in role'
    role.save
  end
end

Version data entries

61 entries across 61 versions & 1 rubygems

Version Path
foreman_discovery-20.0.0 db/seeds.d/90_add_permissions_from_default_roles.rb
foreman_discovery-19.0.1 db/seeds.d/90_add_permissions_from_default_roles.rb
foreman_discovery-19.0.0 db/seeds.d/90_add_permissions_from_default_roles.rb
foreman_discovery-18.0.5 db/seeds.d/90_add_permissions_from_default_roles.rb
foreman_discovery-18.0.4 db/seeds.d/90_add_permissions_from_default_roles.rb
foreman_discovery-18.0.3 db/seeds.d/90_add_permissions_from_default_roles.rb
foreman_discovery-17.0.5 db/seeds.d/90_add_permissions_from_default_roles.rb
foreman_discovery-18.0.2 db/seeds.d/90_add_permissions_from_default_roles.rb
foreman_discovery-17.0.4 db/seeds.d/90_add_permissions_from_default_roles.rb
foreman_discovery-17.0.3 db/seeds.d/90_add_permissions_from_default_roles.rb
foreman_discovery-17.0.2 db/seeds.d/90_add_permissions_from_default_roles.rb
foreman_discovery-18.0.0 db/seeds.d/90_add_permissions_from_default_roles.rb
foreman_discovery-17.0.1 db/seeds.d/90_add_permissions_from_default_roles.rb
foreman_discovery-16.3.6 db/seeds.d/90_add_permissions_from_default_roles.rb
foreman_discovery-17.0.0 db/seeds.d/90_add_permissions_from_default_roles.rb
foreman_discovery-16.3.5 db/seeds.d/90_add_permissions_from_default_roles.rb
foreman_discovery-16.1.4 db/seeds.d/90_add_permissions_from_default_roles.rb
foreman_discovery-16.1.3 db/seeds.d/90_add_permissions_from_default_roles.rb
foreman_discovery-16.3.4 db/seeds.d/90_add_permissions_from_default_roles.rb
foreman_discovery-16.3.1 db/seeds.d/90_add_permissions_from_default_roles.rb