@jmruthers/pace-core 0.5.140 → 0.5.142
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 +2 -2
- package/dist/{DataTable-JXFCA2BJ.js → DataTable-SKCX4SCB.js} +6 -6
- package/dist/{EventLogo-rFL_kRjk.d.ts → EventLogo-B3V3otev.d.ts} +307 -1
- package/dist/{UnifiedAuthProvider-XIQQ7LVU.js → UnifiedAuthProvider-BMJAP6Z7.js} +3 -3
- package/dist/{chunk-22WKWKRX.js → chunk-2AKRP5QZ.js} +4 -4
- package/dist/{chunk-4C7EXCAR.js → chunk-CRGFNQ2L.js} +4 -4
- package/dist/{chunk-TLT2ZR3L.js → chunk-E6ZCVF4T.js} +4 -4
- package/dist/{chunk-INQLMHPF.js → chunk-ERGKJX4D.js} +2 -2
- package/dist/{chunk-6LAAY47Q.js → chunk-MSHEVJXS.js} +2 -2
- package/dist/{chunk-MA6EPSGZ.js → chunk-PKW27QVS.js} +2 -2
- package/dist/{chunk-T6JN6LH6.js → chunk-R53TUSFK.js} +3 -3
- package/dist/{chunk-6DXZ6V5Q.js → chunk-SFVL7ZFI.js} +5 -5
- package/dist/{chunk-5JMOHWDI.js → chunk-TUJSIWX6.js} +497 -329
- package/dist/chunk-TUJSIWX6.js.map +1 -0
- package/dist/{chunk-BOOI7GK2.js → chunk-VOJBGZYI.js} +119 -3
- package/dist/chunk-VOJBGZYI.js.map +1 -0
- package/dist/{chunk-YCWDTTUK.js → chunk-WM26XK7I.js} +22 -8
- package/dist/chunk-WM26XK7I.js.map +1 -0
- package/dist/components.d.ts +3 -1
- package/dist/components.js +20 -8
- package/dist/components.js.map +1 -1
- package/dist/hooks.js +7 -7
- package/dist/index.d.ts +4 -2
- package/dist/index.js +25 -11
- package/dist/index.js.map +1 -1
- package/dist/providers.js +2 -2
- package/dist/rbac/index.d.ts +94 -1
- package/dist/rbac/index.js +9 -7
- package/dist/utils.js +1 -1
- package/docs/api/README.md +2 -2
- package/docs/api/classes/ColumnFactory.md +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/classes/StorageUtils.md +1 -1
- package/docs/api/enums/FileCategory.md +1 -1
- package/docs/api/interfaces/AggregateConfig.md +1 -1
- package/docs/api/interfaces/BadgeProps.md +1 -1
- package/docs/api/interfaces/ButtonProps.md +1 -1
- package/docs/api/interfaces/CalendarProps.md +40 -0
- 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/DataRecord.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/EventAppRoleData.md +1 -1
- package/docs/api/interfaces/EventLogoProps.md +1 -1
- package/docs/api/interfaces/ExportColumn.md +1 -1
- package/docs/api/interfaces/ExportOptions.md +1 -1
- package/docs/api/interfaces/FileDisplayProps.md +1 -1
- package/docs/api/interfaces/FileMetadata.md +1 -1
- package/docs/api/interfaces/FileReference.md +1 -1
- package/docs/api/interfaces/FileSizeLimits.md +1 -1
- package/docs/api/interfaces/FileUploadOptions.md +1 -1
- package/docs/api/interfaces/FileUploadProps.md +1 -1
- package/docs/api/interfaces/FooterProps.md +1 -1
- package/docs/api/interfaces/GrantEventAppRoleParams.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/ProtectedRouteProps.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/RBACLogger.md +1 -1
- package/docs/api/interfaces/ResourcePermissions.md +155 -0
- package/docs/api/interfaces/RevokeEventAppRoleParams.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
- package/docs/api/interfaces/RoleManagementResult.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/SessionRestorationLoaderProps.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/SwitchProps.md +1 -1
- package/docs/api/interfaces/TabsContentProps.md +9 -0
- package/docs/api/interfaces/TabsListProps.md +9 -0
- package/docs/api/interfaces/TabsProps.md +9 -0
- package/docs/api/interfaces/TabsTriggerProps.md +9 -0
- package/docs/api/interfaces/TextareaProps.md +53 -0
- 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/UsePublicEventOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
- package/docs/api/interfaces/UsePublicFileDisplayOptions.md +1 -1
- package/docs/api/interfaces/UsePublicFileDisplayReturn.md +1 -1
- package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
- package/docs/api/interfaces/UseResolvedScopeOptions.md +1 -1
- package/docs/api/interfaces/UseResolvedScopeReturn.md +1 -1
- package/docs/api/interfaces/UseResourcePermissionsOptions.md +34 -0
- 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 +289 -2
- package/docs/rbac/README.md +2 -1
- package/docs/rbac/event-based-apps.md +872 -0
- package/package.json +3 -1
- package/src/components/Calendar/Calendar.test.tsx +338 -0
- package/src/components/Calendar/Calendar.tsx +192 -0
- package/src/components/Calendar/index.ts +10 -0
- package/src/components/Tabs/Tabs.test.tsx +439 -0
- package/src/components/Tabs/Tabs.tsx +202 -0
- package/src/components/Tabs/index.ts +10 -0
- package/src/components/Textarea/Textarea.test.tsx +269 -0
- package/src/components/Textarea/Textarea.tsx +133 -0
- package/src/components/Textarea/index.ts +10 -0
- package/src/components/index.ts +11 -0
- package/src/index.ts +11 -0
- package/src/rbac/hooks/index.ts +2 -0
- package/src/rbac/hooks/useResourcePermissions.test.ts +633 -0
- package/src/rbac/hooks/useResourcePermissions.ts +235 -0
- package/src/services/EventService.ts +29 -8
- package/src/services/__tests__/EventService.test.ts +48 -8
- package/dist/chunk-5JMOHWDI.js.map +0 -1
- package/dist/chunk-BOOI7GK2.js.map +0 -1
- package/dist/chunk-YCWDTTUK.js.map +0 -1
- package/src/rbac/docs/event-based-apps.md +0 -285
- /package/dist/{DataTable-JXFCA2BJ.js.map → DataTable-SKCX4SCB.js.map} +0 -0
- /package/dist/{UnifiedAuthProvider-XIQQ7LVU.js.map → UnifiedAuthProvider-BMJAP6Z7.js.map} +0 -0
- /package/dist/{chunk-22WKWKRX.js.map → chunk-2AKRP5QZ.js.map} +0 -0
- /package/dist/{chunk-4C7EXCAR.js.map → chunk-CRGFNQ2L.js.map} +0 -0
- /package/dist/{chunk-TLT2ZR3L.js.map → chunk-E6ZCVF4T.js.map} +0 -0
- /package/dist/{chunk-INQLMHPF.js.map → chunk-ERGKJX4D.js.map} +0 -0
- /package/dist/{chunk-6LAAY47Q.js.map → chunk-MSHEVJXS.js.map} +0 -0
- /package/dist/{chunk-MA6EPSGZ.js.map → chunk-PKW27QVS.js.map} +0 -0
- /package/dist/{chunk-T6JN6LH6.js.map → chunk-R53TUSFK.js.map} +0 -0
- /package/dist/{chunk-6DXZ6V5Q.js.map → chunk-SFVL7ZFI.js.map} +0 -0
|
@@ -1,285 +0,0 @@
|
|
|
1
|
-
# Event-Based Apps with RBAC
|
|
2
|
-
|
|
3
|
-
This guide explains how to use the RBAC system for event-based applications where the organization context is automatically derived from the event context.
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
Event-based apps are applications that operate within the context of a specific event. Since events inherently belong to an organization, these apps don't need explicit organization context - it is automatically resolved from the event by the RBAC components.
|
|
8
|
-
|
|
9
|
-
## Key Concepts
|
|
10
|
-
|
|
11
|
-
### Automatic Organization Resolution
|
|
12
|
-
The RBAC components automatically resolve the organization from the event context when needed. You only need to provide the `eventId` (and optionally `appId`), and the system handles the rest.
|
|
13
|
-
|
|
14
|
-
```typescript
|
|
15
|
-
// The components automatically resolve organisationId from eventId
|
|
16
|
-
const scope: Scope = {
|
|
17
|
-
eventId: 'event-123',
|
|
18
|
-
appId: 'app-456' // optional
|
|
19
|
-
// organisationId is automatically resolved
|
|
20
|
-
};
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
### Permission Hierarchy
|
|
24
|
-
For event-based apps, the permission hierarchy is:
|
|
25
|
-
1. **Page-level permissions** (most specific)
|
|
26
|
-
2. **Event-app permissions** (event + app specific)
|
|
27
|
-
3. **Organization permissions** (automatically resolved from event)
|
|
28
|
-
4. **Global permissions** (least specific)
|
|
29
|
-
|
|
30
|
-
## Components
|
|
31
|
-
|
|
32
|
-
The same RBAC components work for both organization-based and event-based apps. They automatically detect the context and resolve the organization when needed.
|
|
33
|
-
|
|
34
|
-
### PermissionEnforcer
|
|
35
|
-
Use this component for general permission enforcement in event-based apps:
|
|
36
|
-
|
|
37
|
-
```tsx
|
|
38
|
-
import { PermissionEnforcer } from '@jmruthers/pace-core/rbac';
|
|
39
|
-
|
|
40
|
-
function EventDashboard() {
|
|
41
|
-
return (
|
|
42
|
-
<PermissionEnforcer
|
|
43
|
-
permissions={['read:events', 'update:participants']}
|
|
44
|
-
operation="dashboard"
|
|
45
|
-
>
|
|
46
|
-
<div>Event Dashboard Content</div>
|
|
47
|
-
</PermissionEnforcer>
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
### PagePermissionGuard
|
|
53
|
-
Use this component for page-level permission enforcement:
|
|
54
|
-
|
|
55
|
-
```tsx
|
|
56
|
-
import { PagePermissionGuard } from '@jmruthers/pace-core/rbac';
|
|
57
|
-
|
|
58
|
-
function EventSettingsPage() {
|
|
59
|
-
return (
|
|
60
|
-
<PagePermissionGuard
|
|
61
|
-
pageName="settings"
|
|
62
|
-
operation="read"
|
|
63
|
-
>
|
|
64
|
-
<div>Event Settings</div>
|
|
65
|
-
</PagePermissionGuard>
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
### NavigationGuard
|
|
71
|
-
Use this component for navigation-level permission enforcement:
|
|
72
|
-
|
|
73
|
-
```tsx
|
|
74
|
-
import { NavigationGuard } from '@jmruthers/pace-core/rbac';
|
|
75
|
-
|
|
76
|
-
const navigationItems = [
|
|
77
|
-
{
|
|
78
|
-
id: 'dashboard',
|
|
79
|
-
name: 'Dashboard',
|
|
80
|
-
path: '/event/dashboard',
|
|
81
|
-
permissions: ['read:events']
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
id: 'settings',
|
|
85
|
-
name: 'Settings',
|
|
86
|
-
path: '/event/settings',
|
|
87
|
-
permissions: ['update:events']
|
|
88
|
-
}
|
|
89
|
-
];
|
|
90
|
-
|
|
91
|
-
function EventNavigation() {
|
|
92
|
-
return (
|
|
93
|
-
<nav>
|
|
94
|
-
{navigationItems.map(item => (
|
|
95
|
-
<NavigationGuard
|
|
96
|
-
key={item.id}
|
|
97
|
-
navigationItem={item}
|
|
98
|
-
>
|
|
99
|
-
<Link to={item.path}>{item.name}</Link>
|
|
100
|
-
</NavigationGuard>
|
|
101
|
-
))}
|
|
102
|
-
</nav>
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
## Hooks
|
|
108
|
-
|
|
109
|
-
### useCan with Event Context
|
|
110
|
-
You can use the standard `useCan` hook with event-based scopes:
|
|
111
|
-
|
|
112
|
-
```tsx
|
|
113
|
-
import { useCan } from '@jmruthers/pace-core/rbac';
|
|
114
|
-
|
|
115
|
-
function EventComponent() {
|
|
116
|
-
const { selectedEventId } = useUnifiedAuth();
|
|
117
|
-
|
|
118
|
-
const { can: canManageEvents } = useCan(
|
|
119
|
-
userId,
|
|
120
|
-
{ eventId: selectedEventId },
|
|
121
|
-
'update:events'
|
|
122
|
-
);
|
|
123
|
-
|
|
124
|
-
return (
|
|
125
|
-
<div>
|
|
126
|
-
{canManageEvents && (
|
|
127
|
-
<button>Manage Event</button>
|
|
128
|
-
)}
|
|
129
|
-
</div>
|
|
130
|
-
);
|
|
131
|
-
}
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
## Setup
|
|
135
|
-
|
|
136
|
-
### 1. Event Context Provider
|
|
137
|
-
Ensure your app has event context available:
|
|
138
|
-
|
|
139
|
-
```tsx
|
|
140
|
-
import { UnifiedAuthProvider } from '@jmruthers/pace-core';
|
|
141
|
-
|
|
142
|
-
function App() {
|
|
143
|
-
return (
|
|
144
|
-
<UnifiedAuthProvider>
|
|
145
|
-
{/* Your event-based app components */}
|
|
146
|
-
</UnifiedAuthProvider>
|
|
147
|
-
);
|
|
148
|
-
}
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
### 2. Event Selection
|
|
152
|
-
Make sure the event is selected in the auth context:
|
|
153
|
-
|
|
154
|
-
```tsx
|
|
155
|
-
import { useUnifiedAuth } from '@jmruthers/pace-core';
|
|
156
|
-
|
|
157
|
-
function EventSelector() {
|
|
158
|
-
const { setSelectedEventId } = useUnifiedAuth();
|
|
159
|
-
|
|
160
|
-
const handleEventSelect = (eventId: string) => {
|
|
161
|
-
setSelectedEventId(eventId);
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
return (
|
|
165
|
-
<select onChange={(e) => handleEventSelect(e.target.value)}>
|
|
166
|
-
<option value="event-1">Event 1</option>
|
|
167
|
-
<option value="event-2">Event 2</option>
|
|
168
|
-
</select>
|
|
169
|
-
);
|
|
170
|
-
}
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
## Permission Types
|
|
174
|
-
|
|
175
|
-
### Event-App Permissions
|
|
176
|
-
These permissions are specific to an event and app combination:
|
|
177
|
-
|
|
178
|
-
```typescript
|
|
179
|
-
const EVENT_APP_PERMISSIONS = {
|
|
180
|
-
// Event management
|
|
181
|
-
MANAGE_EVENT: 'update:event',
|
|
182
|
-
READ_EVENT: 'read:event',
|
|
183
|
-
UPDATE_EVENT: 'update:event',
|
|
184
|
-
|
|
185
|
-
// Participant management
|
|
186
|
-
MANAGE_PARTICIPANTS: 'update:participants',
|
|
187
|
-
READ_PARTICIPANTS: 'read:participants',
|
|
188
|
-
CREATE_PARTICIPANTS: 'create:participants',
|
|
189
|
-
UPDATE_PARTICIPANTS: 'update:participants',
|
|
190
|
-
DELETE_PARTICIPANTS: 'delete:participants',
|
|
191
|
-
|
|
192
|
-
// App-specific permissions
|
|
193
|
-
MANAGE_APP: 'update:app',
|
|
194
|
-
READ_APP: 'read:app',
|
|
195
|
-
UPDATE_APP: 'update:app',
|
|
196
|
-
};
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
### Page Permissions
|
|
200
|
-
Page permissions are specific to individual pages within an event app:
|
|
201
|
-
|
|
202
|
-
```typescript
|
|
203
|
-
const PAGE_PERMISSIONS = {
|
|
204
|
-
DASHBOARD_READ: 'read:page.dashboard',
|
|
205
|
-
DASHBOARD_WRITE: 'write:page.dashboard',
|
|
206
|
-
SETTINGS_READ: 'read:page.settings',
|
|
207
|
-
SETTINGS_WRITE: 'write:page.settings',
|
|
208
|
-
PARTICIPANTS_READ: 'read:page.participants',
|
|
209
|
-
PARTICIPANTS_WRITE: 'write:page.participants',
|
|
210
|
-
};
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
## Best Practices
|
|
214
|
-
|
|
215
|
-
### 1. Use Event-Based Components
|
|
216
|
-
Always use the event-based components (`EventPermissionEnforcer`, `EventPagePermissionGuard`, `EventNavigationGuard`) instead of the organization-based ones for event apps.
|
|
217
|
-
|
|
218
|
-
### 2. Provide Explicit Scopes
|
|
219
|
-
When possible, provide explicit scopes to avoid context resolution overhead:
|
|
220
|
-
|
|
221
|
-
```tsx
|
|
222
|
-
<EventPermissionEnforcer
|
|
223
|
-
scope={{ eventId: 'event-123', appId: 'app-456' }}
|
|
224
|
-
permissions={['read:events']}
|
|
225
|
-
>
|
|
226
|
-
<div>Content</div>
|
|
227
|
-
</EventPermissionEnforcer>
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
### 3. Handle Loading States
|
|
231
|
-
Event-based components automatically handle loading states while resolving the organization from the event:
|
|
232
|
-
|
|
233
|
-
```tsx
|
|
234
|
-
<EventPermissionEnforcer
|
|
235
|
-
permissions={['read:events']}
|
|
236
|
-
loading={<div>Loading permissions...</div>}
|
|
237
|
-
>
|
|
238
|
-
<div>Content</div>
|
|
239
|
-
</EventPermissionEnforcer>
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
### 4. Error Handling
|
|
243
|
-
Handle cases where the organization cannot be resolved from the event:
|
|
244
|
-
|
|
245
|
-
```tsx
|
|
246
|
-
<EventPermissionEnforcer
|
|
247
|
-
permissions={['read:events']}
|
|
248
|
-
onDenied={(permission, reason) => {
|
|
249
|
-
console.error(`Permission denied: ${permission}, reason: ${reason}`);
|
|
250
|
-
}}
|
|
251
|
-
>
|
|
252
|
-
<div>Content</div>
|
|
253
|
-
</EventPermissionEnforcer>
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
## Migration from Organization-Based Apps
|
|
257
|
-
|
|
258
|
-
If you're migrating from organization-based apps to event-based apps:
|
|
259
|
-
|
|
260
|
-
1. Replace `PermissionEnforcer` with `EventPermissionEnforcer`
|
|
261
|
-
2. Replace `PagePermissionGuard` with `EventPagePermissionGuard`
|
|
262
|
-
3. Replace `NavigationGuard` with `EventNavigationGuard`
|
|
263
|
-
4. Remove explicit organization context from your components
|
|
264
|
-
5. Ensure event context is available in your app
|
|
265
|
-
|
|
266
|
-
## Troubleshooting
|
|
267
|
-
|
|
268
|
-
### Common Issues
|
|
269
|
-
|
|
270
|
-
1. **"Event context is required" error**: Make sure `selectedEventId` is set in the auth context
|
|
271
|
-
2. **"Could not resolve organization from event context" error**: Verify the event exists and has a valid `organisation_id`
|
|
272
|
-
3. **Permission checks failing**: Ensure the user has the appropriate event-app roles assigned
|
|
273
|
-
|
|
274
|
-
### Debug Mode
|
|
275
|
-
|
|
276
|
-
Enable debug mode to see detailed permission resolution:
|
|
277
|
-
|
|
278
|
-
```typescript
|
|
279
|
-
import { createRBACConfig } from '@jmruthers/pace-core/rbac';
|
|
280
|
-
|
|
281
|
-
const config = createRBACConfig({
|
|
282
|
-
debug: true,
|
|
283
|
-
logLevel: 'debug'
|
|
284
|
-
});
|
|
285
|
-
```
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|