@jmruthers/pace-core 0.5.35 → 0.5.36
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-7H63EFYM.js → DataTable-BC4UXGIK.js} +2 -2
- package/dist/{chunk-Q4U5PCOY.js → chunk-6Z3XT4BB.js} +22 -182
- package/dist/chunk-6Z3XT4BB.js.map +1 -0
- package/dist/{chunk-BRWHKGV2.js → chunk-GEJMGKZW.js} +2 -81
- package/dist/chunk-GEJMGKZW.js.map +1 -0
- package/dist/{chunk-MC5E4ILK.js → chunk-KXXVMXZ7.js} +2 -2
- package/dist/components.js +2 -2
- package/dist/index.js +3 -3
- package/dist/rbac/index.d.ts +1 -1
- package/dist/rbac/index.js +1 -1
- 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 +5 -5
- package/package.json +1 -1
- package/src/components/DataTable/components/DataTableCore.tsx +21 -106
- package/src/rbac/components/PagePermissionGuard.tsx +6 -190
- package/dist/chunk-BRWHKGV2.js.map +0 -1
- package/dist/chunk-Q4U5PCOY.js.map +0 -1
- package/docs/troubleshooting/cake-infinite-rerender-debugging.md +0 -284
- package/docs/troubleshooting/cake-infinite-rerender-summary.md +0 -117
- package/docs/troubleshooting/cake-rerender-diagnostic.js +0 -162
- package/docs/troubleshooting/page-permission-guard-diagnostic.js +0 -129
- package/docs/troubleshooting/page-permission-guard-ui-debugging.md +0 -353
- package/docs/troubleshooting/rbac-critical-fixes-summary.md +0 -260
- /package/dist/{DataTable-7H63EFYM.js.map → DataTable-BC4UXGIK.js.map} +0 -0
- /package/dist/{chunk-MC5E4ILK.js.map → chunk-KXXVMXZ7.js.map} +0 -0
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
useDataTableContext,
|
|
33
33
|
usePluginRegistry,
|
|
34
34
|
useStateManager
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-GEJMGKZW.js";
|
|
36
36
|
import "./chunk-YA77BOZM.js";
|
|
37
37
|
import "./chunk-GWSBHC4J.js";
|
|
38
38
|
import "./chunk-7BNPOCLL.js";
|
|
@@ -97,4 +97,4 @@ export {
|
|
|
97
97
|
usePluginRegistry,
|
|
98
98
|
useStateManager
|
|
99
99
|
};
|
|
100
|
-
//# sourceMappingURL=DataTable-
|
|
100
|
+
//# sourceMappingURL=DataTable-BC4UXGIK.js.map
|
|
@@ -251,7 +251,7 @@ function usePagePermissions() {
|
|
|
251
251
|
import { useMemo as useMemo2, useEffect as useEffect2, useState as useState2, useRef } from "react";
|
|
252
252
|
init_UnifiedAuthProvider();
|
|
253
253
|
init_appNameResolver();
|
|
254
|
-
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
254
|
+
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
255
255
|
var PagePermissionGuardComponent = ({
|
|
256
256
|
pageName,
|
|
257
257
|
operation,
|
|
@@ -267,23 +267,7 @@ var PagePermissionGuardComponent = ({
|
|
|
267
267
|
const instanceId = useMemo2(() => Math.random().toString(36).substr(2, 9), []);
|
|
268
268
|
const renderCountRef = useRef(0);
|
|
269
269
|
renderCountRef.current += 1;
|
|
270
|
-
console.log(`[PagePermissionGuard] RENDER #${renderCountRef.current} for ${pageName}:${operation}`, {
|
|
271
|
-
instanceId,
|
|
272
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
273
|
-
});
|
|
274
|
-
useEffect2(() => {
|
|
275
|
-
console.log(`[PagePermissionGuard] MOUNTED: ${pageName}:${operation}`, { instanceId });
|
|
276
|
-
return () => {
|
|
277
|
-
console.log(`[PagePermissionGuard] UNMOUNTED: ${pageName}:${operation}`, { instanceId });
|
|
278
|
-
};
|
|
279
|
-
}, [pageName, operation, instanceId]);
|
|
280
270
|
const { user, selectedOrganisationId, selectedEventId, supabase } = useUnifiedAuth();
|
|
281
|
-
console.log("[PagePermissionGuard] useUnifiedAuth values:", {
|
|
282
|
-
selectedOrganisationId,
|
|
283
|
-
selectedEventId,
|
|
284
|
-
hasUser: !!user,
|
|
285
|
-
userId: user?.id
|
|
286
|
-
});
|
|
287
271
|
const [hasChecked, setHasChecked] = useState2(false);
|
|
288
272
|
const [checkError, setCheckError] = useState2(null);
|
|
289
273
|
const [resolvedScope, setResolvedScope] = useState2(null);
|
|
@@ -323,7 +307,6 @@ var PagePermissionGuardComponent = ({
|
|
|
323
307
|
const appName = getCurrentAppName();
|
|
324
308
|
if (appName) {
|
|
325
309
|
try {
|
|
326
|
-
console.log("[PagePermissionGuard] Resolving app name to ID:", appName);
|
|
327
310
|
const { data: app, error: error2 } = await supabaseRef.current.from("rbac_apps").select("id, name, is_active").eq("name", appName).eq("is_active", true).single();
|
|
328
311
|
if (error2) {
|
|
329
312
|
console.error("[PagePermissionGuard] Database error resolving app ID:", error2);
|
|
@@ -335,7 +318,6 @@ var PagePermissionGuardComponent = ({
|
|
|
335
318
|
}
|
|
336
319
|
} else if (app) {
|
|
337
320
|
appId = app.id;
|
|
338
|
-
console.log("[PagePermissionGuard] Successfully resolved app ID:", app.id);
|
|
339
321
|
} else {
|
|
340
322
|
console.error("[PagePermissionGuard] No app data returned for:", appName);
|
|
341
323
|
}
|
|
@@ -371,7 +353,6 @@ var PagePermissionGuardComponent = ({
|
|
|
371
353
|
eventId: selectedEventId,
|
|
372
354
|
appId
|
|
373
355
|
};
|
|
374
|
-
console.log("[PagePermissionGuard] Setting resolved scope:", resolvedScope2);
|
|
375
356
|
setResolvedScope(resolvedScope2);
|
|
376
357
|
setCheckError(null);
|
|
377
358
|
return;
|
|
@@ -401,7 +382,6 @@ var PagePermissionGuardComponent = ({
|
|
|
401
382
|
eventId: selectedEventId || void 0,
|
|
402
383
|
appId
|
|
403
384
|
};
|
|
404
|
-
console.log("[PagePermissionGuard] Setting resolved scope (org only):", resolvedScope2);
|
|
405
385
|
setResolvedScope(resolvedScope2);
|
|
406
386
|
setCheckError(null);
|
|
407
387
|
return;
|
|
@@ -443,19 +423,6 @@ var PagePermissionGuardComponent = ({
|
|
|
443
423
|
const permission = useMemo2(() => {
|
|
444
424
|
return `${operation}:page.${pageName}`;
|
|
445
425
|
}, [operation, pageName]);
|
|
446
|
-
console.log("[PagePermissionGuard] useCan parameters:", {
|
|
447
|
-
userId: user?.id || "",
|
|
448
|
-
stableScope,
|
|
449
|
-
permission,
|
|
450
|
-
effectivePageId,
|
|
451
|
-
useCache: true
|
|
452
|
-
});
|
|
453
|
-
console.log("[PagePermissionGuard] stableScope details:");
|
|
454
|
-
console.log(" organisationId:", stableScope?.organisationId);
|
|
455
|
-
console.log(" eventId:", stableScope?.eventId);
|
|
456
|
-
console.log(" appId:", stableScope?.appId);
|
|
457
|
-
console.log(" stableScope type:", typeof stableScope);
|
|
458
|
-
console.log(" stableScope keys:", stableScope ? Object.keys(stableScope) : "null");
|
|
459
426
|
const { can, isLoading: canIsLoading, error: canError } = useCan(
|
|
460
427
|
user?.id || "",
|
|
461
428
|
stableScope,
|
|
@@ -464,16 +431,6 @@ var PagePermissionGuardComponent = ({
|
|
|
464
431
|
true
|
|
465
432
|
// Use cache
|
|
466
433
|
);
|
|
467
|
-
console.log(`[PagePermissionGuard] useCan result for ${pageName}:${operation}`, {
|
|
468
|
-
instanceId,
|
|
469
|
-
can,
|
|
470
|
-
canIsLoading,
|
|
471
|
-
canError: !!canError,
|
|
472
|
-
userId: user?.id,
|
|
473
|
-
stableScope,
|
|
474
|
-
permission,
|
|
475
|
-
effectivePageId
|
|
476
|
-
});
|
|
477
434
|
const isLoading = !resolvedScope || canIsLoading;
|
|
478
435
|
const error = checkError || canError;
|
|
479
436
|
useEffect2(() => {
|
|
@@ -518,136 +475,19 @@ var PagePermissionGuardComponent = ({
|
|
|
518
475
|
const shouldShowContent = isPermissionCheckComplete && hasValidScope && hasValidUser && !checkError && can;
|
|
519
476
|
const scopeKey = resolvedScope ? `${resolvedScope.organisationId}-${resolvedScope.eventId}-${resolvedScope.appId}` : "no-scope";
|
|
520
477
|
const permissionKey = `${scopeKey}-${can}-${isLoading}-${!!checkError}-${hasChecked}`;
|
|
521
|
-
useEffect2(() => {
|
|
522
|
-
console.log("[PagePermissionGuard] State transition:", {
|
|
523
|
-
instanceId,
|
|
524
|
-
isLoading,
|
|
525
|
-
hasChecked,
|
|
526
|
-
resolvedScope: !!resolvedScope,
|
|
527
|
-
checkError: !!checkError,
|
|
528
|
-
can,
|
|
529
|
-
shouldShowAccessDenied,
|
|
530
|
-
shouldShowContent,
|
|
531
|
-
permissionKey
|
|
532
|
-
});
|
|
533
|
-
}, [isLoading, hasChecked, resolvedScope, checkError, can, shouldShowAccessDenied, shouldShowContent, permissionKey, instanceId]);
|
|
534
|
-
const renderDecision = {
|
|
535
|
-
instanceId,
|
|
536
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
537
|
-
renderCount: renderCountRef.current,
|
|
538
|
-
// State values
|
|
539
|
-
isLoading,
|
|
540
|
-
hasValidScope,
|
|
541
|
-
hasValidUser,
|
|
542
|
-
hasChecked,
|
|
543
|
-
checkError: !!checkError,
|
|
544
|
-
can,
|
|
545
|
-
// Calculated values
|
|
546
|
-
shouldShowAccessDenied,
|
|
547
|
-
shouldShowContent,
|
|
548
|
-
// Render conditions
|
|
549
|
-
willShowLoading: isLoading || !hasValidScope || !hasValidUser || !hasChecked,
|
|
550
|
-
willShowError: checkError && !can,
|
|
551
|
-
willShowDenied: shouldShowAccessDenied,
|
|
552
|
-
willShowContent: shouldShowContent,
|
|
553
|
-
// Raw data for debugging
|
|
554
|
-
resolvedScope: resolvedScope ? {
|
|
555
|
-
organisationId: resolvedScope.organisationId,
|
|
556
|
-
eventId: resolvedScope.eventId,
|
|
557
|
-
appId: resolvedScope.appId
|
|
558
|
-
} : null,
|
|
559
|
-
user: user ? { id: user.id, email: user.email } : null
|
|
560
|
-
};
|
|
561
|
-
console.log("[PagePermissionGuard] RENDER DECISION:", renderDecision);
|
|
562
|
-
if (can && !shouldShowContent) {
|
|
563
|
-
console.error("[PagePermissionGuard] CRITICAL BUG DETECTED: Has permission but shouldShowContent is false!", {
|
|
564
|
-
...renderDecision,
|
|
565
|
-
bug: "PERMISSION_GRANTED_BUT_CONTENT_NOT_SHOWING"
|
|
566
|
-
});
|
|
567
|
-
}
|
|
568
|
-
if (shouldShowContent && !(isLoading || !hasValidScope || !hasValidUser || !hasChecked) && !(checkError && !can) && !shouldShowAccessDenied) {
|
|
569
|
-
console.log("[PagePermissionGuard] SHOULD RENDER CONTENT - This is the correct path!", {
|
|
570
|
-
...renderDecision,
|
|
571
|
-
status: "CONTENT_SHOULD_BE_RENDERED"
|
|
572
|
-
});
|
|
573
|
-
}
|
|
574
478
|
if (isLoading || !hasValidScope || !hasValidUser || !hasChecked) {
|
|
575
|
-
|
|
576
|
-
return /* @__PURE__ */ jsxs("div", { style: { border: "3px solid orange", padding: "5px", backgroundColor: "lightyellow" }, children: [
|
|
577
|
-
/* @__PURE__ */ jsx2("div", { style: { color: "orange", fontWeight: "bold" }, children: "\u{1F504} LOADING STATE" }),
|
|
578
|
-
loading
|
|
579
|
-
] }, `loading-${permissionKey}`);
|
|
479
|
+
return loading || /* @__PURE__ */ jsx2("div", { children: "Checking permissions..." });
|
|
580
480
|
}
|
|
581
481
|
if (checkError && !can) {
|
|
582
|
-
|
|
583
|
-
return /* @__PURE__ */ jsxs("div", { style: { border: "3px solid red", padding: "5px", backgroundColor: "lightcoral" }, children: [
|
|
584
|
-
/* @__PURE__ */ jsx2("div", { style: { color: "red", fontWeight: "bold" }, children: "\u274C ERROR STATE" }),
|
|
585
|
-
fallback
|
|
586
|
-
] }, `error-${permissionKey}`);
|
|
482
|
+
return fallback;
|
|
587
483
|
}
|
|
588
484
|
if (shouldShowAccessDenied) {
|
|
589
|
-
|
|
590
|
-
return /* @__PURE__ */ jsxs("div", { style: { border: "3px solid red", padding: "5px", backgroundColor: "lightcoral" }, children: [
|
|
591
|
-
/* @__PURE__ */ jsx2("div", { style: { color: "red", fontWeight: "bold" }, children: "\u{1F6AB} ACCESS DENIED STATE" }),
|
|
592
|
-
fallback
|
|
593
|
-
] }, `denied-${permissionKey}`);
|
|
485
|
+
return fallback;
|
|
594
486
|
}
|
|
595
487
|
if (shouldShowContent) {
|
|
596
|
-
|
|
597
|
-
console.log("[PagePermissionGuard] CONTENT RENDER SUCCESS - This should fix the Access Denied issue!");
|
|
598
|
-
const forceRenderContent = /* @__PURE__ */ jsxs(
|
|
599
|
-
"div",
|
|
600
|
-
{
|
|
601
|
-
style: {
|
|
602
|
-
border: "5px solid red",
|
|
603
|
-
padding: "10px",
|
|
604
|
-
margin: "10px",
|
|
605
|
-
backgroundColor: "yellow",
|
|
606
|
-
position: "relative",
|
|
607
|
-
zIndex: 9999
|
|
608
|
-
},
|
|
609
|
-
children: [
|
|
610
|
-
/* @__PURE__ */ jsx2("div", { style: {
|
|
611
|
-
background: "red",
|
|
612
|
-
color: "white",
|
|
613
|
-
padding: "10px",
|
|
614
|
-
fontSize: "16px",
|
|
615
|
-
fontWeight: "bold",
|
|
616
|
-
marginBottom: "10px",
|
|
617
|
-
textAlign: "center"
|
|
618
|
-
}, children: "\u{1F6A8} FORCE RENDER: PagePermissionGuard Content is ACTUALLY RENDERING! \u{1F6A8}" }),
|
|
619
|
-
/* @__PURE__ */ jsx2("div", { style: {
|
|
620
|
-
background: "lightgreen",
|
|
621
|
-
padding: "5px",
|
|
622
|
-
fontSize: "14px",
|
|
623
|
-
marginBottom: "10px",
|
|
624
|
-
border: "2px solid green"
|
|
625
|
-
}, children: "\u2705 This proves the PagePermissionGuard is working correctly!" }),
|
|
626
|
-
/* @__PURE__ */ jsxs("div", { style: { border: "2px solid blue", padding: "5px" }, children: [
|
|
627
|
-
/* @__PURE__ */ jsx2("strong", { children: "Original Children:" }),
|
|
628
|
-
children
|
|
629
|
-
] })
|
|
630
|
-
]
|
|
631
|
-
},
|
|
632
|
-
`content-${permissionKey}`
|
|
633
|
-
);
|
|
634
|
-
console.log("[PagePermissionGuard] RETURNING FORCE RENDER CONTENT");
|
|
635
|
-
return forceRenderContent;
|
|
488
|
+
return /* @__PURE__ */ jsx2(Fragment, { children });
|
|
636
489
|
}
|
|
637
|
-
|
|
638
|
-
instanceId,
|
|
639
|
-
isLoading,
|
|
640
|
-
hasValidScope,
|
|
641
|
-
hasValidUser,
|
|
642
|
-
hasChecked,
|
|
643
|
-
checkError: !!checkError,
|
|
644
|
-
can,
|
|
645
|
-
shouldShowAccessDenied,
|
|
646
|
-
shouldShowContent,
|
|
647
|
-
resolvedScope,
|
|
648
|
-
user: user ? { id: user.id, email: user.email } : null
|
|
649
|
-
});
|
|
650
|
-
return /* @__PURE__ */ jsx2("div", { children: loading }, `fallback-${permissionKey}`);
|
|
490
|
+
return fallback;
|
|
651
491
|
};
|
|
652
492
|
function DefaultAccessDenied() {
|
|
653
493
|
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center min-h-[200px] p-8 text-center", children: [
|
|
@@ -794,7 +634,7 @@ function useSecureData() {
|
|
|
794
634
|
// src/rbac/components/PermissionEnforcer.tsx
|
|
795
635
|
import { useMemo as useMemo4, useEffect as useEffect4, useState as useState4 } from "react";
|
|
796
636
|
init_UnifiedAuthProvider();
|
|
797
|
-
import { Fragment, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
637
|
+
import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
798
638
|
function PermissionEnforcer({
|
|
799
639
|
permissions,
|
|
800
640
|
operation,
|
|
@@ -902,16 +742,16 @@ function PermissionEnforcer({
|
|
|
902
742
|
}
|
|
903
743
|
}, [strictMode, hasChecked, isLoading, hasRequiredPermissions, permissions, operation, user?.id, resolvedScope, requireAll]);
|
|
904
744
|
if (isLoading || !hasChecked) {
|
|
905
|
-
return /* @__PURE__ */ jsx4(
|
|
745
|
+
return /* @__PURE__ */ jsx4(Fragment2, { children: loading });
|
|
906
746
|
}
|
|
907
747
|
if (checkError) {
|
|
908
748
|
console.error(`[PermissionEnforcer] Permission check failed for operation ${operation}:`, checkError);
|
|
909
|
-
return /* @__PURE__ */ jsx4(
|
|
749
|
+
return /* @__PURE__ */ jsx4(Fragment2, { children: fallback });
|
|
910
750
|
}
|
|
911
751
|
if (!hasRequiredPermissions) {
|
|
912
|
-
return /* @__PURE__ */ jsx4(
|
|
752
|
+
return /* @__PURE__ */ jsx4(Fragment2, { children: fallback });
|
|
913
753
|
}
|
|
914
|
-
return /* @__PURE__ */ jsx4(
|
|
754
|
+
return /* @__PURE__ */ jsx4(Fragment2, { children });
|
|
915
755
|
}
|
|
916
756
|
function DefaultAccessDenied2() {
|
|
917
757
|
return /* @__PURE__ */ jsxs2("div", { className: "flex flex-col items-center justify-center min-h-[200px] p-8 text-center", children: [
|
|
@@ -1222,7 +1062,7 @@ function useNavigationPermissions() {
|
|
|
1222
1062
|
// src/rbac/components/NavigationGuard.tsx
|
|
1223
1063
|
import { useMemo as useMemo7, useEffect as useEffect7, useState as useState7 } from "react";
|
|
1224
1064
|
init_UnifiedAuthProvider();
|
|
1225
|
-
import { Fragment as
|
|
1065
|
+
import { Fragment as Fragment3, jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1226
1066
|
function NavigationGuard({
|
|
1227
1067
|
navigationItem,
|
|
1228
1068
|
children,
|
|
@@ -1328,16 +1168,16 @@ function NavigationGuard({
|
|
|
1328
1168
|
}
|
|
1329
1169
|
}, [strictMode, hasChecked, isLoading, hasRequiredPermissions, navigationItem, user?.id, resolvedScope, requireAll]);
|
|
1330
1170
|
if (isLoading || !resolvedScope || !hasChecked) {
|
|
1331
|
-
return /* @__PURE__ */ jsx7(
|
|
1171
|
+
return /* @__PURE__ */ jsx7(Fragment3, { children: loading });
|
|
1332
1172
|
}
|
|
1333
1173
|
if (checkError) {
|
|
1334
1174
|
console.error(`[NavigationGuard] Permission check failed for navigation item ${navigationItem.id}:`, checkError);
|
|
1335
|
-
return /* @__PURE__ */ jsx7(
|
|
1175
|
+
return /* @__PURE__ */ jsx7(Fragment3, { children: fallback });
|
|
1336
1176
|
}
|
|
1337
1177
|
if (!hasRequiredPermissions) {
|
|
1338
|
-
return /* @__PURE__ */ jsx7(
|
|
1178
|
+
return /* @__PURE__ */ jsx7(Fragment3, { children: fallback });
|
|
1339
1179
|
}
|
|
1340
|
-
return /* @__PURE__ */ jsx7(
|
|
1180
|
+
return /* @__PURE__ */ jsx7(Fragment3, { children });
|
|
1341
1181
|
}
|
|
1342
1182
|
function DefaultAccessDenied3() {
|
|
1343
1183
|
return /* @__PURE__ */ jsx7("div", { className: "flex items-center justify-center p-2 text-center", children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center space-x-2", children: [
|
|
@@ -1497,7 +1337,7 @@ init_RBACProvider();
|
|
|
1497
1337
|
|
|
1498
1338
|
// src/rbac/adapters.tsx
|
|
1499
1339
|
import React9, { useContext as useContext5 } from "react";
|
|
1500
|
-
import { Fragment as
|
|
1340
|
+
import { Fragment as Fragment4, jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1501
1341
|
function PermissionGuard({
|
|
1502
1342
|
userId,
|
|
1503
1343
|
scope,
|
|
@@ -1584,7 +1424,7 @@ function PermissionGuard({
|
|
|
1584
1424
|
if (onDenied) {
|
|
1585
1425
|
onDenied();
|
|
1586
1426
|
}
|
|
1587
|
-
return /* @__PURE__ */ jsx9(
|
|
1427
|
+
return /* @__PURE__ */ jsx9(Fragment4, { children: fallback });
|
|
1588
1428
|
}
|
|
1589
1429
|
if (auditLog) {
|
|
1590
1430
|
logger.info(`[PermissionGuard] Permission granted:`, {
|
|
@@ -1595,7 +1435,7 @@ function PermissionGuard({
|
|
|
1595
1435
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
1596
1436
|
});
|
|
1597
1437
|
}
|
|
1598
|
-
return /* @__PURE__ */ jsx9(
|
|
1438
|
+
return /* @__PURE__ */ jsx9(Fragment4, { children });
|
|
1599
1439
|
}
|
|
1600
1440
|
function AccessLevelGuard({
|
|
1601
1441
|
userId,
|
|
@@ -1649,9 +1489,9 @@ function AccessLevelGuard({
|
|
|
1649
1489
|
const userLevelIndex = accessLevel ? levelHierarchy.indexOf(accessLevel) : -1;
|
|
1650
1490
|
const requiredLevelIndex = levelHierarchy.indexOf(minLevel);
|
|
1651
1491
|
if (userLevelIndex < requiredLevelIndex) {
|
|
1652
|
-
return /* @__PURE__ */ jsx9(
|
|
1492
|
+
return /* @__PURE__ */ jsx9(Fragment4, { children: fallback });
|
|
1653
1493
|
}
|
|
1654
|
-
return /* @__PURE__ */ jsx9(
|
|
1494
|
+
return /* @__PURE__ */ jsx9(Fragment4, { children });
|
|
1655
1495
|
}
|
|
1656
1496
|
function withPermissionGuard(config, handler) {
|
|
1657
1497
|
return async (...args) => {
|
|
@@ -2089,4 +1929,4 @@ export {
|
|
|
2089
1929
|
getPermissionsForRole,
|
|
2090
1930
|
ALL_PERMISSIONS
|
|
2091
1931
|
};
|
|
2092
|
-
//# sourceMappingURL=chunk-
|
|
1932
|
+
//# sourceMappingURL=chunk-6Z3XT4BB.js.map
|