@jmruthers/pace-core 0.5.54 → 0.5.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -4
- package/dist/{DataTable-7FMFXA7A.js → DataTable-4T627QFJ.js} +11 -11
- package/dist/{PublicLoadingSpinner-Bq_-BeK-.d.ts → PublicLoadingSpinner-SL8WaQN7.d.ts} +2 -21
- package/dist/{api-H5A3H4IR.js → api-LUNF5O6M.js} +3 -3
- package/dist/{appConfig-BVGyuvI7.d.ts → appConfig-DjpeG6P-.d.ts} +9 -1
- package/dist/{appNameResolver-7GHF5ED2.js → appNameResolver-UURKN7NF.js} +2 -2
- package/dist/{audit-BUW3LMJB.js → audit-6TOCAMKO.js} +2 -2
- package/dist/{chunk-MZBUOP4P.js → chunk-5BSLGBYI.js} +4 -3
- package/dist/chunk-5BSLGBYI.js.map +1 -0
- package/dist/{chunk-I5Z3QH5X.js → chunk-66C4BSAY.js} +2 -2
- package/dist/{chunk-I5Z3QH5X.js.map → chunk-66C4BSAY.js.map} +1 -1
- package/dist/{chunk-MYP2EGHX.js → chunk-AJ2KMES7.js} +21 -14
- package/dist/chunk-AJ2KMES7.js.map +1 -0
- package/dist/{chunk-EL2O4IUX.js → chunk-AQFRLC7K.js} +16 -24
- package/dist/{chunk-EL2O4IUX.js.map → chunk-AQFRLC7K.js.map} +1 -1
- package/dist/{chunk-7BNPOCLL.js → chunk-B2WTCLCV.js} +6 -2
- package/dist/chunk-B2WTCLCV.js.map +1 -0
- package/dist/{chunk-WJARTBCT.js → chunk-D7ARGIA3.js} +16 -7
- package/dist/chunk-D7ARGIA3.js.map +1 -0
- package/dist/{chunk-NRK4AIHQ.js → chunk-KBRACSJI.js} +3 -3
- package/dist/{chunk-NYUJ4FJR.js → chunk-KJDPSM64.js} +7 -7
- package/dist/chunk-KJDPSM64.js.map +1 -0
- package/dist/{chunk-GWSBHC4J.js → chunk-KLPVOPRI.js} +261 -38
- package/dist/chunk-KLPVOPRI.js.map +1 -0
- package/dist/{chunk-TRIZ7IB7.js → chunk-MPQDF75X.js} +148 -288
- package/dist/chunk-MPQDF75X.js.map +1 -0
- package/dist/{chunk-MSFACPQQ.js → chunk-PAEM3OWN.js} +11 -11
- package/dist/{chunk-MSFACPQQ.js.map → chunk-PAEM3OWN.js.map} +1 -1
- package/dist/{chunk-GIO7BFE7.js → chunk-RQD3D2CO.js} +66 -169
- package/dist/{chunk-GIO7BFE7.js.map → chunk-RQD3D2CO.js.map} +1 -1
- package/dist/{chunk-YDJW5XTN.js → chunk-STT7INZR.js} +25 -1
- package/dist/chunk-STT7INZR.js.map +1 -0
- package/dist/{chunk-6MTY77WU.js → chunk-TNMXZLDR.js} +3 -3
- package/dist/{chunk-BC3S53OZ.js → chunk-UQE2Y64H.js} +30 -14
- package/dist/chunk-UQE2Y64H.js.map +1 -0
- package/dist/{chunk-22KLBHPS.js → chunk-W66AZIOH.js} +2 -2
- package/dist/chunk-W66AZIOH.js.map +1 -0
- package/dist/{chunk-SS3E6QLB.js → chunk-YNUBMSMV.js} +2 -2
- package/dist/chunk-YNUBMSMV.js.map +1 -0
- package/dist/{chunk-NZ655MWE.js → chunk-ZOD2ZY6X.js} +5 -4
- package/dist/chunk-ZOD2ZY6X.js.map +1 -0
- package/dist/{chunk-74C6SNEC.js → chunk-ZPK5656W.js} +3 -3
- package/dist/{chunk-74C6SNEC.js.map → chunk-ZPK5656W.js.map} +1 -1
- package/dist/components.d.ts +22 -899
- package/dist/components.js +436 -3118
- package/dist/components.js.map +1 -1
- package/dist/file-reference-9xUOnwyt.d.ts +70 -0
- package/dist/hooks.d.ts +2 -2
- package/dist/hooks.js +10 -10
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +49 -9
- package/dist/index.js +190 -25
- package/dist/index.js.map +1 -1
- package/dist/{organisation-CO3Sh3_D.d.ts → organisation-t-vvQC3g.d.ts} +1 -8
- package/dist/providers.d.ts +2 -2
- package/dist/providers.js +5 -5
- package/dist/rbac/index.d.ts +65 -46
- package/dist/rbac/index.js +10 -12
- package/dist/styles/core.css +0 -125
- package/dist/types.d.ts +2 -1
- package/dist/types.js +3 -1
- package/dist/types.js.map +1 -1
- package/dist/{usePublicRouteParams-B2OcAsur.d.ts → usePublicRouteParams-CdoFxnJK.d.ts} +1 -1
- package/dist/utils.d.ts +3 -4
- package/dist/utils.js +44 -13
- package/dist/utils.js.map +1 -1
- package/docs/FILE_REFERENCE_SYSTEM.md +440 -0
- package/docs/INDEX.md +7 -5
- package/docs/README.md +0 -1
- package/docs/api/README.md +0 -4
- package/docs/api/classes/ErrorBoundary.md +1 -1
- package/docs/api/classes/InvalidScopeError.md +1 -1
- package/docs/api/classes/MissingUserContextError.md +1 -1
- package/docs/api/classes/OrganisationContextRequiredError.md +1 -1
- package/docs/api/classes/PermissionDeniedError.md +2 -2
- package/docs/api/classes/PublicErrorBoundary.md +1 -1
- package/docs/api/classes/RBACAuditManager.md +12 -12
- package/docs/api/classes/RBACCache.md +1 -1
- package/docs/api/classes/RBACEngine.md +6 -6
- package/docs/api/classes/RBACError.md +1 -1
- package/docs/api/classes/RBACNotInitializedError.md +1 -1
- package/docs/api/classes/SecureSupabaseClient.md +1 -1
- package/docs/api/classes/StorageUtils.md +281 -0
- package/docs/api/interfaces/AggregateConfig.md +1 -1
- package/docs/api/interfaces/ButtonProps.md +1 -1
- package/docs/api/interfaces/CardProps.md +1 -1
- package/docs/api/interfaces/ColorPalette.md +1 -1
- package/docs/api/interfaces/ColorShade.md +1 -1
- package/docs/api/interfaces/DataAccessRecord.md +1 -1
- package/docs/api/interfaces/DataTableAction.md +1 -1
- package/docs/api/interfaces/DataTableColumn.md +1 -1
- package/docs/api/interfaces/DataTableProps.md +1 -1
- package/docs/api/interfaces/DataTableToolbarButton.md +1 -1
- package/docs/api/interfaces/EmptyStateConfig.md +1 -1
- package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
- package/docs/api/interfaces/EventContextType.md +1 -1
- package/docs/api/interfaces/EventLogoProps.md +1 -1
- package/docs/api/interfaces/EventProviderProps.md +1 -1
- package/docs/api/interfaces/FileSizeLimits.md +1 -1
- package/docs/api/interfaces/FileUploadProps.md +1 -1
- package/docs/api/interfaces/FooterProps.md +1 -1
- package/docs/api/interfaces/InactivityWarningModalProps.md +1 -1
- package/docs/api/interfaces/InputProps.md +1 -1
- package/docs/api/interfaces/LabelProps.md +1 -1
- package/docs/api/interfaces/LoginFormProps.md +1 -1
- package/docs/api/interfaces/NavigationAccessRecord.md +2 -2
- package/docs/api/interfaces/NavigationContextType.md +1 -1
- package/docs/api/interfaces/NavigationGuardProps.md +1 -1
- package/docs/api/interfaces/NavigationItem.md +1 -1
- package/docs/api/interfaces/NavigationMenuProps.md +1 -1
- package/docs/api/interfaces/NavigationProviderProps.md +1 -1
- package/docs/api/interfaces/Organisation.md +1 -1
- package/docs/api/interfaces/OrganisationContextType.md +1 -1
- package/docs/api/interfaces/OrganisationMembership.md +1 -1
- package/docs/api/interfaces/OrganisationProviderProps.md +1 -1
- package/docs/api/interfaces/OrganisationSecurityError.md +1 -1
- package/docs/api/interfaces/PaceAppLayoutProps.md +1 -1
- package/docs/api/interfaces/PaceLoginPageProps.md +1 -1
- package/docs/api/interfaces/PageAccessRecord.md +1 -1
- package/docs/api/interfaces/PagePermissionContextType.md +1 -1
- package/docs/api/interfaces/PagePermissionGuardProps.md +1 -1
- package/docs/api/interfaces/PagePermissionProviderProps.md +1 -1
- package/docs/api/interfaces/PaletteData.md +1 -1
- package/docs/api/interfaces/PermissionEnforcerProps.md +4 -4
- package/docs/api/interfaces/PublicErrorBoundaryProps.md +1 -1
- package/docs/api/interfaces/PublicErrorBoundaryState.md +1 -1
- package/docs/api/interfaces/PublicLoadingSpinnerProps.md +1 -1
- package/docs/api/interfaces/PublicPageFooterProps.md +1 -1
- package/docs/api/interfaces/PublicPageHeaderProps.md +1 -1
- package/docs/api/interfaces/PublicPageLayoutProps.md +1 -1
- package/docs/api/interfaces/RBACConfig.md +1 -1
- package/docs/api/interfaces/RBACContextType.md +1 -1
- package/docs/api/interfaces/RBACLogger.md +1 -1
- package/docs/api/interfaces/RBACProviderProps.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
- package/docs/api/interfaces/RouteAccessRecord.md +2 -2
- package/docs/api/interfaces/RouteConfig.md +2 -2
- package/docs/api/interfaces/SecureDataContextType.md +1 -1
- package/docs/api/interfaces/SecureDataProviderProps.md +1 -1
- package/docs/api/interfaces/StorageConfig.md +1 -1
- package/docs/api/interfaces/StorageFileInfo.md +1 -1
- package/docs/api/interfaces/StorageFileMetadata.md +1 -1
- package/docs/api/interfaces/StorageListOptions.md +1 -1
- package/docs/api/interfaces/StorageListResult.md +1 -1
- package/docs/api/interfaces/StorageUploadOptions.md +1 -1
- package/docs/api/interfaces/StorageUploadResult.md +1 -1
- package/docs/api/interfaces/StorageUrlOptions.md +1 -1
- package/docs/api/interfaces/StyleImport.md +1 -1
- package/docs/api/interfaces/ToastActionElement.md +1 -1
- package/docs/api/interfaces/ToastProps.md +1 -1
- package/docs/api/interfaces/UnifiedAuthContextType.md +1 -1
- package/docs/api/interfaces/UnifiedAuthProviderProps.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerOptions.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventLogoOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventLogoReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
- package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
- package/docs/api/interfaces/UserEventAccess.md +1 -1
- package/docs/api/interfaces/UserMenuProps.md +1 -1
- package/docs/api/interfaces/UserProfile.md +1 -1
- package/docs/api/modules.md +204 -200
- package/docs/api-reference/components.md +141 -163
- package/docs/api-reference/hooks.md +347 -0
- package/docs/core-concepts/rbac-system.md +69 -16
- package/docs/getting-started/examples/basic-auth-app.md +0 -1
- package/docs/implementation-guides/datatable-rbac-usage.md +12 -11
- package/docs/implementation-guides/file-upload-storage.md +733 -0
- package/docs/implementation-guides/inactivity-tracking.md +779 -0
- package/docs/implementation-guides/organisation-security.md +748 -0
- package/docs/implementation-guides/public-pages-advanced.md +1022 -0
- package/docs/migration/MIGRATION_GUIDE.md +684 -0
- package/docs/migration/README.md +13 -2
- package/docs/migration/rbac-migration.md +73 -0
- package/docs/rbac/examples/rbac-rls-integration-example.md +11 -13
- package/docs/style-guide.md +269 -1
- package/package.json +1 -1
- package/src/__tests__/TESTING_GUIDELINES.md +331 -18
- package/src/__tests__/helpers/supabaseMock.ts +99 -0
- package/src/__tests__/rbac/PagePermissionGuard.test.tsx +10 -7
- package/src/__tests__/shared.ts +6 -0
- package/src/components/DataTable/components/ActionButtons.tsx +2 -2
- package/src/components/DataTable/components/DataTableCore.tsx +2 -2
- package/src/components/DataTable/components/UnifiedTableBody.tsx +1 -1
- package/src/components/DataTable/utils/debugTools.ts +2 -2
- package/src/components/Dialog/Dialog.test.tsx +12 -2
- package/src/components/ErrorBoundary/ErrorBoundary.test.tsx +6 -6
- package/src/components/ErrorBoundary/ErrorBoundary.tsx +2 -2
- package/src/components/FileDisplay.tsx +233 -0
- package/src/components/FileUpload.tsx +176 -0
- package/src/components/Footer/Footer.test.tsx +7 -7
- package/src/components/NavigationMenu/NavigationMenu.test.tsx +13 -6
- package/src/components/OrganisationSelector/OrganisationSelector.test.tsx +30 -3
- package/src/components/OrganisationSelector/OrganisationSelector.tsx +1 -1
- package/src/components/PaceAppLayout/__tests__/PaceAppLayout.rbac.test.tsx +558 -0
- package/src/components/PublicLayout/PublicErrorBoundary.tsx +1 -1
- package/src/components/PublicLayout/PublicPageDebugger.tsx +2 -2
- package/src/components/PublicLayout/PublicPageDiagnostic.tsx +2 -2
- package/src/components/PublicLayout/PublicPageProvider.tsx +2 -2
- package/src/components/Select/Select.test.tsx +50 -15
- package/src/components/SuperAdminGuard.tsx +2 -2
- package/src/components/__tests__/SuperAdminGuard.test.tsx +559 -0
- package/src/components/index.ts +0 -183
- package/src/hooks/__tests__/useOrganisationPermissions.unit.test.tsx +2 -2
- package/src/hooks/__tests__/usePermissionCache.unit.test.ts +1 -1
- package/src/hooks/__tests__/useRBAC.unit.test.ts +191 -138
- package/src/hooks/public/usePublicEvent.ts +2 -2
- package/src/hooks/useAppConfig.ts +3 -3
- package/src/hooks/useComponentPerformance.ts +1 -1
- package/src/hooks/useDataTablePerformance.ts +1 -1
- package/src/hooks/useFileReference.ts +232 -0
- package/src/hooks/useOrganisationPermissions.test.ts +254 -344
- package/src/hooks/useOrganisationPermissions.ts +15 -7
- package/src/hooks/useOrganisationSecurity.test.ts +390 -402
- package/src/hooks/usePerformanceMonitor.ts +1 -1
- package/src/hooks/usePermissionCache.test.ts +264 -395
- package/src/hooks/usePermissionCache.ts +34 -4
- package/src/hooks/useSecureDataAccess.test.ts +486 -0
- package/src/hooks/useSecureDataAccess.ts +4 -1
- package/src/providers/InactivityProvider.tsx +2 -2
- package/src/providers/OrganisationProvider.test.simple.tsx +168 -0
- package/src/providers/OrganisationProvider.test.tsx +168 -0
- package/src/providers/OrganisationProvider.tsx +18 -31
- package/src/providers/UnifiedAuthProvider.test.simple.tsx +205 -0
- package/src/providers/UnifiedAuthProvider.test.tsx +128 -0
- package/src/providers/__tests__/InactivityProvider.test.tsx +3 -4
- package/src/providers/__tests__/OrganisationProvider.test.tsx +19 -14
- package/src/rbac/__tests__/integration.authflow.test.tsx +123 -0
- package/src/rbac/__tests__/integration.navigation.test.tsx +72 -0
- package/src/rbac/__tests__/integration.securedata.test.tsx +92 -0
- package/src/rbac/__tests__/integration.smoke.test.tsx +73 -0
- package/src/rbac/__tests__/rbac-core.test.tsx +26 -22
- package/src/rbac/__tests__/rbac-engine-core-logic.test.ts +411 -0
- package/src/rbac/__tests__/rbac-engine-simplified.test.ts +285 -0
- package/src/rbac/__tests__/rbac-functions.test.ts +655 -0
- package/src/rbac/__tests__/rbac-integration.test.ts +532 -0
- package/src/rbac/__tests__/scenarios.user-role.test.tsx +196 -0
- package/src/rbac/api.test.ts +6 -6
- package/src/rbac/api.ts +2 -2
- package/src/rbac/audit.test.ts +485 -0
- package/src/rbac/audit.ts +7 -1
- package/src/rbac/cache-invalidation.ts +318 -0
- package/src/rbac/cache.test.ts +286 -0
- package/src/rbac/components/EnhancedNavigationMenu.test.tsx +559 -0
- package/src/rbac/components/EnhancedNavigationMenu.tsx +29 -23
- package/src/rbac/components/NavigationProvider.test.tsx +449 -0
- package/src/rbac/components/PagePermissionGuard.tsx +4 -4
- package/src/rbac/components/PagePermissionProvider.test.tsx +479 -0
- package/src/rbac/components/SecureDataProvider.test.tsx +511 -0
- package/src/rbac/components/__tests__/PagePermissionGuard.race-condition.test.tsx +159 -430
- package/src/rbac/components/__tests__/PagePermissionGuard.test.tsx +4 -5
- package/src/rbac/components/__tests__/PagePermissionGuard.verification.test.tsx +112 -118
- package/src/rbac/config.test.ts +410 -0
- package/src/rbac/engine.test.simple.ts +237 -0
- package/src/rbac/engine.test.ts +233 -0
- package/src/rbac/engine.ts +37 -41
- package/src/rbac/examples/CompleteRBACExample.tsx +3 -3
- package/src/rbac/examples/EventBasedApp.tsx +4 -4
- package/src/rbac/hooks/useRBAC.simple.test.ts +16 -0
- package/src/rbac/hooks/useRBAC.test.ts +207 -455
- package/src/rbac/hooks/useRBAC.ts +30 -22
- package/src/rbac/permissions.test.ts +128 -0
- package/src/rbac/permissions.ts +56 -141
- package/src/rbac/providers/RBACProvider.tsx +1 -1
- package/src/rbac/secureClient.test.ts +444 -0
- package/src/rbac/security.test.ts +390 -0
- package/src/rbac/security.ts +1 -1
- package/src/rbac/types.test.ts +382 -0
- package/src/rbac/types.ts +2 -2
- package/src/styles/core.css +0 -125
- package/src/types/file-reference.ts +77 -0
- package/src/types/rbac-functions.ts +290 -0
- package/src/types/supabase.ts +10 -28
- package/src/types/unified.ts +4 -1
- package/src/utils/__tests__/bundleAnalysis.unit.test.ts +81 -55
- package/src/utils/__tests__/lazyLoad.unit.test.tsx +21 -12
- package/src/utils/__tests__/organisationContext.unit.test.ts +13 -7
- package/src/utils/__tests__/performanceBudgets.unit.test.ts +3 -3
- package/src/utils/__tests__/sessionTracking.unit.test.ts +32 -12
- package/src/utils/appConfig.ts +1 -1
- package/src/utils/appIdResolver.test.ts +503 -0
- package/src/utils/appIdResolver.ts +1 -1
- package/src/utils/appNameResolver.test.ts +494 -0
- package/src/utils/appNameResolver.ts +3 -2
- package/src/utils/bundleAnalysis.ts +3 -3
- package/src/utils/debugLogger.ts +1 -1
- package/src/utils/file-reference.ts +263 -0
- package/src/utils/formatDate.test.ts +2 -2
- package/src/utils/organisationContext.test.ts +340 -0
- package/src/utils/organisationContext.ts +19 -6
- package/src/utils/performanceBudgets.ts +2 -2
- package/src/utils/permissionUtils.test.ts +393 -0
- package/src/utils/permissionUtils.ts +5 -2
- package/src/utils/secureDataAccess.test.ts +715 -0
- package/src/utils/secureDataAccess.ts +21 -5
- package/src/utils/sessionTracking.ts +34 -4
- package/src/utils/storage/__tests__/helpers.unit.test.ts +328 -0
- package/src/utils/storage/__tests__/index.unit.test.ts +16 -0
- package/src/utils/storage/helpers.ts +20 -25
- package/src/utils/storage/index.ts +29 -1
- package/src/vite-env.d.ts +17 -0
- package/dist/chunk-22KLBHPS.js.map +0 -1
- package/dist/chunk-7BNPOCLL.js.map +0 -1
- package/dist/chunk-BC3S53OZ.js.map +0 -1
- package/dist/chunk-GWSBHC4J.js.map +0 -1
- package/dist/chunk-MYP2EGHX.js.map +0 -1
- package/dist/chunk-MZBUOP4P.js.map +0 -1
- package/dist/chunk-NYUJ4FJR.js.map +0 -1
- package/dist/chunk-NZ655MWE.js.map +0 -1
- package/dist/chunk-SS3E6QLB.js.map +0 -1
- package/dist/chunk-TRIZ7IB7.js.map +0 -1
- package/dist/chunk-WJARTBCT.js.map +0 -1
- package/dist/chunk-YDJW5XTN.js.map +0 -1
- package/docs/print-components/README.md +0 -258
- package/docs/print-components/api-reference.md +0 -636
- package/docs/print-components/examples/README.md +0 -204
- package/docs/print-components/examples/basic-report.tsx +0 -92
- package/docs/print-components/examples/card-catalog.tsx +0 -149
- package/docs/print-components/examples/cover-page-report.tsx +0 -163
- package/docs/print-components/quick-start.md +0 -363
- package/src/components/PrintButton/PrintButton.tsx +0 -321
- package/src/components/PrintButton/PrintButtonGroup.tsx +0 -84
- package/src/components/PrintButton/PrintToolbar.tsx +0 -94
- package/src/components/PrintButton/__tests__/PrintButton.test.tsx +0 -271
- package/src/components/PrintButton/examples/PrintButtonShowcase.tsx +0 -438
- package/src/components/PrintButton/index.ts +0 -33
- package/src/components/PrintButton/types.ts +0 -173
- package/src/components/PrintCard/PrintCard.tsx +0 -154
- package/src/components/PrintCard/PrintCardContent.tsx +0 -57
- package/src/components/PrintCard/PrintCardFooter.tsx +0 -60
- package/src/components/PrintCard/PrintCardGrid.tsx +0 -91
- package/src/components/PrintCard/PrintCardHeader.tsx +0 -78
- package/src/components/PrintCard/PrintCardImage.tsx +0 -81
- package/src/components/PrintCard/examples/PrintCardShowcase.tsx +0 -239
- package/src/components/PrintCard/index.ts +0 -34
- package/src/components/PrintCard/types.ts +0 -171
- package/src/components/PrintDataTable/PrintDataTable.tsx +0 -215
- package/src/components/PrintDataTable/PrintTableGroup.tsx +0 -90
- package/src/components/PrintDataTable/PrintTableRow.tsx +0 -76
- package/src/components/PrintDataTable/index.ts +0 -25
- package/src/components/PrintDataTable/types.ts +0 -67
- package/src/components/PrintFooter/PrintFooter.tsx +0 -183
- package/src/components/PrintFooter/PrintFooterContent.tsx +0 -71
- package/src/components/PrintFooter/PrintFooterInfo.tsx +0 -86
- package/src/components/PrintFooter/PrintPageNumber.tsx +0 -90
- package/src/components/PrintFooter/examples/PrintFooterShowcase.tsx +0 -390
- package/src/components/PrintFooter/index.ts +0 -30
- package/src/components/PrintFooter/types.ts +0 -149
- package/src/components/PrintGrid/PrintGrid.tsx +0 -180
- package/src/components/PrintGrid/PrintGridBreakpoint.tsx +0 -109
- package/src/components/PrintGrid/PrintGridContainer.tsx +0 -128
- package/src/components/PrintGrid/PrintGridItem.tsx +0 -220
- package/src/components/PrintGrid/examples/PrintGridShowcase.tsx +0 -359
- package/src/components/PrintGrid/index.ts +0 -31
- package/src/components/PrintGrid/types.ts +0 -159
- package/src/components/PrintHeader/PrintCoverHeader.tsx +0 -230
- package/src/components/PrintHeader/PrintHeader.tsx +0 -150
- package/src/components/PrintHeader/index.ts +0 -17
- package/src/components/PrintHeader/types.ts +0 -42
- package/src/components/PrintLayout/PrintLayout.tsx +0 -122
- package/src/components/PrintLayout/PrintLayoutContext.tsx +0 -66
- package/src/components/PrintLayout/PrintPageBreak.tsx +0 -52
- package/src/components/PrintLayout/examples/PrintShowcase.tsx +0 -230
- package/src/components/PrintLayout/index.ts +0 -19
- package/src/components/PrintLayout/types.ts +0 -37
- package/src/components/PrintPageBreak/PrintPageBreak.tsx +0 -120
- package/src/components/PrintPageBreak/PrintPageBreakGroup.tsx +0 -90
- package/src/components/PrintPageBreak/PrintPageBreakIndicator.tsx +0 -112
- package/src/components/PrintPageBreak/examples/PrintPageBreakShowcase.tsx +0 -279
- package/src/components/PrintPageBreak/index.ts +0 -23
- package/src/components/PrintPageBreak/types.ts +0 -94
- package/src/components/PrintSection/PrintColumn.tsx +0 -104
- package/src/components/PrintSection/PrintDivider.tsx +0 -101
- package/src/components/PrintSection/PrintSection.tsx +0 -129
- package/src/components/PrintSection/PrintSectionContent.tsx +0 -75
- package/src/components/PrintSection/PrintSectionHeader.tsx +0 -97
- package/src/components/PrintSection/examples/PrintSectionShowcase.tsx +0 -258
- package/src/components/PrintSection/index.ts +0 -33
- package/src/components/PrintSection/types.ts +0 -155
- package/src/components/PrintText/PrintText.tsx +0 -116
- package/src/components/PrintText/index.ts +0 -16
- package/src/components/PrintText/types.ts +0 -24
- package/src/rbac/__tests__/integration.test.tsx +0 -218
- package/src/utils/print/PrintDataProcessor.ts +0 -390
- package/src/utils/print/examples/PrintUtilitiesShowcase.tsx +0 -397
- package/src/utils/print/index.ts +0 -29
- package/src/utils/print/types.ts +0 -196
- package/src/utils/print/usePrintOptimization.ts +0 -272
- /package/dist/{DataTable-7FMFXA7A.js.map → DataTable-4T627QFJ.js.map} +0 -0
- /package/dist/{api-H5A3H4IR.js.map → api-LUNF5O6M.js.map} +0 -0
- /package/dist/{appNameResolver-7GHF5ED2.js.map → appNameResolver-UURKN7NF.js.map} +0 -0
- /package/dist/{audit-BUW3LMJB.js.map → audit-6TOCAMKO.js.map} +0 -0
- /package/dist/{chunk-NRK4AIHQ.js.map → chunk-KBRACSJI.js.map} +0 -0
- /package/dist/{chunk-6MTY77WU.js.map → chunk-TNMXZLDR.js.map} +0 -0
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
createAuditManager,
|
|
3
3
|
emitAuditEvent,
|
|
4
4
|
setGlobalAuditManager
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-B2WTCLCV.js";
|
|
6
6
|
|
|
7
7
|
// src/rbac/types.ts
|
|
8
8
|
var RBACError = class extends Error {
|
|
@@ -187,6 +187,232 @@ var CACHE_PATTERNS = {
|
|
|
187
187
|
PERMISSION: (userId, organisationId) => `perm:${userId}:${organisationId}`
|
|
188
188
|
};
|
|
189
189
|
|
|
190
|
+
// src/rbac/cache-invalidation.ts
|
|
191
|
+
var INVALIDATION_PATTERNS = {
|
|
192
|
+
// User-level invalidation
|
|
193
|
+
USER_ROLES_CHANGED: (userId) => [
|
|
194
|
+
CACHE_PATTERNS.USER(userId),
|
|
195
|
+
`perm:${userId}:*`,
|
|
196
|
+
`access:${userId}:*`,
|
|
197
|
+
`map:${userId}:*`
|
|
198
|
+
],
|
|
199
|
+
// Organisation-level invalidation
|
|
200
|
+
ORGANISATION_PERMISSIONS_CHANGED: (organisationId) => [
|
|
201
|
+
CACHE_PATTERNS.ORGANISATION(organisationId),
|
|
202
|
+
`perm:*:${organisationId}:*`,
|
|
203
|
+
`access:*:${organisationId}:*`,
|
|
204
|
+
`map:*:${organisationId}:*`
|
|
205
|
+
],
|
|
206
|
+
// Event-level invalidation
|
|
207
|
+
EVENT_PERMISSIONS_CHANGED: (eventId) => [
|
|
208
|
+
CACHE_PATTERNS.EVENT(eventId),
|
|
209
|
+
`perm:*:*:${eventId}:*`,
|
|
210
|
+
`access:*:*:${eventId}:*`,
|
|
211
|
+
`map:*:*:${eventId}:*`
|
|
212
|
+
],
|
|
213
|
+
// App-level invalidation
|
|
214
|
+
APP_PERMISSIONS_CHANGED: (appId) => [
|
|
215
|
+
CACHE_PATTERNS.APP(appId),
|
|
216
|
+
`perm:*:*:*:${appId}:*`,
|
|
217
|
+
`access:*:*:*:${appId}`,
|
|
218
|
+
`map:*:*:*:${appId}`
|
|
219
|
+
],
|
|
220
|
+
// Page-level invalidation
|
|
221
|
+
PAGE_PERMISSIONS_CHANGED: (pageId) => [
|
|
222
|
+
`perm:*:*:*:*:${pageId}`,
|
|
223
|
+
`map:*:*:*:*`
|
|
224
|
+
]
|
|
225
|
+
};
|
|
226
|
+
var RBACCacheInvalidationManager = class {
|
|
227
|
+
constructor(supabase) {
|
|
228
|
+
this.invalidationCallbacks = /* @__PURE__ */ new Set();
|
|
229
|
+
this.supabase = supabase;
|
|
230
|
+
this.setupRealtimeSubscriptions();
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Add a callback for cache invalidation events
|
|
234
|
+
*
|
|
235
|
+
* @param callback - Function to call when cache is invalidated
|
|
236
|
+
* @returns Unsubscribe function
|
|
237
|
+
*/
|
|
238
|
+
onInvalidation(callback) {
|
|
239
|
+
this.invalidationCallbacks.add(callback);
|
|
240
|
+
return () => this.invalidationCallbacks.delete(callback);
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Invalidate cache for a specific user
|
|
244
|
+
*
|
|
245
|
+
* @param userId - User ID
|
|
246
|
+
* @param reason - Reason for invalidation
|
|
247
|
+
*/
|
|
248
|
+
invalidateUser(userId, reason) {
|
|
249
|
+
const patterns = INVALIDATION_PATTERNS.USER_ROLES_CHANGED(userId);
|
|
250
|
+
this.invalidatePatterns(patterns, reason);
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Invalidate cache for a specific organisation
|
|
254
|
+
*
|
|
255
|
+
* @param organisationId - Organisation ID
|
|
256
|
+
* @param reason - Reason for invalidation
|
|
257
|
+
*/
|
|
258
|
+
invalidateOrganisation(organisationId, reason) {
|
|
259
|
+
const patterns = INVALIDATION_PATTERNS.ORGANISATION_PERMISSIONS_CHANGED(organisationId);
|
|
260
|
+
this.invalidatePatterns(patterns, reason);
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Invalidate cache for a specific event
|
|
264
|
+
*
|
|
265
|
+
* @param eventId - Event ID
|
|
266
|
+
* @param reason - Reason for invalidation
|
|
267
|
+
*/
|
|
268
|
+
invalidateEvent(eventId, reason) {
|
|
269
|
+
const patterns = INVALIDATION_PATTERNS.EVENT_PERMISSIONS_CHANGED(eventId);
|
|
270
|
+
this.invalidatePatterns(patterns, reason);
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Invalidate cache for a specific app
|
|
274
|
+
*
|
|
275
|
+
* @param appId - App ID
|
|
276
|
+
* @param reason - Reason for invalidation
|
|
277
|
+
*/
|
|
278
|
+
invalidateApp(appId, reason) {
|
|
279
|
+
const patterns = INVALIDATION_PATTERNS.APP_PERMISSIONS_CHANGED(appId);
|
|
280
|
+
this.invalidatePatterns(patterns, reason);
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Invalidate cache for a specific page
|
|
284
|
+
*
|
|
285
|
+
* @param pageId - Page ID
|
|
286
|
+
* @param reason - Reason for invalidation
|
|
287
|
+
*/
|
|
288
|
+
invalidatePage(pageId, reason) {
|
|
289
|
+
const patterns = INVALIDATION_PATTERNS.PAGE_PERMISSIONS_CHANGED(pageId);
|
|
290
|
+
this.invalidatePatterns(patterns, reason);
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Invalidate cache patterns and notify callbacks
|
|
294
|
+
*
|
|
295
|
+
* @param patterns - Array of cache patterns to invalidate
|
|
296
|
+
* @param reason - Reason for invalidation
|
|
297
|
+
*/
|
|
298
|
+
invalidatePatterns(patterns, reason) {
|
|
299
|
+
console.log(`[RBAC Cache] Invalidating patterns: ${patterns.join(", ")} (${reason})`);
|
|
300
|
+
patterns.forEach((pattern) => {
|
|
301
|
+
rbacCache.invalidate(pattern);
|
|
302
|
+
});
|
|
303
|
+
this.invalidationCallbacks.forEach((callback) => {
|
|
304
|
+
patterns.forEach((pattern) => callback(pattern));
|
|
305
|
+
});
|
|
306
|
+
emitAuditEvent({
|
|
307
|
+
type: "permission_check",
|
|
308
|
+
userId: "system",
|
|
309
|
+
organisationId: "00000000-0000-0000-0000-000000000000",
|
|
310
|
+
permission: "cache:invalidate",
|
|
311
|
+
decision: true,
|
|
312
|
+
source: "api",
|
|
313
|
+
duration_ms: 0,
|
|
314
|
+
metadata: {
|
|
315
|
+
reason,
|
|
316
|
+
patterns,
|
|
317
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
318
|
+
cache_invalidation: true
|
|
319
|
+
}
|
|
320
|
+
}).catch((error) => {
|
|
321
|
+
console.warn("[RBAC Cache] Failed to log cache invalidation audit event:", error);
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Setup realtime subscriptions for automatic cache invalidation
|
|
326
|
+
*/
|
|
327
|
+
setupRealtimeSubscriptions() {
|
|
328
|
+
if (!this.supabase.channel || typeof this.supabase.channel !== "function") {
|
|
329
|
+
console.log("[RBAC Cache] Realtime not available, skipping subscriptions");
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
this.supabase.channel("rbac_organisation_roles_changes").on("postgres_changes", {
|
|
333
|
+
event: "*",
|
|
334
|
+
schema: "public",
|
|
335
|
+
table: "rbac_organisation_roles"
|
|
336
|
+
}, (payload) => {
|
|
337
|
+
const { organisation_id, user_id } = payload.new || payload.old || {};
|
|
338
|
+
if (organisation_id) {
|
|
339
|
+
this.invalidateOrganisation(organisation_id, `organisation_role_${payload.eventType}`);
|
|
340
|
+
}
|
|
341
|
+
if (user_id) {
|
|
342
|
+
this.invalidateUser(user_id, `organisation_role_${payload.eventType}`);
|
|
343
|
+
}
|
|
344
|
+
}).subscribe();
|
|
345
|
+
this.supabase.channel("rbac_event_app_roles_changes").on("postgres_changes", {
|
|
346
|
+
event: "*",
|
|
347
|
+
schema: "public",
|
|
348
|
+
table: "rbac_event_app_roles"
|
|
349
|
+
}, (payload) => {
|
|
350
|
+
const { organisation_id, user_id, event_id, app_id } = payload.new || payload.old || {};
|
|
351
|
+
if (organisation_id) {
|
|
352
|
+
this.invalidateOrganisation(organisation_id, `event_app_role_${payload.eventType}`);
|
|
353
|
+
}
|
|
354
|
+
if (user_id) {
|
|
355
|
+
this.invalidateUser(user_id, `event_app_role_${payload.eventType}`);
|
|
356
|
+
}
|
|
357
|
+
if (event_id) {
|
|
358
|
+
this.invalidateEvent(event_id, `event_app_role_${payload.eventType}`);
|
|
359
|
+
}
|
|
360
|
+
if (app_id) {
|
|
361
|
+
this.invalidateApp(app_id, `event_app_role_${payload.eventType}`);
|
|
362
|
+
}
|
|
363
|
+
}).subscribe();
|
|
364
|
+
this.supabase.channel("rbac_global_roles_changes").on("postgres_changes", {
|
|
365
|
+
event: "*",
|
|
366
|
+
schema: "public",
|
|
367
|
+
table: "rbac_global_roles"
|
|
368
|
+
}, (payload) => {
|
|
369
|
+
const { user_id } = payload.new || payload.old || {};
|
|
370
|
+
if (user_id) {
|
|
371
|
+
this.invalidateUser(user_id, `global_role_${payload.eventType}`);
|
|
372
|
+
}
|
|
373
|
+
}).subscribe();
|
|
374
|
+
this.supabase.channel("rbac_page_permissions_changes").on("postgres_changes", {
|
|
375
|
+
event: "*",
|
|
376
|
+
schema: "public",
|
|
377
|
+
table: "rbac_page_permissions"
|
|
378
|
+
}, (payload) => {
|
|
379
|
+
const { organisation_id, app_page_id, role_id } = payload.new || payload.old || {};
|
|
380
|
+
if (organisation_id) {
|
|
381
|
+
this.invalidateOrganisation(organisation_id, `page_permission_${payload.eventType}`);
|
|
382
|
+
}
|
|
383
|
+
if (app_page_id) {
|
|
384
|
+
this.invalidatePage(app_page_id, `page_permission_${payload.eventType}`);
|
|
385
|
+
}
|
|
386
|
+
}).subscribe();
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Manually trigger cache invalidation for all users in an organisation
|
|
390
|
+
*
|
|
391
|
+
* @param organisationId - Organisation ID
|
|
392
|
+
* @param reason - Reason for invalidation
|
|
393
|
+
*/
|
|
394
|
+
async invalidateAllUsersInOrganisation(organisationId, reason) {
|
|
395
|
+
const { data: users } = await this.supabase.from("rbac_organisation_roles").select("user_id").eq("organisation_id", organisationId).eq("is_active", true);
|
|
396
|
+
if (users) {
|
|
397
|
+
users.forEach(({ user_id }) => {
|
|
398
|
+
this.invalidateUser(user_id, reason);
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Clear all cache entries
|
|
404
|
+
*/
|
|
405
|
+
clearAllCache() {
|
|
406
|
+
console.log("[RBAC Cache] Clearing all cache entries");
|
|
407
|
+
rbacCache.clear();
|
|
408
|
+
}
|
|
409
|
+
};
|
|
410
|
+
var globalCacheInvalidationManager = null;
|
|
411
|
+
function initializeCacheInvalidation(supabase) {
|
|
412
|
+
globalCacheInvalidationManager = new RBACCacheInvalidationManager(supabase);
|
|
413
|
+
return globalCacheInvalidationManager;
|
|
414
|
+
}
|
|
415
|
+
|
|
190
416
|
// src/rbac/security.ts
|
|
191
417
|
var RBACSecurityValidator = class {
|
|
192
418
|
/**
|
|
@@ -315,7 +541,7 @@ var RBACSecurityValidator = class {
|
|
|
315
541
|
timestamp: event.timestamp || /* @__PURE__ */ new Date(),
|
|
316
542
|
severity: this.getEventSeverity(event.type)
|
|
317
543
|
};
|
|
318
|
-
if (
|
|
544
|
+
if (import.meta.env.MODE === "development") {
|
|
319
545
|
console.warn("[RBAC Security]", securityEvent);
|
|
320
546
|
}
|
|
321
547
|
}
|
|
@@ -418,6 +644,7 @@ var RBACEngine = class {
|
|
|
418
644
|
constructor(supabase) {
|
|
419
645
|
this.supabase = supabase;
|
|
420
646
|
this.securityMiddleware = new RBACSecurityMiddleware(DEFAULT_SECURITY_CONFIG);
|
|
647
|
+
initializeCacheInvalidation(supabase);
|
|
421
648
|
}
|
|
422
649
|
/**
|
|
423
650
|
* Check if a user has a specific permission
|
|
@@ -429,6 +656,8 @@ var RBACEngine = class {
|
|
|
429
656
|
async isPermitted(input, securityContext) {
|
|
430
657
|
const startTime = Date.now();
|
|
431
658
|
const { userId, permission, scope, pageId } = input;
|
|
659
|
+
let cacheHit = false;
|
|
660
|
+
let cacheSource = "database";
|
|
432
661
|
try {
|
|
433
662
|
if (securityContext) {
|
|
434
663
|
const validation = await this.securityMiddleware.validateInput(input, securityContext);
|
|
@@ -601,7 +830,9 @@ var RBACEngine = class {
|
|
|
601
830
|
permission,
|
|
602
831
|
decision: finalDecision,
|
|
603
832
|
source: "api",
|
|
604
|
-
duration_ms: _duration
|
|
833
|
+
duration_ms: _duration,
|
|
834
|
+
cache_hit: cacheHit,
|
|
835
|
+
cache_source: cacheSource
|
|
605
836
|
});
|
|
606
837
|
}
|
|
607
838
|
return finalDecision;
|
|
@@ -699,7 +930,7 @@ var RBACEngine = class {
|
|
|
699
930
|
if (pages) {
|
|
700
931
|
for (const page of pages) {
|
|
701
932
|
const operations = [];
|
|
702
|
-
for (const operation of ["read", "create", "update", "delete"
|
|
933
|
+
for (const operation of ["read", "create", "update", "delete"]) {
|
|
703
934
|
const hasPermission2 = await this.isPermitted({
|
|
704
935
|
userId,
|
|
705
936
|
scope: validatedScope,
|
|
@@ -729,10 +960,14 @@ var RBACEngine = class {
|
|
|
729
960
|
if (cached !== null) {
|
|
730
961
|
return cached;
|
|
731
962
|
}
|
|
732
|
-
const { data, error } = await this.supabase.
|
|
733
|
-
|
|
963
|
+
const { data, error } = await this.supabase.rpc("rbac_permission_check", {
|
|
964
|
+
p_operation: "read",
|
|
965
|
+
p_page_name: "admin-panel",
|
|
966
|
+
p_user_id: userId
|
|
967
|
+
});
|
|
968
|
+
const isSuperAdmin2 = !error && data && data.length > 0 && data[0].has_permission && data[0].role_name === "super_admin";
|
|
734
969
|
rbacCache.set(cacheKey, isSuperAdmin2, 6e4);
|
|
735
|
-
return isSuperAdmin2;
|
|
970
|
+
return Boolean(isSuperAdmin2);
|
|
736
971
|
}
|
|
737
972
|
/**
|
|
738
973
|
* Get app configuration including requires_event setting
|
|
@@ -818,28 +1053,12 @@ var RBACEngine = class {
|
|
|
818
1053
|
const { data: eventRoles } = await this.supabase.from("rbac_event_app_roles").select("role, status, valid_from, valid_to").eq("user_id", userId).eq("event_id", scope.eventId).eq("app_id", scope.appId).eq("status", "active").lte("valid_from", now).or(`valid_to.is.null,valid_to.gte.${now}`);
|
|
819
1054
|
if (eventRoles) {
|
|
820
1055
|
userRoles.push(...eventRoles.map((r) => r.role));
|
|
821
|
-
for (const role of eventRoles) {
|
|
822
|
-
grants.push({
|
|
823
|
-
type: "allow",
|
|
824
|
-
permission: this.getPermissionForEventRole(role.role),
|
|
825
|
-
scope: "eventApp",
|
|
826
|
-
source: "rbac_event_app_roles"
|
|
827
|
-
});
|
|
828
|
-
}
|
|
829
1056
|
}
|
|
830
1057
|
}
|
|
831
1058
|
if (scope.organisationId) {
|
|
832
1059
|
const { data: orgRoles } = await this.supabase.from("rbac_organisation_roles").select("role, status, valid_from, valid_to").eq("user_id", userId).eq("organisation_id", scope.organisationId).eq("status", "active").lte("valid_from", now).or(`valid_to.is.null,valid_to.gte.${now}`);
|
|
833
1060
|
if (orgRoles) {
|
|
834
1061
|
userRoles.push(...orgRoles.map((r) => r.role));
|
|
835
|
-
for (const role of orgRoles) {
|
|
836
|
-
grants.push({
|
|
837
|
-
type: "allow",
|
|
838
|
-
permission: this.getPermissionForOrgRole(role.role),
|
|
839
|
-
scope: "organisation",
|
|
840
|
-
source: "rbac_organisation_roles"
|
|
841
|
-
});
|
|
842
|
-
}
|
|
843
1062
|
}
|
|
844
1063
|
}
|
|
845
1064
|
console.log("[collectActiveGrants] User roles:", userRoles);
|
|
@@ -868,7 +1087,7 @@ var RBACEngine = class {
|
|
|
868
1087
|
const { data: page } = await this.supabase.from("rbac_app_pages").select("page_name").eq("id", resolvedPageId).single();
|
|
869
1088
|
pageName = page?.page_name || null;
|
|
870
1089
|
}
|
|
871
|
-
const rpcResult = await this.supabase.rpc("
|
|
1090
|
+
const rpcResult = await this.supabase.rpc("rbac_permissions_get", {
|
|
872
1091
|
p_user_id: userId,
|
|
873
1092
|
p_app_id: scope.appId,
|
|
874
1093
|
p_event_id: scope.eventId || null,
|
|
@@ -900,12 +1119,12 @@ var RBACEngine = class {
|
|
|
900
1119
|
if (globalRoles) {
|
|
901
1120
|
for (const role of globalRoles) {
|
|
902
1121
|
if (role.role === "super_admin") {
|
|
903
|
-
grants.push(
|
|
904
|
-
type: "allow",
|
|
905
|
-
permission: "
|
|
906
|
-
scope: "global",
|
|
907
|
-
source: "rbac_global_roles"
|
|
908
|
-
|
|
1122
|
+
grants.push(
|
|
1123
|
+
{ type: "allow", permission: "read:*", scope: "global", source: "rbac_global_roles" },
|
|
1124
|
+
{ type: "allow", permission: "create:*", scope: "global", source: "rbac_global_roles" },
|
|
1125
|
+
{ type: "allow", permission: "update:*", scope: "global", source: "rbac_global_roles" },
|
|
1126
|
+
{ type: "allow", permission: "delete:*", scope: "global", source: "rbac_global_roles" }
|
|
1127
|
+
);
|
|
909
1128
|
}
|
|
910
1129
|
}
|
|
911
1130
|
}
|
|
@@ -947,7 +1166,7 @@ var RBACEngine = class {
|
|
|
947
1166
|
} else {
|
|
948
1167
|
let appId = scope.appId;
|
|
949
1168
|
if (!appId) {
|
|
950
|
-
const appName =
|
|
1169
|
+
const appName = import.meta.env.VITE_APP_NAME || import.meta.env.REACT_APP_NAME;
|
|
951
1170
|
if (appName) {
|
|
952
1171
|
const { data: app } = await this.supabase.from("rbac_apps").select("id").eq("name", appName).eq("is_active", true).single();
|
|
953
1172
|
if (app) {
|
|
@@ -1001,9 +1220,11 @@ var RBACEngine = class {
|
|
|
1001
1220
|
getPermissionForOrgRole(role) {
|
|
1002
1221
|
switch (role) {
|
|
1003
1222
|
case "org_admin":
|
|
1004
|
-
return "
|
|
1223
|
+
return "read:*";
|
|
1224
|
+
// Will be expanded to all CRUD in collectActiveGrants
|
|
1005
1225
|
case "leader":
|
|
1006
|
-
return "
|
|
1226
|
+
return "read:organisation.*";
|
|
1227
|
+
// Will be expanded to all CRUD in collectActiveGrants
|
|
1007
1228
|
case "member":
|
|
1008
1229
|
return "read:organisation.*";
|
|
1009
1230
|
case "supporter":
|
|
@@ -1021,9 +1242,11 @@ var RBACEngine = class {
|
|
|
1021
1242
|
getPermissionForEventRole(role) {
|
|
1022
1243
|
switch (role) {
|
|
1023
1244
|
case "event_admin":
|
|
1024
|
-
return "
|
|
1245
|
+
return "read:event.*";
|
|
1246
|
+
// Will be expanded to all CRUD in collectActiveGrants
|
|
1025
1247
|
case "planner":
|
|
1026
|
-
return "
|
|
1248
|
+
return "read:event.planning";
|
|
1249
|
+
// Will be expanded to all CRUD in collectActiveGrants
|
|
1027
1250
|
case "participant":
|
|
1028
1251
|
return "read:event.*";
|
|
1029
1252
|
case "viewer":
|
|
@@ -1198,9 +1421,9 @@ function setupRBAC(supabase, config) {
|
|
|
1198
1421
|
const logger = getRBACLogger();
|
|
1199
1422
|
const fullConfig = {
|
|
1200
1423
|
supabase,
|
|
1201
|
-
debug:
|
|
1424
|
+
debug: import.meta.env.MODE === "development",
|
|
1202
1425
|
logLevel: "warn",
|
|
1203
|
-
developmentMode:
|
|
1426
|
+
developmentMode: import.meta.env.MODE === "development",
|
|
1204
1427
|
...config
|
|
1205
1428
|
};
|
|
1206
1429
|
createRBACConfig(fullConfig);
|
|
@@ -1346,4 +1569,4 @@ export {
|
|
|
1346
1569
|
invalidateAppCache,
|
|
1347
1570
|
clearCache
|
|
1348
1571
|
};
|
|
1349
|
-
//# sourceMappingURL=chunk-
|
|
1572
|
+
//# sourceMappingURL=chunk-KLPVOPRI.js.map
|