Project

General

Profile

Bug #18855

Role clone API call fails for roles with some organizations/locations assigned

Added by Tomáš Strachota about 6 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Category:
Users, Roles and Permissions
Target version:
Difficulty:
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:
Red Hat JIRA:

Description

Steps to reproduce:
  1. Create a user role assigned to some organizations and locations
  2. Try to clone the role with either api or hammer

Cloning roles without any taxonomies work fine.

Actual results:
The API call fails on validation of the cloned record:

[ERROR 2017-03-09T14:11:07 API] 422 Unprocessable Entity
[DEBUG 2017-03-09T14:11:07 API] {
    "error" => {
                   "id" => nil,
               "errors" => {
                "locations" => [
                [0] "is invalid" 
            ],
            "organizations" => [
                [0] "is invalid" 
            ]
        },
        "full_messages" => [
            [0] "Locations is invalid",
            [1] "Organizations is invalid" 
        ]
    }
}

In fact the original validation error comes from taxonomies:

you cannot remove organizations that are used by hosts or inherited

Active record hides the message with a generic one for validation errors on associations.

Expected results:
The role should be successfully cloned with all taxonomies set.


Related issues

Related to Foreman - Feature #18317: Clone role from APIClosed2017-01-31

Associated revisions

Revision e620923c (diff)
Added by Ondřej Pražák over 5 years ago

Fixes #18855 - Disable taxonomy validations for roles

Revision 92fc35be (diff)
Added by Ondřej Pražák over 5 years ago

Fixes #18855 - Disable taxonomy validations for roles

(cherry picked from commit e620923c07f987b87f6c06299d961d97c184a9ff)

History

#1 Updated by Tomáš Strachota about 6 years ago

#2 Updated by Marek Hulán about 6 years ago

I remember to see this before, isn't this caused by the fact the original role that you try to clone is already invalid? That was it in my case.

#3 Updated by Marek Hulán about 6 years ago

  • Target version changed from 1.12.1 to 1.12.3

#4 Updated by Marek Hulán almost 6 years ago

  • Target version changed from 1.12.3 to 1.13.0

#5 Updated by Marek Hulán almost 6 years ago

  • Target version changed from 1.13.0 to 1.13.2

#6 Updated by Marek Hulán almost 6 years ago

  • Target version changed from 1.13.2 to 1.13.4

#7 Updated by Tomáš Strachota almost 6 years ago

The role seems to be valid and I'm able to clone it via UI. Api or hammer fails.

#8 Updated by The Foreman Bot almost 6 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/4560 added

#9 Updated by Marek Hulán almost 6 years ago

  • Target version changed from 1.13.4 to 1.14.0

#10 Updated by Marek Hulán almost 6 years ago

  • Bugzilla link set to 1444216

#11 Updated by Marek Hulán over 5 years ago

  • Legacy Backlogs Release (now unused) set to 266

Daniel, I think this would be also good in 1.15.2. It's not regression introduced in 1.15 but since one of areas that 1.15 is focused on is the delegation of administration for organizations, this would hit a lot of users. It's small and safe patch. As always, feel free to reset to 1.16 if you think otherwise.

#12 Updated by Ondřej Pražák over 5 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#13 Updated by Tomer Brisker over 2 years ago

  • Category changed from 218 to Users, Roles and Permissions

Also available in: Atom PDF