Skip to content

Adding the same user as multiple members in a single request results in listing the same user twice in the group #5855

Open

Description

@amrita-shrestha

Describe the bug

After adding the same user twice to a group in a single request. If we request to list group member then same user listed twice

Steps to reproduce

Steps to reproduce the behavior:

  1. admin adds the following users to a group "grp1" at once using the Graph API
    | username |
    | Brian |
    | Brian |
curl -k --header "Content-Type: application/json" \
        --request PATCH  --data \
	'{
    "[email protected]": [
        "https://localhost:9200/graph/v1.0/users/4c510ada-c86b-4815-8820-42cdf82c3d51",
	"https://localhost:9200/graph/v1.0/users/4c510ada-c86b-4815-8820-42cdf82c3d51"
    ]
}' \
	'https://localhost:9200/graph/v1.0/groups/7a20f238-8a22-4458-902d-47674c317e5f' -u user:password
  1. list the group member of grp1
curl -XGET 'https://localhost:9200/graph/v1.0/groups/67e5d9a7-ce63-4a76-b7f1-06443697bf98/members'

Expected behavior

user Brian should be added once to a group
[
    {
        "accountEnabled": true,
        "displayName": "Brian Murphy",
        "givenName": "",
        "id": "367b7965-b0c2-4ca6-845f-b65910677405",
        "mail": "[email protected]",
        "onPremisesSamAccountName": "Brian",
        "surname": "Brian",
        "userType": "Member"
    }
]

Actual behavior

[
    {
        "accountEnabled": true,
        "displayName": "Brian Murphy",
        "givenName": "",
        "id": "367b7965-b0c2-4ca6-845f-b65910677405",
        "mail": "[email protected]",
        "onPremisesSamAccountName": "Brian",
        "surname": "Brian",
        "userType": "Member"
    },
    {
        "accountEnabled": true,
        "displayName": "Brian Murphy",
        "givenName": "",
        "id": "367b7965-b0c2-4ca6-845f-b65910677405",
        "mail": "[email protected]",
        "onPremisesSamAccountName": "Brian",
        "surname": "Brian",
        "userType": "Member"
    }
]

In web

Screenshot from 2023-03-16 16-26-00

Activity

  1. self-assigned this
    on Mar 21, 2023
  2. Excds commented on Mar 21, 2023

    @Excds

    Did a bit of testing around this, and the only way I could have a similar problem was with doing a PATCH request on the group with the members. I did not get the same problem as you did. I am running with an openldap backend and that actually returns an error because of the ldap modify request it is given, and that having duplicates. So this bug is actually in the idm and that it allows such a request.

    Since the idm is currently of lower priority, I've added the "low priority bug" label.

  3. amrita-shrestha commented on Mar 21, 2023

    @amrita-shrestha
    ContributorAuthor

    @Excds SORRY i added the wrong method its PATCH method

  4. rhafer commented on Mar 21, 2023

    @rhafer
    Contributor

    @amrita-shrestha The URL is also wrong. It should be 'https://localhost:9200/graph/v1.0/groups/7a20f238-8a22-4458-902d-47674c317e5f` (without the /member/$ref).

    @Excds is still right though. This is a bug in the idm service which does not happen when using a proper LDAP service.

  5. amrita-shrestha commented on Mar 30, 2023

    @amrita-shrestha
    ContributorAuthor

    @rhafer in my view this issue has not been resolved
    still HTTP status code 204 and get the user listed twice in a group

  6. rhafer commented on Mar 30, 2023

    @rhafer
    Contributor

    @amrita-shrestha Yes the issue is still there (it was githubs magic being overly optimistic closing this bug as it was mentioned as "partially fixed"in the PR 😢 ). Sorry, I didn't notice that.

    That being said. We need to fix this in libregraph/idm. But that is still of somewhat lower priority.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions