Project

General

Profile

Actions

Bug #33678

closed

Import/Export Permission Upgrade task not deleting duplicate entries

Added by Partha Aji about 3 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
Difficulty:
Triaged:
Yes
Fixed in Releases:
Found in Releases:

Description

https://github.com/Katello/katello/pull/9354 as a part of issue https://projects.theforeman.org/issues/32396 renamed export_library_content and export_content_views permission to export_content.

As a part of that PR is this command.
bundle exec rake katello:upgrades:4.1:update_content_import_export_perms

This command renames export_library_content to export_content correctly but keeps the old export_content permission also intact in the filter causing duplicate values in the filter.
To reproduce either
  • In a 3.18 machine, create a role that has the following filters on resource `organization` => `import_library_content, export_library_content, import_content, export_content`
  • Upgrade to the latest
  • Do a `hammer filter list` and look at the permissions of the last row
    Expected
    import_content, export_content

Actual:
import_content, import_content, export_content, export_content

Alternatively you can reproduce this in the development environment via the rake console
  • Add the following permissions
    ```
    [11] pry(main)> Permission.create(name: :import_library_content, resource_type: 'Organization')
    => #<Permission:0x0000000013477af8 id: 227, name: "import_library_content", resource_type: "Organization", created_at: Mon, 11 Oct 2021 18:13:42 UTC +00:00, updated_at: Mon, 11 Oct 2021 18:13:42 UTC +00:00>
    [12] pry(main)> Permission.create(name: :export_library_content, resource_type: 'Organization')
    => #<Permission:0x0000000018edbe18 id: 228, name: "export_library_content", resource_type: "Organization", created_at: Mon, 11 Oct 2021 18:13:51 UTC +00:00, updated_at: Mon, 11 Oct 2021 18:13:51 UTC +00:00>
    ```
  • Create a role with permissions on resource `organization` => `import_library_content, export_library_content, import_content, export_content`
  • `bundle exec rake katello:upgrades:4.1:update_content_import_export_perms`
  • Do a `hammer filter list` and look at the permissions of the last row
    Expected
    import_content, export_content

Actual:
import_content, import_content, export_content, export_content

Actions

Also available in: Atom PDF