@jmruthers/pace-core 0.5.5 → 0.5.6
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/dist/{DataTable-3SSI644S.js → DataTable-BEMN72L5.js} +2 -2
- package/dist/{chunk-RTCA5ZNK.js → chunk-4EIBJ6DF.js} +2 -2
- package/dist/{chunk-2BJFM2JC.js → chunk-SFGUMWEE.js} +19 -19
- package/dist/chunk-SFGUMWEE.js.map +1 -0
- package/dist/components.js +2 -2
- package/dist/index.js +2 -2
- package/dist/utils.js +1 -1
- 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 +1 -1
- package/docs/api/classes/PublicErrorBoundary.md +1 -1
- package/docs/api/classes/RBACAuditManager.md +1 -1
- package/docs/api/classes/RBACCache.md +1 -1
- package/docs/api/classes/RBACEngine.md +1 -1
- 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/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 +1 -1
- 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 +1 -1
- 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 +1 -1
- package/docs/api/interfaces/RouteConfig.md +1 -1
- 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 +2 -2
- package/package.json +1 -1
- package/src/components/DataTable/components/DataTableCore.tsx +29 -25
- package/dist/chunk-2BJFM2JC.js.map +0 -1
- /package/dist/{DataTable-3SSI644S.js.map → DataTable-BEMN72L5.js.map} +0 -0
- /package/dist/{chunk-RTCA5ZNK.js.map → chunk-4EIBJ6DF.js.map} +0 -0
package/docs/api/modules.md
CHANGED
package/package.json
CHANGED
|
@@ -536,31 +536,11 @@ function DataTableInternal<TData extends DataRecord>({
|
|
|
536
536
|
}, [cleanup]);
|
|
537
537
|
|
|
538
538
|
// ============================================================================
|
|
539
|
-
// RBAC VALIDATION AND
|
|
539
|
+
// RBAC VALIDATION AND SECURE CONFIGURATION - ALWAYS call these hooks
|
|
540
540
|
// ============================================================================
|
|
541
541
|
|
|
542
|
-
// MANDATORY: Every DataTable must have a user and RBAC config
|
|
543
|
-
if (!user) {
|
|
544
|
-
throw new Error('DataTable requires authenticated user for RBAC');
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
if (!rbac?.resource) {
|
|
548
|
-
throw new Error('DataTable requires rbac.resource for permission checking');
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
const scope = {
|
|
552
|
-
organisationId: user?.user_metadata?.organisationId || user?.app_metadata?.organisationId,
|
|
553
|
-
eventId: user?.user_metadata?.eventId || user?.app_metadata?.eventId,
|
|
554
|
-
appId: user?.user_metadata?.appId || user?.app_metadata?.appId,
|
|
555
|
-
};
|
|
556
|
-
|
|
557
|
-
// MANDATORY: No data access without read permission
|
|
558
|
-
if (!permissions.canRead.can) {
|
|
559
|
-
return <AccessDeniedPage resource={rbac?.resource || 'test-resource'} operation="read" />;
|
|
560
|
-
}
|
|
561
|
-
|
|
562
542
|
// MANDATORY: Features are automatically filtered by permissions
|
|
563
|
-
const secureFeatures: DataTableFeatureConfig = {
|
|
543
|
+
const secureFeatures: DataTableFeatureConfig = useMemo(() => ({
|
|
564
544
|
...features,
|
|
565
545
|
creation: features.creation && permissions.canCreate.can,
|
|
566
546
|
editing: features.editing && permissions.canUpdate.can,
|
|
@@ -568,17 +548,17 @@ function DataTableInternal<TData extends DataRecord>({
|
|
|
568
548
|
deleteSelected: features.deleteSelected && permissions.canDelete.can,
|
|
569
549
|
export: features.export && permissions.canExport.can,
|
|
570
550
|
import: features.import && permissions.canImport.can,
|
|
571
|
-
};
|
|
551
|
+
}), [features, permissions.canCreate.can, permissions.canUpdate.can, permissions.canDelete.can, permissions.canExport.can, permissions.canImport.can]);
|
|
572
552
|
|
|
573
553
|
// MANDATORY: Handlers are automatically secured
|
|
574
|
-
const secureHandlers = {
|
|
554
|
+
const secureHandlers = useMemo(() => ({
|
|
575
555
|
onEditRow: permissions.canUpdate.can ? onEditRow : undefined,
|
|
576
556
|
onDeleteRow: permissions.canDelete.can ? onDeleteRow : undefined,
|
|
577
557
|
onCreateRow: permissions.canCreate.can ? onCreateRow : undefined,
|
|
578
558
|
onImport: permissions.canImport.can ? onImport : undefined,
|
|
579
559
|
onExport: permissions.canExport.can ? onExport : undefined,
|
|
580
560
|
onDeleteSelected: permissions.canDelete.can ? onDeleteSelected : undefined,
|
|
581
|
-
};
|
|
561
|
+
}), [permissions.canUpdate.can, permissions.canDelete.can, permissions.canCreate.can, permissions.canImport.can, permissions.canExport.can, onEditRow, onDeleteRow, onCreateRow, onImport, onExport, onDeleteSelected]);
|
|
582
562
|
|
|
583
563
|
// MANDATORY: Process actions with RBAC checks
|
|
584
564
|
const effectiveActions = useMemo(() => {
|
|
@@ -792,6 +772,30 @@ function DataTableInternal<TData extends DataRecord>({
|
|
|
792
772
|
|
|
793
773
|
const table = useReactTable(tableConfig);
|
|
794
774
|
|
|
775
|
+
// ============================================================================
|
|
776
|
+
// RBAC VALIDATION AND EARLY RETURNS - AFTER ALL HOOKS
|
|
777
|
+
// ============================================================================
|
|
778
|
+
|
|
779
|
+
// MANDATORY: Every DataTable must have a user and RBAC config
|
|
780
|
+
if (!user) {
|
|
781
|
+
throw new Error('DataTable requires authenticated user for RBAC');
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
if (!rbac?.resource) {
|
|
785
|
+
throw new Error('DataTable requires rbac.resource for permission checking');
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
const scope = {
|
|
789
|
+
organisationId: user?.user_metadata?.organisationId || user?.app_metadata?.organisationId,
|
|
790
|
+
eventId: user?.user_metadata?.eventId || user?.app_metadata?.eventId,
|
|
791
|
+
appId: user?.user_metadata?.appId || user?.app_metadata?.appId,
|
|
792
|
+
};
|
|
793
|
+
|
|
794
|
+
// MANDATORY: No data access without read permission
|
|
795
|
+
if (!permissions.canRead.can) {
|
|
796
|
+
return <AccessDeniedPage resource={rbac?.resource || 'test-resource'} operation="read" />;
|
|
797
|
+
}
|
|
798
|
+
|
|
795
799
|
// ============================================================================
|
|
796
800
|
// RENDER
|
|
797
801
|
// ============================================================================
|