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-25.0.0 db/seeds.d/90_add_permissions_from_default_roles.rb
foreman_discovery-24.0.2 db/seeds.d/90_add_permissions_from_default_roles.rb
foreman_discovery-23.0.2 db/seeds.d/90_add_permissions_from_default_roles.rb
foreman_discovery-24.0.1 db/seeds.d/90_add_permissions_from_default_roles.rb
foreman_discovery-24.0.0 db/seeds.d/90_add_permissions_from_default_roles.rb
foreman_discovery-23.0.1 db/seeds.d/90_add_permissions_from_default_roles.rb
foreman_discovery-23.0.0 db/seeds.d/90_add_permissions_from_default_roles.rb
foreman_discovery-22.0.4 db/seeds.d/90_add_permissions_from_default_roles.rb
foreman_discovery-21.0.5 db/seeds.d/90_add_permissions_from_default_roles.rb
foreman_discovery-22.0.2 db/seeds.d/90_add_permissions_from_default_roles.rb
foreman_discovery-21.0.4 db/seeds.d/90_add_permissions_from_default_roles.rb
foreman_discovery-21.0.3 db/seeds.d/90_add_permissions_from_default_roles.rb
foreman_discovery-21.0.2 db/seeds.d/90_add_permissions_from_default_roles.rb
foreman_discovery-19.0.5 db/seeds.d/90_add_permissions_from_default_roles.rb
foreman_discovery-19.0.4 db/seeds.d/90_add_permissions_from_default_roles.rb
foreman_discovery-21.0.1 db/seeds.d/90_add_permissions_from_default_roles.rb
foreman_discovery-19.0.3 db/seeds.d/90_add_permissions_from_default_roles.rb
foreman_discovery-21.0.0 db/seeds.d/90_add_permissions_from_default_roles.rb
foreman_discovery-19.0.2 db/seeds.d/90_add_permissions_from_default_roles.rb
foreman_discovery-20.0.1 db/seeds.d/90_add_permissions_from_default_roles.rb