Skip to content

Conversation

@stnguyen90
Copy link
Contributor

@stnguyen90 stnguyen90 commented Jul 12, 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?

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.
@stnguyen90 stnguyen90 changed the base branch from master to 1.3.x July 12, 2023 18:22
1. Remove the userInternalId attribute
2. Replace userId in audit documents with userInternalId and put
userId in data
@stnguyen90 stnguyen90 force-pushed the fix-audit-userInternalId branch from 1bc3deb to 26334b7 Compare July 12, 2023 21:37
@stnguyen90 stnguyen90 marked this pull request as ready for review July 12, 2023 21:40
@stnguyen90
Copy link
Contributor Author

@TorstenDittmann would you please look at this when you get a chance?

@stnguyen90
Copy link
Contributor Author

This has a merge conflict because it's based on 1.3.7 rather than 1.3.x. 1.3.8 has been released based branch fix-audit-userInternalId. This won't be merged into 1.3.x. Instead, #5847 has been created to update master for the future.

@stnguyen90 stnguyen90 closed this Jul 20, 2023
@stnguyen90 stnguyen90 mentioned this pull request Jul 20, 2023
2 tasks
@stnguyen90 stnguyen90 deleted the fix-audit-userInternalId branch September 10, 2023 16:34
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

4 participants