Page MenuHomePhabricator

[lib] Add a migration that adds new permissions
AcceptedPublic

Authored by tomek on Wed, Mar 19, 7:52 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Mar 29, 10:29 AM
Unknown Object (File)
Fri, Mar 28, 8:45 PM
Unknown Object (File)
Thu, Mar 27, 8:53 PM
Unknown Object (File)
Wed, Mar 26, 7:46 PM
Unknown Object (File)
Wed, Mar 26, 2:44 PM
Unknown Object (File)
Wed, Mar 26, 10:21 AM
Unknown Object (File)
Wed, Mar 26, 7:00 AM
Unknown Object (File)
Wed, Mar 26, 4:47 AM
Subscribers
None

Details

Reviewers
kamil
ashoat
Summary

All the admins should have both new permissions. All the members should have only DELETE_OWN_MESSAGES permission.

https://linear.app/comm/issue/ENG-10323/add-keyserver-migrations

Depends on D14462

Test Plan

Run the migrations and checked if the permissions were updated in the DB. Also modified roles in the UI and made sure the DB was updated.

Diff Detail

Repository
rCOMM Comm
Branch
delete-messages
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

tomek requested review of this revision.Wed, Mar 19, 8:10 AM
ashoat added inline comments.
keyserver/src/database/migration-config.js
994–995

It looks like this migration was initially added for a special situation, where we had accidentally removed a permission. I guess that adding a new permission from scratch requires the same stuff as fixing an accidentally removed permission?

keyserver/src/fetchers/thread-fetchers.js
337–338

If we land this with NEXT_CODE_VERSION, we need to make sure that we land a client migration at the same time. Otherwise you can consider switching to FUTURE_CODE_VERSION

lib/shared/thread-utils.js
836–841

Does the threadPermissionMembershipPrefixes.MEMBER prefix get stripped before we get there?

This revision is now accepted and ready to land.Wed, Mar 19, 9:52 AM

Updated permissions filtering logic

keyserver/src/database/migration-config.js
994–995

Yes, exactly

keyserver/src/fetchers/thread-fetchers.js
337–338

The client migrations are introduced in the next diff, and I'm going to make sure both diffs land simultaneously.

lib/shared/thread-utils.js
836–841

After my testing in the next diff I realized that it wasn't stripped. Updated the approach to filter out all the permissions based on the suffix which should work regardless of the prefixes.