Uploaded image for project: 'Hybrid Cloud Console'
  1. Hybrid Cloud Console
  2. RHCLOUD-25689

Fix count of groups for admin and platform roles

XMLWordPrintable

    • False
    • Hide

      None

      Show
      None
    • False
    • None
    • Unset
    • No
    • Platform A&M Sprint 71, Platform A&M Sprint 72, Platform A&M Sprint 73, Platform A&M Sprint 74

      With this PR we have roles which has platform_default and admin_default set to true.

      This causes that role API request with groups_in_count parameter displays improper count:

       

      /api/rbac/v1/roles/?limit=50&offset=0&display_name=Inventory Hosts Administrator&scope=account&order_by=display_name&add_fields=groups_in_count%2Cgroups_in%2Caccess

       

      Response:

       

      {
        "meta": {
          "count": 1,
          "limit": 50,
          "offset": 0
        },
        "links": {
          "first": "/api/rbac/v1/roles/?add_fields=groups_in_count%2Cgroups_in%2Caccess&display_name=Inventory+Hosts+Administrator&limit=50&offset=0&order_by=display_name&scope=account",
          "next": null,
          "previous": null,
          "last": "/api/rbac/v1/roles/?add_fields=groups_in_count%2Cgroups_in%2Caccess&display_name=Inventory+Hosts+Administrator&limit=50&offset=0&order_by=display_name&scope=account"
        },
        "data": [
          {
            "uuid": "036068ac-5e2e-4c52-9590-d5e635822628",
            "name": "Inventory Hosts Administrator",
            "display_name": "Inventory Hosts Administrator",
            "description": "Be able to read and edit Inventory Hosts data.",
            "created": "2023-05-03T07:30:54.448088Z",
            "modified": "2023-05-03T07:30:54.448212Z",
            "policyCount": 2,
            "groups_in": [
              {
                "name": "Default access",
                "uuid": "e2085cea-3538-4ceb-8fa4-149f48ec515c",
                "description": "This group contains the roles that all users inherit by default. Adding or removing roles in this group will affect permissions for all users in your organization."
              }
            ],
            "groups_in_count": 1,  <!--- Issue
            "accessCount": 2,
            "access": [
              {
                "resourceDefinitions": [],
                "permission": "inventory:hosts:write"
              },
              {
                "resourceDefinitions": [],
                "permission": "inventory:hosts:read"
              }
            ],
            "applications": [
              "inventory"
            ],
            "system": true,
            "platform_default": true,
            "admin_default": true,
            "external_role_id": null,
            "external_tenant": null
          }
        ]
      } 

       

       

      groups_in_count should be 2 because Inventory Hosts Administrator role is part of two groups: Default admin access and admin access.

       

       

       

        1. image (4).png
          68 kB
          Insights QA
        2. image (5).png
          37 kB
          Insights QA

              sdonahue@redhat.com Shannon Donahue
              lpichler@redhat.com Libor Pichler
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: