CUPUM / nplex

Plateforme de valorisation de petits projets d'architecture et d'aménagement à Montréal.
https://www.nplex.design
4 stars 0 forks source link

Task: Implement entity-specific authorization helpers and add to relevant queries #220

Closed iolyd closed 2 months ago

iolyd commented 11 months ago

Task Description

The current database schema provides all that is needed for a granular data access control. Although, its use requires us to first ideate a future-proof system (query filters to use in where clauses?, query header injection with schema-level RLS?, etc.) and then implement reusable query helpers.

List of actions

iolyd commented 10 months ago

Chosen approach for now is to provide a module with helper filters (where values) or sub queries (select) that can then be added to existing queries. This enables for a modular building of queries with blocks from different concerns (retrieving translations, authorization, etc.).

See https://github.com/CUPUM/nplex/blob/v2/src/lib/db/authorization.server.ts for WIP.

iolyd commented 5 months ago

Refer to https://github.com/CUPUM/aipithet/blob/main/src/lib/queries/queries.ts for an example of how to solve this.

iolyd commented 2 months ago

RLS is coming soon to drizzle, but for the time being we will only rely on helper query filters and per-request authorization using the permission rules dictionnary.