Skip to content

Demos 1741 Row-level Permissions#1054

Closed
connor-parke-icf wants to merge 18 commits intomainfrom
DEMOS-1741_amendments
Closed

Demos 1741 Row-level Permissions#1054
connor-parke-icf wants to merge 18 commits intomainfrom
DEMOS-1741_amendments

Conversation

@connor-parke-icf
Copy link
Copy Markdown
Contributor

This PR sets up the infrustructure for the incoming refactors required for the row-based permission system. Main idea here is to create a data access layer for each type such that permissions can be consistently managed and applied. For this, auth.util.js was modified to inject the user's permissions into the context, and a buildAuthorizationFilter method was added. The Demonstration, Amendment, and Extension resolvers were updated by creating a set of data access methods such as getDemonstration and getManyDemonstrations. In those functions, the authorization filter is applied by "AND"ing it to the original prisma where clause. the permission filters themselves are expressed as a mapping between the Permission's name and a fragment of a prisma where clause. Multiple permissions get "OR"ed together, such that their accesses act permissively (they are UNIONed, rather than INTERSECTED).

The associated queries and helpers were chunked such that they can be tested individually. At this moment, a migration is required to initialize the permission assignments and a further edit to auth.util will likely need to be done in order to initialize new users with the appropriate role; will update that here shortly.

@github-actions github-actions bot added the server Relates to the server. label Apr 8, 2026
@demos-git-service-account
Copy link
Copy Markdown
Contributor

demos-git-service-account commented Apr 8, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

server Relates to the server.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants