Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

caching error: after adding/deleting groups, calling instant getUser, the groups are not updated in the memberOf field #5474

Closed
AlexAndBear opened this issue Jan 30, 2023 · 6 comments · Fixed by owncloud/web#8418
Labels

Comments

@AlexAndBear
Copy link
Contributor

Describe the bug

A clear and concise description of what the bug is.

Steps to reproduce

Steps to reproduce the behavior:

  1. add group 'alice and friends' via graphAPI
  2. assign the group 'alice and friends' to user 'alice' in the graphAPI
  3. call instant getUser($expand=memberOf) on user 'alice', memberOf might not contain the group 'alice and friends'

Expected behavior

A clear and concise description of what you expected to happen.

Actual behavior

A clear and concise description of what happened.

Setup

Please describe how you started the server and provide a list of relevant environment variables or configuration files.

OCIS_XXX=somevalue
OCIS_YYY=somevalue
PROXY_XXX=somevalue

Additional context

Add any other context about the problem here.

@ScharfViktor
Copy link
Contributor

I added test for that, but it passed.

  • admin creates user: curl -X POST 'https://localhost:9200/graph/v1.0/users' -uadmin:admin -d '{"onPremisesSamAccountName":"Alice","displayName":"Alice Hansen","mail":"[email protected]","passwordProfile":{"password":"123456"}}' -vk

  • admin creates group curl -X POST 'https://localhost:9200/graph/v1.0/groups' -uadmin:admin -d '{"displayName":"alice and friends"}' -vk

  • admin adds alice to to group: curl -X POST 'https://localhost:9200/graph/v1.0/groups/groupId/members/$ref' -uadmin:admin -d '{"@odata.id":"https://localhost:9200/graph/v1.0/users/userId"}' -vk

  • admin gets alice info curl -X GET 'https://localhost:9200/graph/v1.0/users/2569c4ad-4abc-4f40-9490-5db0b66dcedc?%24expand=memberOf' -uadmin:admin -vk

result: memberOf contains info about group{"displayName":"Alice Hansen","givenName":"","id":"2569c4ad-4abc-4f40-9490-5db0b66dcedc","mail":"[email protected]","memberOf":[{"displayName":"alice and friends","id":"528738e1-6d0e-4e16-a124-dad822213428"}],"onPremisesSamAccountName":"Alice","surname":"Alice"}

@AlexAndBear
Copy link
Contributor Author

AlexAndBear commented Jan 30, 2023

This is, how it goes on my system:

Request URL: https://host.docker.internal:9201/graph/v1.0/groups/509a9dcd-bb37-4f4f-a01a-19dca27d9cfa/members/932b4540-8d16-481e-8ef4-588e4b6b151c/$ref
Request Method: DELETE
Status Code: 204 No Content

Request URL: https://host.docker.internal:9201/graph/v1.0/users/932b4540-8d16-481e-8ef4-588e4b6b151c?%24select=&%24expand=drive%2CmemberOf%2CappRoleAssignments
Request Method: GET
Status Code: 200 OK
{"appRoleAssignments":[{"appRoleId":"d7beeea8-8ff4-406b-8fb6-ab2dd81e6b11","id":"dcac5119-add9-4f48-b76e-7968cc8260a8","principalId":"932b4540-8d16-481e-8ef4-588e4b6b151c","principalType":"User","resourceDisplayName":"ownCloud Infinite Scale","resourceId":"some-graph-app-id"},{"appRoleId":"d7beeea8-8ff4-406b-8fb6-ab2dd81e6b11","id":"bfc67fe4-ea80-4ac1-a794-a815d1646e72","principalId":"932b4540-8d16-481e-8ef4-588e4b6b151c","principalType":"User","resourceDisplayName":"ownCloud Infinite Scale","resourceId":"some-graph-app-id"},{"appRoleId":"d7beeea8-8ff4-406b-8fb6-ab2dd81e6b11","id":"24c99fb6-a33a-41d5-88bd-b61f23521095","principalId":"932b4540-8d16-481e-8ef4-588e4b6b151c","principalType":"User","resourceDisplayName":"ownCloud Infinite Scale","resourceId":"some-graph-app-id"},{"appRoleId":"d7beeea8-8ff4-406b-8fb6-ab2dd81e6b11","id":"433f8e91-5cd5-411b-b45f-f4d0a49aeb29","principalId":"932b4540-8d16-481e-8ef4-588e4b6b151c","principalType":"User","resourceDisplayName":"ownCloud Infinite Scale","resourceId":"some-graph-app-id"}],"displayName":"Richard Phillips Feynman","givenName":"Richard","id":"932b4540-8d16-481e-8ef4-588e4b6b151c","mail":"[email protected]","memberOf":[{"displayName":"users","id":"509a9dcd-bb37-4f4f-a01a-19dca27d9cfa"},{"displayName":"violin-haters","id":"dd58e5ec-842e-498b-8800-61f2ec6f911f"},{"displayName":"polonium-lovers","id":"cedc21aa-4072-4614-8676-fa9165f598ff"},{"displayName":"quantum-lovers","id":"a1726108-01f8-4c30-88df-2b1a9d1cba1a"},{"displayName":"philosophy-haters","id":"167cbee2-0518-455a-bfb2-031fe0621e5d"},{"displayName":"physics-lovers","id":"262982c1-2362-4afa-bfdf-8cbfef64a06e"}],"onPremisesSamAccountName":"richard","surname":"Feynman"}

@ScharfViktor
Copy link
Contributor

Yes, I can confirm. The memberOf section is not updated all the time, only after the page reloads

@rhafer
Copy link
Contributor

rhafer commented Feb 8, 2023

This is strange. The /graph/users and /graph/groups endpoints don't do any caching currently. So it can't be a caching issue.

@rhafer
Copy link
Contributor

rhafer commented Feb 8, 2023

@janackermann I am not able to reproduce this using curl. But I can see the broken behavior using the UI. Though to me it looks that the GET request is issued before the response of the DELETE request is received. So there seems to be a race condition between the two requests. And sometime the GET request completes before the DELETE request finishes. At least this what the server logs seem to indicate. (The timings in the Web console also suggest that both request are executed in parallel)

@AlexAndBear
Copy link
Contributor Author

checked that, we are using await async. But I will double check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants