Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1967319 - The /api/usergroups/:usergroup_id/external_usergroups API is not accepting 1-group as the name of usergroup
Summary: The /api/usergroups/:usergroup_id/external_usergroups API is not accepting 1-...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Users & Roles
Version: 6.9.0
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: 6.11.0
Assignee: Tomer Brisker
QA Contact: sganar
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-06-02 20:59 UTC by Sayan Das
Modified: 2022-07-05 14:29 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-07-05 14:28:57 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 32704 0 Normal New The /api/usergroups/:usergroup_id/external_usergroups API is not accepting 1-group as the name of usergroup 2021-06-03 09:11:29 UTC
Red Hat Product Errata RHSA-2022:5498 0 None None None 2022-07-05 14:29:18 UTC

Description Sayan Das 2021-06-02 20:59:49 UTC
Description of problem:

The redhat.satellite.external_usergroup calls this API --> GET /api/usergroups/:usergroup_id/external_usergroups 

As per the satellite apidoc the :usergroup_id , should be a string 

But if I decide to use a satellite usergroup name e.g "1-group" , it fails whereas "1 group" works fine.

So the hyphen (-) is creating some sort of issue here.


Version-Release number of selected component (if applicable):

Satellite 6.9


How reproducible:

Always


Steps to Reproduce:
1. Build a Satellite 6.9

2. Create a usergroup by name "1-group"

3. Run following API --> curl -ku admin:RedHat1! "https://satellite.example.com/api/v2/usergroups/1-group/external_usergroups/" 

4. Modify the usergroup name from "1-group" to "1 group"

5. Run following API --> curl -ku admin:RedHat1! "https://satellite.example.com/api/v2/usergroups/1%20group/external_usergroups/" 


Actual results:

Step 3 error:
~~
{
  "error": {"message":"Resource external_usergroup not found by id ''"}
}

~~


Step 5 success:
~~
{
  "total": 0,
  "subtotal": 0,
  "page": 1,
  "per_page": 20,
  "search": null,
  "sort": {
    "by": null,
    "order": null
  },
  "results": []
}
~~


Expected results:

Step 3 should be successful as well.


Additional info:

This affects the working of redhat.satellite.external_usergroup module if customer decided to map an AD group to Satellite usergroup by name "043-enterprise systems"

Comment 2 Tomer Brisker 2021-06-03 09:11:27 UTC
Created redmine issue https://projects.theforeman.org/issues/32704 from this bug

Comment 3 Tomer Brisker 2021-06-06 16:10:47 UTC
A workaround until this is fixed properly is to use the usergroup ID instead of its name in the api call, e.g. (assuming for example that the usergroups has id 5) `/api/usergroups/5/external_usergroups` or `/api/usergroups/5-043-enterprise systems/external_usergroups` instead of `/api/usergroups/043-enterprise systems/external_usergroups`. The root cause is that one of the functions incorrectly assumes that the number at the start of the usergroup name indicates its ID and tries (and fails) to find a usergroup with that ID.

Comment 4 Bryan Kearney 2021-06-06 20:04:59 UTC
Upstream bug assigned to tbrisker

Comment 5 Bryan Kearney 2021-06-06 20:05:01 UTC
Upstream bug assigned to tbrisker

Comment 6 Bryan Kearney 2021-06-08 16:05:20 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/32704 has been resolved.

Comment 11 errata-xmlrpc 2022-07-05 14:28:57 UTC
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


Note You need to log in before you can comment on or make changes to this bug.