owncloud / owncloud/ocis

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

Open
#5,855 5 comments 0 reactions 1 assignee Claimed by @Excds View on GitHub
Priority:p4-low Type:Bug
Dominant language
Go
Stars
2.1k
Forks
274
Avg merge
2d 1h
Merged PRs (30d)
103

Description

## 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 \
'{
"members@odata.bind": [
"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
```
2. 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": "brian@example.org",
"onPremisesSamAccountName": "Brian",
"surname": "Brian",
"userType": "Member"
}
]
```

## Actual behavior
```
[
{
"accountEnabled": true,
"displayName": "Brian Murphy",
"givenName": "",
"id": "367b7965-b0c2-4ca6-845f-b65910677405",
"mail": "brian@example.org",
"onPremisesSamAccountName": "Brian",
"surname": "Brian",
"userType": "Member"
},
{
"accountEnabled": true,
"displayName": "Brian Murphy",
"givenName": "",
"id": "367b7965-b0c2-4ca6-845f-b65910677405",
"mail": "brian@example.org",
"onPremisesSamAccountName": "Brian",
"surname": "Brian",
"userType": "Member"
}
]
```
### In web

![Screenshot from 2023-03-16 16-26-00](https://user-images.githubusercontent.com/54478846/225593191-d607c0dd-874e-4901-83ff-04ecf0f10a2e.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.