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

Fix audit user internal #5853

Merged
merged 6 commits into from
Jul 20, 2023
Merged

Fix audit user internal #5853

merged 6 commits into from
Jul 20, 2023

Conversation

stnguyen90
Copy link
Contributor

@stnguyen90 stnguyen90 commented Jul 20, 2023

What does this PR do?

In 1.3.x, the audit activity stopped working for existing projects because there was a userInternalId attribute added to the audit collections, but there was no migration to add the attribute.

In later versions of the audit library, we removed the userInternalId attribute, so this PR bumps Appwrite to use that version. In addition, this PR also updates Appwrite to user the userInternalId for the audit userId so that if a user is recreated with the same ID, the audit data for the previous user isn't linked to the new user.

Fixes: #5805

Test Plan

E2E Tests

Passed locally:

image

Manual Tests

Successful Migration

image

Audit Activity Created After Migration

image

Related PRs and Issues

Checklist

  • Have you read the Contributing Guidelines on issues?
  • If the PR includes a change to an API's metadata (desc, label, params, etc.), does it also include updated API specs and example docs?

stnguyen90 and others added 6 commits July 19, 2023 22:49
It's important to use userInternalId so that if a user is recreated
with the same ID, lookups for the user will not return the data
of the old deleted user.

We will still store userId in data so that it can be pulled out and
returned for the log API calls.
The audit userId is actually the internal id and the user id is in the
data attribute.
The userId in audit is actually the userInternalId.
1. Remove the userInternalId attribute
2. Replace userId in audit documents with userInternalId and put
userId in data
@stnguyen90 stnguyen90 marked this pull request as ready for review July 20, 2023 07:29
@eldadfux eldadfux merged commit e12a573 into master Jul 20, 2023
4 checks passed
@stnguyen90 stnguyen90 deleted the fix-audit-user-internal-id branch July 20, 2023 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 Bug Report: Empty activity data in Console
2 participants