Sha256: fb9d846a352ae4871e31d7c05f9e35ea229bd00c43a55fc2332bc72418a12116

Contents?: true

Size: 653 Bytes

Versions: 20

Compression:

Stored size: 653 Bytes

Contents

class RemoveOldPermissions < ActiveRecord::Migration
  def up
    # remove invalid permissions causing http://projects.theforeman.org/issues/9963
    perms = Permission.where("name like '%_discovered_hosts' and resource_type is null").destroy_all
    say "Removed invalid permissions: #{perms.inspect}" if perms.size > 0

    # unassociate and remove unused role "Discovery" (renamed to "Discovery Manager")
    if old_role = Role.where(:name => "Discovery").first
      UserRole.where(:role_id => old_role.id).destroy_all
      say "Role 'Discovery' was removed, use 'Discovery Manager' instead" if old_role.destroy
    end
  end

  def down
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
foreman_discovery-9.1.5 db/migrate/20150331132115_remove_old_permissions.rb
foreman_discovery-9.1.4 db/migrate/20150331132115_remove_old_permissions.rb
foreman_discovery-10.0.0 db/migrate/20150331132115_remove_old_permissions.rb
foreman_discovery-9.1.3 db/migrate/20150331132115_remove_old_permissions.rb
foreman_discovery-9.1.2 db/migrate/20150331132115_remove_old_permissions.rb
foreman_discovery-9.1.1 db/migrate/20150331132115_remove_old_permissions.rb
foreman_discovery-9.1.0 db/migrate/20150331132115_remove_old_permissions.rb
foreman_discovery-9.0.0 db/migrate/20150331132115_remove_old_permissions.rb
foreman_discovery-8.0.1 db/migrate/20150331132115_remove_old_permissions.rb
foreman_discovery-8.0.0 db/migrate/20150331132115_remove_old_permissions.rb
foreman_discovery-7.0.1 db/migrate/20150331132115_remove_old_permissions.rb
foreman_discovery-7.0.0 db/migrate/20150331132115_remove_old_permissions.rb
foreman_discovery-6.0.0 db/migrate/20150331132115_remove_old_permissions.rb
foreman_discovery-5.0.2 db/migrate/20150331132115_remove_old_permissions.rb
foreman_discovery-5.0.1 db/migrate/20150331132115_remove_old_permissions.rb
foreman_discovery-5.0.0 db/migrate/20150331132115_remove_old_permissions.rb
foreman_discovery-4.1.2 db/migrate/20150331132115_remove_old_permissions.rb
foreman_discovery-4.1.1 db/migrate/20150331132115_remove_old_permissions.rb
foreman_discovery-4.1.0 db/migrate/20150331132115_remove_old_permissions.rb
foreman_discovery-4.0.0 db/migrate/20150331132115_remove_old_permissions.rb