feat: add page permissions#36
Draft
BatLeDev wants to merge 21 commits into
Draft
Conversation
…s on existing pages
- Use { $in: ['read'] } in buildPageAccessFilter for consistency with portal utils
- Fix userFilter type to { $or: Record<string, any>[] }
- Remove incorrect default: true on public field in page schema
# Conflicts: # api/src/pages/router.ts # api/src/pages/service.ts # package-lock.json # ui/package.json
The @data-fair/types-portals workspace package was missing from the final manager image, causing ERR_MODULE_NOT_FOUND in production.
b1061e0 to
ff0d6ba
Compare
dccb53a to
2737dde
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds fine-grained access control to pages, along with technical fixes.
Page permissions
Each page now has a
publicboolean flag and apermissionsarray that can grantreadand/orwriteaccess to specific users, organization members, departments, or roles.access-reffrom@data-fair/lib:matchAccessRefandmongoFilterAccessRefare imported from the shared lib for in-memory access checks and MongoDB filteringapi/src/pages/): helpers inoperations.ts(canReadPage,canWritePage,getUserPermissions,buildPageAccessFilter,buildDefaultPermissions), newPATCH /pages/:type/:slug/permissionsendpoint, all read endpoints now enforce permission checksportal/server/utils/page-permissions.ts):checkPageAccessandbuildPortalPagePermissionQueryfor Nuxt server routespage-edit-permissions.vuecomponent integrated into the publication panel,use-page-store.tsexposespatchPageupgrade/2.20.0/add-page-permissions.ts): backfillspublic: trueandpermissions: []on all existing pagesTechnical fixes
nuxt buildto work around esbuild zombie processestypes-portalsto the Docker manager image to resolve a runtime import errorindex.get.tsandindex.head.ts