stack/apps/backend/src
CactusBlue 306f4e4c67
Permission Robustness (#591)
<!-- ELLIPSIS_HIDDEN -->


> [!IMPORTANT]
> Enhance permission management by adding unique constraints, handling
duplicate ID errors, and updating frontend and backend logic with
comprehensive tests.
> 
>   - **Database**:
> - Add unique constraint on `Permission` table for `[tenancyId,
queryableId]` in `migration.sql`.
>     - Update `schema.prisma` to reflect new unique constraints.
>   - **Backend**:
> - Update `crud.tsx` files to handle `PERMISSION_ID_ALREADY_EXISTS`
error using `isErrorForNonUniquePermission()`.
> - Add `isPrismaUniqueConstraintViolation()` in `prisma-client.tsx` to
identify unique constraint violations.
>     - Add `PermissionIdAlreadyExists` error in `known-errors.tsx`.
>   - **Frontend**:
> - Update `page-client.tsx` and `permission-table.tsx` to check for
duplicate permission IDs before creation.
>   - **Tests**:
> - Add tests in `project-permission-definitions.test.ts` and
`team-permission-definitions.test.ts` to verify duplicate ID handling.
> - Ensure permissions cannot be created with duplicate IDs across
project and team contexts.
> 
> <sup>This description was created by </sup>[<img alt="Ellipsis"
src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=stack-auth%2Fstack-auth&utm_source=github&utm_medium=referral)<sup>
for b3ccd15bca. It will automatically
update as commits are pushed.</sup>


<!-- ELLIPSIS_HIDDEN -->

---------

Co-authored-by: Konsti Wohlwend <n2d4xc@gmail.com>
Co-authored-by: Zai Shi <zaishi00@outlook.com>
2025-04-02 01:12:13 +02:00
..
app Permission Robustness (#591) 2025-04-02 01:12:13 +02:00
lib Permission Robustness (#591) 2025-04-02 01:12:13 +02:00
oauth Anonymous users (#566) 2025-03-20 18:24:19 -07:00
route-handlers Fix OTP docs (#565) 2025-03-21 01:23:39 +01:00
utils add opentelemetry log function and telemetry for primary_email_auth_enabled usage (#523) 2025-03-10 08:46:36 -07:00
analytics.tsx Fix event capture 2024-08-14 12:49:35 -07:00
globals.d.ts Split backend and dashboard (#83) 2024-06-18 15:49:31 +02:00
instrumentation.ts Attempt CI fix 2025-03-12 16:50:55 -07:00
middleware.tsx Allow Vercel headers in CORS 2025-03-13 13:09:51 -07:00
polyfills.tsx Fix dashboard 2024-12-11 16:01:09 -08:00
prisma-client.tsx Permission Robustness (#591) 2025-04-02 01:12:13 +02:00
smart-router.tsx Move /api/v1 to /api/latest 2025-02-05 17:24:43 -08:00