oracle / oracle/oci-cli

list-groups and list-users does not but should include group membership OCID

Open
#450 9 comments 9 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

IAM
Dominant language
Python
Stars
669
Forks
236
Avg merge
1m
Merged PRs (30d)
4

Description

Expected result

oci iam group list-users or oci iam user list-groups should include group membership OCIDs in results as it is available in the underlying API call ListUserGroupMemberships

Actual result

oci iam group list-users or oci iam user list-groups does not include group membership OCIDs in results

Rationale

API ListUserGroupMemberships returns group OCID, user OCID, and membership OCID whether provided groupId or userId for input. I expect these commands to also include membership OCIDs

group list-users (is missing group membership OCID)
oci iam group list-users --group-id $GROUP_ID
{
  "data": [
    {
      "capabilities": {
        "can-use-api-keys": false,
        "can-use-auth-tokens": true,
        "can-use-console-password": true,
        "can-use-customer-secret-keys": false,
        "can-use-o-auth2-client-credentials": true,
        "can-use-smtp-credentials": false
      },
      "compartment-id": "ocid1.tenancy.oc1..aaaaaaaac6bgzprtzmhay3mpvkm6h7dspkxgugadnyvxg653y5g2fd3meivq",
      "defined-tags": {
        "Oracle-Tags": {
          "CreatedBy": "oracleidentitycloudservice/someone@example.com",
          "CreatedOn": "2021-08-16T15:53:10.934Z"
        }
      },
      "description": "DBA",
      "email": null,
      "email-verified": false,
      "external-identifier": null,
      "freeform-tags": {},
      "id": "ocid1.user.oc1..aaaaaaaaa4dghxghhzbdosba4ldkiwoo7aqusmpiu3l4h54lp26pbi5hi7wq",
      "identity-provider-id": null,
      "inactive-status": null,
      "is-mfa-activated": false,
      "last-successful-login-time": "2021-08-17T16:37:52.243000+00:00",
      "lifecycle-state": "ACTIVE",
      "name": "someone@example.com",
      "previous-successful-login-time": null,
      "time-created": "2021-08-16T15:53:11.098000+00:00"
    }
  ]
}
user list-groups (is missing group membership OCID)
oci iam user list-groups --user-id $USER_ID
{
  "data": [
    {
      "compartment-id": "ocid1.tenancy.oc1..aaaaaaaac6bgzprtzmhay3mpvkm6h7dspkxgugadnyvxg653y5g2fd3meivq",
      "defined-tags": {
        "Oracle-Tags": {
          "CreatedBy": "oracleidentitycloudservice/someone@example.com",
          "CreatedOn": "2021-08-16T15:53:10.921Z"
        }
      },
      "description": "DBAs",
      "freeform-tags": {},
      "id": "ocid1.group.oc1..aaaaaaaa6sycaw4bomtp6et3fx7goryc2ouxd4ex5xex654apyhknhkeasfq",
      "inactive-status": null,
      "lifecycle-state": "ACTIVE",
      "name": "DBAGroup",
      "time-created": "2021-08-16T15:53:10.965000+00:00"
    }
  ]
}

See output from ListUserGroupMemberships for comparison

ListUserGroupMemberships by group (includes group membership OCID)
oci raw-request --target-uri "https://identity.us-phoenix-1.oraclecloud.com/20160918/userGroupMemberships/?compartmentId=${TENANCY_ID}&groupId=${GROUP_ID}" --http-method GET
{
  "data": [
    {
      "compartmentId": "ocid1.tenancy.oc1..aaaaaaaac6b6hg653y5g2fd3gzprtzmhay3mpv7dspkxgugadnyvxkmmeivq",
      "description": "GRP_MBR:ocid1.group.oc1..aaaaaaaa6sycaw4bomtp6et3fx7goryc2ouxd4ex5xex654apyhknhkeasfq-ocid1.user.oc1..aaaaaaaaa4dghxghhzbdosba4ldkiwoo7aqusmpiu3l4h54lp26pbi5hi7wq",
      "groupId": "ocid1.group.oc1..aaaaaaaa6sycaw4bomtp6et3fx7goryc2ouxd4ex5xex654apyhknhkeasfq",
      "id": "ocid1.groupmembership.oc1..aaaz7dmjal2eufaaaa6366lcpbzjxv3uvykyizrbalqixdabpygpf5ed2ija",
      "lifecycleState": "ACTIVE",
      "timeCreated": "2021-08-17T17:33:35.437Z",
      "userId": "ocid1.user.oc1..aaaaaaaaa4dghxghhzbdosba4ldkiwoo7aqusmpiu3l4h54lp26pbi5hi7wq"
    }
  ],
  "headers": {
    "Cache-Control": "no-cache, no-store, must-revalidate",
    "Content-Length": "1239",
    "Content-Type": "application/json",
    "Date": "Fri, 10 Sep 2021 13:39:54 GMT",
    "Pragma": "no-cache",
    "X-Content-Type-Options": "nosniff",
    "opc-limit": "100",
    "opc-request-id": "8C4A4DF558A0DA60B8B564C/CCCE5F64BB0643A/DDE74ED0E8E86AA104F688B06A2FDE055007156484CF4198E305071119"
  },
  "status": "200 OK"
}
ListUserGroupMemberships by user (includes group membership OCID)
oci raw-request --target-uri "https://identity.us-phoenix-1.oraclecloud.com/20160918/userGroupMemberships/?compartmentId=${TENANCY_ID}&groupId=${GROUP_ID}" --http-method GET
{
  "data": [
    {
      "compartmentId": "ocid1.tenancy.oc1..aaaaaaaac6b6hg653y5g2fd3gzprtzmhay3mpv7dspkxgugadnyvxkmmeivq",
      "description": "GRP_MBR:ocid1.group.oc1..aaaaaaaa6sycaw4bomtp6et3fx7goryc2ouxd4ex5xex654apyhknhkeasfq-ocid1.user.oc1..aaaaaaaaa4dghxghhzbdosba4ldkiwoo7aqusmpiu3l4h54lp26pbi5hi7wq",
      "groupId": "ocid1.group.oc1..aaaaaaaa6sycaw4bomtp6et3fx7goryc2ouxd4ex5xex654apyhknhkeasfq",
      "id": "ocid1.groupmembership.oc1..aaaz7dmjal2eufaaaa6366lcpbzjxv3uvykyizrbalqixdabpygpf5ed2ija",
      "lifecycleState": "ACTIVE",
      "timeCreated": "2021-08-17T17:33:35.437Z",
      "userId": "ocid1.user.oc1..aaaaaaaaa4dghxghhzbdosba4ldkiwoo7aqusmpiu3l4h54lp26pbi5hi7wq"
    }
  ],
  "headers": {
    "Cache-Control": "no-cache, no-store, must-revalidate",
    "Content-Length": "1239",
    "Content-Type": "application/json",
    "Date": "Fri, 10 Sep 2021 13:39:54 GMT",
    "Pragma": "no-cache",
    "X-Content-Type-Options": "nosniff",
    "opc-limit": "100",
    "opc-request-id": "8C4A4DF558104F688B06A2A04564DDE74ED0E8E8C/CCCE5F60071564BB0643A/6AAFDE055DA60B8B84CF4198E305071119"
  },
  "status": "200 OK"
}

References

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the implementations of oci iam group list-users and oci iam user list-groups, then compare their result mapping with the ListUserGroupMemberships API documented in the issue. Done means both commands expose the group membership OCID in their results, consistently with the API response.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.