HomePhabricator
Diffusion Comm d8ea1cf4efa9

[native] Introduce `recursivelyUpdatePermissions(ThreadTraversalNode)`

Description

[native] Introduce recursivelyUpdatePermissions(ThreadTraversalNode)

Summary:
We introduce recursivelyUpdatePermissions(ThreadTraversalNode, memberToThreadPermissionsFromParent) which traverses node and all children recursively to update member.permissions.

memberToThreadPermissionsFromParent is a map from userID to permissionsFromParent (?ThreadPermissionsBlob). Each node calculates makePermissionsForChildrenBlob for each member and populates memberToThreadPermissionsFromParent. memberToThreadPermissionsFromParent is then passed in as an argument for recursive call for each child. The child will call makePermissionsBlob with both rolePermissions and permissionsFromParent to compute the aggregate permissions that will be stored in member.permissions.


Depends on D7601

Test Plan:
Ran with correct threadStore from keyserver (devDB) and ensured that it remained the same.

Also removed all member.permissions from threadStore and ensured that recursivelyUpdatePermissions was able to compute all member.permissions "from scratch" (AKA not depending on any existing member.permissions. There are unit tests for this included in the diff.

WARNING: HOWEVER, I did run into some issues when testing against my prod threadStore. I specifically had issues with threadID: 892819 on prod. I might need to sync w/ @ashoat on this one to figure out where the issue is.

Reviewers: ashoat, ginsu

Reviewed By: ashoat

Subscribers: tomek, ashoat

Differential Revision: https://phab.comm.dev/D7602

Details

Provenance
atulAuthored on Apr 25 2023, 12:46 PM
Reviewer
ashoat
Differential Revision
D7602: [native] Introduce `recursivelyUpdatePermissions(ThreadTraversalNode)`
Parents
rCOMM392073bfb3dc: [native] Introduce `recursivelyUpdateRoles(ThreadTraversalNode)`
Branches
Unknown
Tags
Unknown