mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-21 21:09:49 +08:00
<!-- 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
|
||
|---|---|---|
| .. | ||
| 20240306152532_initial_migration | ||
| 20240313024014_authroization_code_new_user | ||
| 20240418090527_magic_link | ||
| 20240507195652_team | ||
| 20240518151916_email_config | ||
| 20240520152704_selected_team | ||
| 20240528090210_email_templates | ||
| 20240529121811_spotify_oauth | ||
| 20240608142105_oauth_access_token | ||
| 20240610085756_outer_oauth_info | ||
| 20240618150845_system_team_permission | ||
| 20240701161229_fix_selected_team_and_added_ondelete | ||
| 20240702050143_verification_codes | ||
| 20240707043509_team_profile_image | ||
| 20240714031259_more_backend_endpoints | ||
| 20240722004703_events | ||
| 20240725161939_team_profiles | ||
| 20240726225154_facebook_config_id | ||
| 20240730175523_oauth_access_token | ||
| 20240802011240_password_reset_verification | ||
| 20240804210316_team_invitation | ||
| 20240809231417_disable_sign_up | ||
| 20240810052738_multi_factor_authentication | ||
| 20240811194548_client_team_creation | ||
| 20240812013545_project_on_delete | ||
| 20240815125620_discord_oauth | ||
| 20240820045300_client_read_only_metadata | ||
| 20240823172201_gitlab_oauth | ||
| 20240830010429_event_index | ||
| 20240901224341_connected_account | ||
| 20240904155848_add_bitbucket_oauth | ||
| 20240905201445_ms_tenant | ||
| 20240909201430_project_on_delete | ||
| 20240910211533_remove_shared_facebook | ||
| 20240912185510_password_auth_unique_key | ||
| 20240912212547_linkedin_oauth | ||
| 20240914210306_apple_oauth | ||
| 20240917182207_account_deletion | ||
| 20240919223009_x_and_slack_oauth | ||
| 20240923165906_otp_attempts | ||
| 20240929194058_remove_otp_contact_channel | ||
| 20241007162201_legacy_jwt | ||
| 20241013185548_remove_client_id_unique | ||
| 20241024234115_passkey_support | ||
| 20241026024655_user_sorting_indices | ||
| 20241116221711_geolocation_events | ||
| 20241124163535_verification_code_handler_index | ||
| 20241201043500_idp | ||
| 20241207223510_neon_project_transfers | ||
| 20241220033652_event_indices | ||
| 20241223205737_remove_empty_profile_images | ||
| 20241223225110_fill_empty_project_config_values | ||
| 20241223231022_remove_empty_team_profile_images | ||
| 20241223231023_onlyhttps_domains | ||
| 20241228033652_more_event_indices | ||
| 20250206063807_tenancies | ||
| 20250206073652_branch_event_indices | ||
| 20250207071519_tenancies_finalization | ||
| 20250214175437_create_user_indices | ||
| 20250221013242_sent_email_table | ||
| 20250225200753_add_tenancy_cascade | ||
| 20250225200857_add_another | ||
| 20250227004548_make_project_description_non_nullable | ||
| 20250303231152_add_cli_auth | ||
| 20250304004231_merge_oauth_methods | ||
| 20250304200822_add_project_user_count | ||
| 20250310172256_add_id_and_impersonation_field | ||
| 20250320223454_anonymous_users | ||
| 20250325235813_project_user_permissions | ||
| 20250401220515_permission_unique_constraint | ||
| migration_lock.toml | ||