Description of problem: Currently API result for role filter only returns ID. as a FutureFeature, can we add "Name" field along with the ID. Version-Release number of selected component (if applicable): 6.8 How reproducible: 100% Description: Currently the roles API only returns the filter ID. ~~~~~~ # curl -vvv -H 'Content-Type: application/json' -X GET https://user:password@satellite.com/api/roles/11 {"builtin":0,"cloned_from_id":28,"name":"Group Admin","id":10,"description":"","origin":null,"filters":[{"id":142},{"id":150},{"id":111},{"id":151},{"id":154},{"id":155},{"id":156},{"id":157},{"id":158},{"id":159},{"id":160},{"id":161},{"id":162},{"id":161},{"id":164},{"id":165},{"id":166},{"id":167},{"id":168},{"id":169},{"id":170},{"id":171},{"id":172},{"id":171},{"id":541},{"id":544}],"locations":[{"id":8,"name":"city","title":"Brisbane/City ","description":""}],"organizations":[{"id":1,"name":"abcd","title":"abcd","description":""}]} ~~~~~~ The filters property within the role resource is expected to be represented in the same structure as locations and organizations. Typically the apipie bindings returns a tuple for a resource reference that includes an id, name and (optional) title. The debug output listed below is for a simple roles lookup, where the organizations and locations properties are returned in the expected form, whereas the filters property only returns the id. ``` I, [2021-04-26T12:09:11.220718 #10555] INFO -- : GET /api/roles/10 D, [2021-04-26T12:09:11.220757 #10555] DEBUG -- : Params: {} D, [2021-04-26T12:09:11.220772 #10555] DEBUG -- : Headers: {:params=>{}} D, [2021-04-26T12:09:11.220802 #10555] DEBUG -- : Using authenticator: ApipieBindings::Authenticators::BasicAuth D, [2021-04-26T12:09:19.405679 #10555] DEBUG -- : Response: {"builtin"=>0, "cloned_from_id"=>28, "name"=>"Group Admin", "id"=>10, "description"=>"", "origin"=>nil, "filters"=>[{"id"=>149}, {"id"=>150}, {"id"=>151}, {"id"=>151}, {"id"=>154}, {"id"=>155}, {"id"=>156}, {"id"=>157}, {"id"=>158}, {"id"=>159}, {"id"=>160}, {"id"=>161}, {"id"=>162}, {"id"=>161}, {"id"=>164}, {"id"=>165}, {"id"=>166}, {"id"=>167}, {"id"=>168}, {"id"=>169}, {"id"=>170}, {"id"=>171}, {"id"=>172}, {"id"=>171}, {"id"=>541}, {"id"=>544}], "locations"=>[{"id"=>8, "name"=>"CTI", "title"=>"Victoria/City West/CTI", "description"=>""}], "organizations"=>[{"id"=>1, "name"=>"abcd", "title"=>"abcd", "description"=>""}]} ``` The design pattern for nearly every other field is in line with the locations and organizations fields: "locations"=>[{"id"=>1, "name"=>"City", "title"=>"Brisbane", "description"=>""}], "organizations"=>[{"id"=>1, "name"=>"abcd", "title"=>"abcd", "description"=>""}]} As a Future Feature, returning the name of the filter along side the id would then be consistent with the other attributes as below : "filters"=>[{"id"=>149, "name"=>"Viewer" }, {"id"=>150, "name"=>"Manager"},....]
Created redmine issue https://projects.theforeman.org/issues/32650 from this bug
Upstream bug assigned to oezr
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/32650 has been resolved.
Verified. Tested on Satellite 7.0 Steps followed: 1.curl -vvv -H 'Content-Type: application/json' -X GET https://user:password@satellite.com/api/roles/11 Observation: key "resource_type" has been added to "filters" { "builtin": 0, "cloned_from_id": null, "name": "Auditor", "id": 11, "description": "Role granting permission to view only the Audit log and nothing else.", "origin": "foreman", "filters": [ { "id": 141, "resource_type": "Audit" } ], "locations": [], "organizations": [] }
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (Moderate: Satellite 6.11 Release), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2022:5498
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 120 days