@jmruthers/pace-core 0.5.28 → 0.5.30
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-K6ZB56JF.js → DataTable-B3QAKJN2.js} +2 -2
- package/dist/{chunk-FHSK2UES.js → chunk-4MGZ5E3J.js} +33 -10
- package/dist/chunk-4MGZ5E3J.js.map +1 -0
- package/dist/{chunk-M3UUEWLR.js → chunk-VLWG2SIU.js} +2 -2
- 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 +44 -11
- package/dist/chunk-FHSK2UES.js.map +0 -1
- /package/dist/{DataTable-K6ZB56JF.js.map → DataTable-B3QAKJN2.js.map} +0 -0
- /package/dist/{chunk-M3UUEWLR.js.map → chunk-VLWG2SIU.js.map} +0 -0
package/docs/api/modules.md
CHANGED
package/package.json
CHANGED
|
@@ -343,6 +343,38 @@ function DataTableInternal<TData extends DataRecord>({
|
|
|
343
343
|
// Create scope the same way as PagePermissionGuard - with event-based resolution
|
|
344
344
|
const [resolvedScope, setResolvedScope] = useState<Scope | null>(null);
|
|
345
345
|
|
|
346
|
+
// Use a ref to store the stable scope and only update it when it actually changes (SAME AS PagePermissionGuard)
|
|
347
|
+
const stableScopeRef = useRef<{ organisationId: string; appId: string; eventId: string | undefined }>({
|
|
348
|
+
organisationId: '',
|
|
349
|
+
appId: '',
|
|
350
|
+
eventId: undefined
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
// Only update the stable scope if the resolved scope has actually changed
|
|
354
|
+
if (resolvedScope && resolvedScope.organisationId) {
|
|
355
|
+
const newScope = {
|
|
356
|
+
organisationId: resolvedScope.organisationId,
|
|
357
|
+
appId: resolvedScope.appId,
|
|
358
|
+
eventId: resolvedScope.eventId
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
// Only update if the scope has actually changed
|
|
362
|
+
if (stableScopeRef.current.organisationId !== newScope.organisationId ||
|
|
363
|
+
stableScopeRef.current.eventId !== newScope.eventId ||
|
|
364
|
+
stableScopeRef.current.appId !== newScope.appId) {
|
|
365
|
+
stableScopeRef.current = {
|
|
366
|
+
organisationId: newScope.organisationId,
|
|
367
|
+
appId: newScope.appId || '',
|
|
368
|
+
eventId: newScope.eventId
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
} else if (!resolvedScope) {
|
|
372
|
+
// Reset to empty scope when no resolved scope
|
|
373
|
+
stableScopeRef.current = { organisationId: '', appId: '', eventId: undefined };
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
const stableScope = stableScopeRef.current;
|
|
377
|
+
|
|
346
378
|
useEffect(() => {
|
|
347
379
|
const resolveScope = async () => {
|
|
348
380
|
// If we have both organisation and event, use them directly
|
|
@@ -392,12 +424,12 @@ function DataTableInternal<TData extends DataRecord>({
|
|
|
392
424
|
}, [selectedOrganisationId, selectedEventId, supabase]);
|
|
393
425
|
|
|
394
426
|
const permissions = {
|
|
395
|
-
canRead: useCan(user?.id || '',
|
|
396
|
-
canCreate: useCan(user?.id || '',
|
|
397
|
-
canUpdate: useCan(user?.id || '',
|
|
398
|
-
canDelete: useCan(user?.id || '',
|
|
399
|
-
canExport: useCan(user?.id || '',
|
|
400
|
-
canImport: useCan(user?.id || '',
|
|
427
|
+
canRead: useCan(user?.id || '', stableScope, `read:page.${effectivePageId}` as any, effectivePageId),
|
|
428
|
+
canCreate: useCan(user?.id || '', stableScope, `create:page.${effectivePageId}` as any, effectivePageId),
|
|
429
|
+
canUpdate: useCan(user?.id || '', stableScope, `update:page.${effectivePageId}` as any, effectivePageId),
|
|
430
|
+
canDelete: useCan(user?.id || '', stableScope, `delete:page.${effectivePageId}` as any, effectivePageId),
|
|
431
|
+
canExport: useCan(user?.id || '', stableScope, `manage:page.${effectivePageId}` as any, effectivePageId), // Using manage for export/import
|
|
432
|
+
canImport: useCan(user?.id || '', stableScope, `manage:page.${effectivePageId}` as any, effectivePageId), // Using manage for export/import
|
|
401
433
|
};
|
|
402
434
|
|
|
403
435
|
// ============================================================================
|
|
@@ -853,11 +885,12 @@ function DataTableInternal<TData extends DataRecord>({
|
|
|
853
885
|
console.log(' error:', permissions.canRead.error);
|
|
854
886
|
console.log(' refetch type:', typeof permissions.canRead.refetch);
|
|
855
887
|
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
888
|
+
console.log('[DataTable] RBAC DEBUG - Scope (FIXED):');
|
|
889
|
+
console.log(' resolvedScope:', resolvedScope);
|
|
890
|
+
console.log(' stableScope:', stableScope);
|
|
891
|
+
console.log(' organisationId:', stableScope?.organisationId);
|
|
892
|
+
console.log(' eventId:', stableScope?.eventId);
|
|
893
|
+
console.log(' appId:', stableScope?.appId);
|
|
861
894
|
|
|
862
895
|
if (!permissions.canRead.can) {
|
|
863
896
|
console.error('[DataTable] ACCESS DENIED - DataTable RBAC failing!');
|