rbac-shield 0.2.2 → 0.2.3

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 CHANGED
@@ -2,129 +2,81 @@
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/rbac-shield.svg)](https://www.npmjs.com/package/rbac-shield)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
5
- [![Status](https://img.shields.io/badge/Status-Beta-orange.svg)]()
6
5
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-blue.svg)](https://www.typescriptlang.org/)
7
6
 
8
- > [!WARNING]
9
- > **Public Beta**: Ensuring strict type safety and performance. API is stable but minor breaking changes might occur before v1.0.
10
-
11
7
  **The production-ready, type-safe Role-Based Access Control (RBAC) system for Next.js applications.**
12
8
 
13
9
  Built for modern web development with **React 19**, **TypeScript 5**, and **Next.js App Router** compatibility. RBAC Shield provides a seamless, multi-tenant permission system that supports both **Role-based** and **Permission-based** strategies.
14
10
 
15
11
  ---
16
12
 
17
- ## 📑 Table of Contents
18
-
19
- - [Features](#-features)
20
- - [Quick Setup (CLI)](#-quick-setup-recommended)
21
- - [Manual Installation](#-manual-installation)
22
- - [Quick Start](#-quick-start)
23
- - [Role Management (New)](#-role-management)
24
- - [Guides & Patterns](#-guides--patterns)
25
- - [Roles vs Permissions](#roles-vs-permissions)
26
- - [Complex Logic (AND/OR)](#complex-logic-andor)
27
- - [SSR & Hydration](#ssr--hydration-eliminate-loading-states)
28
- - [Logic Switching (Dynamic APIs)](#logic-switching-dynamic-apis)
29
- - [Server Action Guards](#server-action-guards)
30
- - [API Reference](#-api-reference)
31
- - [Security & Best Practices](#-security--best-practices)
32
- - [Troubleshooting](#-troubleshooting)
33
-
34
- ---
35
-
36
13
  ## ✨ Features
37
14
 
38
- - 🎯 **Type-Safe Permissions**: Typescript "Prettify" helpers ensure tooltips show exact prop shapes, amazing IntelliSense.
39
- - 👑 **First-Class Role Support**: Check for Roles (`admin`), Permissions (`edit:post`), or both simultaneously.
40
- - 🚀 **High Performance**: Optimized with React Context and memoization. Permission checks are < 1ms.
41
- - 🏢 **Multi-Tenant Native**: Switch between multiple organizations/roles instantly without page reloads.
42
- - ⚡ **Zero Loading States**: Support for `initialData` prop allows instant hydration from server-side data.
43
- - 🛡️ **Route Protection**: Declarative client-side guards with automatic handling of loading states and redirects.
44
- - 🌍 **Universal Support**: Works seamlessly in **Client Components**, **Server Components**, and **Middleware**.
45
- - 📦 **Zero Dependencies**: Lightweight (~35KB) and built entirely on standard React APIs.
15
+ - 🎯 **Type-Safe Permissions**: Typescript "Prettify" helpers ensure tooltips show exact prop shapes.
16
+ - 👑 **First-Class Role Support**: Check for **Roles**, **Permissions**, or **Both**.
17
+ - 🚀 **High Performance**: Optimized with React Context and memoization.
18
+ - 🏢 **Multi-Tenant Native**: Switch between organizations/roles instantly.
19
+ - ⚡ **Zero Loading States**: Instant hydration via server-side data injection.
20
+ - 🛡️ **Route Protection**: Declarative guards with auto-redirects.
21
+ - 🌍 **Universal**: Works in Client Components, Server Components, and Middleware.
46
22
 
47
23
  ---
48
24
 
49
- ## 🚀 Quick Setup (Recommended)
25
+ ## 📦 Installation
26
+
27
+ ### Option 1: Interactive CLI (Recommended)
50
28
 
51
- The fastest way to integrate RBAC Shield is with our interactive CLI. It initializes your configuration and handles all boilerplate.
29
+ This will set up your types and configuration file automatically.
52
30
 
53
31
  ```bash
54
32
  npx rbac-shield init
55
33
  ```
56
34
 
57
- The CLI will:
58
-
59
- 1. Detect your project type (Next.js/React, TS/JS)
60
- 2. Help you define your resources (e.g., `projects`) and actions (e.g., `create`)
61
- 3. Generate a clean, type-safe `lib/rbac.ts` file configured for your app
62
-
63
- ---
64
-
65
- ## 📦 Manual Installation
66
-
67
- If you prefer to set things up yourself:
35
+ ### Option 2: Manual Install
68
36
 
69
37
  ```bash
70
38
  npm install rbac-shield
71
39
  # or
72
40
  yarn add rbac-shield
73
- # or
74
- pnpm add rbac-shield
75
- # or
76
- bun add rbac-shield
77
41
  ```
78
42
 
79
- **Peer Dependencies:**
80
- Ensure you have peer dependencies installed (standard in Next.js apps):
81
- `react >= 18.0.0`, `react-dom >= 18.0.0`, `next >= 13.0.0`
82
-
83
43
  ---
84
44
 
85
45
  ## 🚀 Quick Start
86
46
 
87
- ### 1. Define Your Schema
47
+ ### 1. Define Schema
88
48
 
89
- Create a single source of truth for your permissions in `lib/rbac.ts` (or `config/rbac.ts`).
49
+ Create `lib/rbac.ts` to define your types and export your instances.
90
50
 
91
51
  ```typescript
92
52
  // lib/rbac.ts
93
53
  "use client";
94
54
  import { createRBAC } from "rbac-shield";
95
55
 
96
- // 1. Define resources (things you secure)
97
- export type Resources = "projects" | "billing" | "users" | "marketing";
56
+ export type Resources = "projects" | "billing" | "users";
57
+ export type Actions = "view" | "create" | "edit" | "delete";
98
58
 
99
- // 2. Define actions (what users can do)
100
- export type Actions = "view" | "create" | "edit" | "delete" | "export";
101
-
102
- // 3. Create your instances
103
59
  export const {
104
60
  RBACProvider,
105
61
  useRBAC,
106
- useHasRole, // New!
62
+ useHasRole,
107
63
  useHasPermission,
108
- useMatch,
64
+ useAccess, // Advanced checks
109
65
  Can,
110
66
  ProtectedRoute,
111
67
  guard,
112
68
  } = createRBAC<Resources, Actions>();
113
69
  ```
114
70
 
115
- ### 2. Wrap Your App
71
+ ### 2. Wrap App
116
72
 
117
- Add the provider to your root layout.
73
+ Wrap your root layout with the provider.
118
74
 
119
75
  ```tsx
120
76
  // app/layout.tsx
121
77
  import { RBACProvider } from "@/lib/rbac";
122
78
 
123
- export default function RootLayout({
124
- children,
125
- }: {
126
- children: React.ReactNode;
127
- }) {
79
+ export default function RootLayout({ children }) {
128
80
  return (
129
81
  <html lang="en">
130
82
  <body>
@@ -137,59 +89,63 @@ export default function RootLayout({
137
89
 
138
90
  ### 3. Load Permissions
139
91
 
140
- Initialize the system with data from your backend. You can now pass just permissions (strings) or roles and permissions.
92
+ Initialize permissions. For async user data, **wait for the user to load** before setting auth.
141
93
 
142
94
  ```tsx
143
- // components/AuthProvider.tsx
95
+ // components/PermissionLoader.tsx
144
96
  "use client";
145
97
  import { useEffect } from "react";
146
98
  import { useRBAC } from "@/lib/rbac";
99
+ import { useUser } from "@/hooks/useUser";
147
100
 
148
- export function AuthProvider({ user, children }) {
149
- const { setAuth } = useRBAC();
101
+ export function PermissionLoader({ children }) {
102
+ const { setAuth, switchTenant } = useRBAC();
103
+ const { user, isLoading } = useUser();
150
104
 
151
105
  useEffect(() => {
152
- if (user) {
153
- // Option A: Simple Permissions (Auto-assigned to 'default' tenant)
154
- setAuth(["projects:view"]);
155
-
156
- // Option B: Roles + Permissions
157
- // setAuth([{
158
- // tenantId: "default",
159
- // roles: ["admin"],
160
- // permissions: ["projects:view"]
161
- // }]);
162
- }
163
- }, [user, setAuth]);
106
+ if (isLoading || !user) return;
107
+
108
+ // Load Roles + Permissions
109
+ setAuth([
110
+ {
111
+ tenantId: user.id || "default",
112
+ roles: [user.role], // e.g. ["admin"]
113
+ permissions: user.permissions, // e.g. ["projects:view"]
114
+ },
115
+ ]);
164
116
 
117
+ switchTenant(user.id || "default");
118
+ }, [user, isLoading]);
119
+
120
+ if (isLoading || !user) return null; // Prevent render until authed
165
121
  return <>{children}</>;
166
122
  }
167
123
  ```
168
124
 
169
- ### 4. Secure Your App
125
+ ### 4. Protect Routes
170
126
 
171
127
  Use the components to guard access.
172
128
 
173
129
  ```tsx
174
- import { ProtectedRoute, Can, useHasRole } from "@/lib/rbac";
130
+ import { ProtectedRoute, Can, useHasRole, useAccess } from "@/lib/rbac";
131
+
132
+ export default function AdminDashboard() {
133
+ const isSuperAdmin = useHasRole("super_admin");
175
134
 
176
- export default function AdminPanel() {
177
- const isAdmin = useHasRole("admin");
135
+ // Advanced: Check if user is Admin OR has special permission
136
+ const canManage = useAccess({
137
+ roles: ["admin"],
138
+ permissions: ["system:manage"],
139
+ });
178
140
 
179
141
  return (
180
- // 1. Role-Based Route Protection
181
- <ProtectedRoute role="admin" fallbackPath="/login">
142
+ <ProtectedRoute role={["admin", "super_admin"]} fallbackPath="/login">
182
143
  <h1>Admin Dashboard</h1>
183
144
 
184
- {/* 2. Permission Check */}
145
+ {/* Conditional Rendering */}
185
146
  <Can permission="billing:view">
186
147
  <BillingWidget />
187
148
  </Can>
188
-
189
- {/* 3. Combined Logic (Role AND Permission) */}
190
- <Can role="manager" permission="users:delete">
191
- <DeleteUserButton />
192
- </Can>
193
149
  </ProtectedRoute>
194
150
  );
195
151
  }
@@ -197,9 +153,9 @@ export default function AdminPanel() {
197
153
 
198
154
  ---
199
155
 
200
- ## 👑 Role Management
156
+ ## 👑 Role Management & Logic
201
157
 
202
- RBAC Shield now supports **Dynamic Logic** for access control. You can check for Roles, Permissions, or Both.
158
+ RBAC Shield uses a **Unified Access Logic** across all components.
203
159
 
204
160
  ### Logic Matrix
205
161
 
@@ -208,168 +164,70 @@ RBAC Shield now supports **Dynamic Logic** for access control. You can check for
208
164
  | **Role Only** | User has `role` | `<Can role="admin">` |
209
165
  | **Permission Only** | User has `permission` | `<Can permission="edit">` |
210
166
  | **Both** | **STRICT AND**: User has `role` **AND** `permission` | `<Can role="admin" permission="edit">` |
211
- | **Neither** | Deny Access | `<Can />` (Renders nothing) |
212
167
 
213
- ### Wildcards
168
+ ### Wildcards (`*`)
214
169
 
215
- - **Roles**: If the user has the role `*`, they pass ALL role checks.
216
- - **Permissions**: If the user has permission `*`, they pass ALL permission checks.
170
+ - **Roles**: If user has role `*`, they pass ALL role checks.
171
+ - **Permissions**: If user has permission `*`, they pass ALL permission checks.
217
172
 
218
- ### Array Inputs (OR Logic)
173
+ ### Arrays (OR Logic)
219
174
 
220
- If you provide an array to `role` or `permission`, by default it checks if the user has **ANY** of them (OR logic).
175
+ Providing an array means "User must match **ANY** of these".
221
176
 
222
177
  ```tsx
223
- // User is EITHER 'admin' OR 'manager'
224
- <Can role={["admin", "manager"]}>
225
- <ManagementPanel />
226
- </Can>
178
+ // Allow if user is 'admin' OR 'manager'
179
+ <ProtectedRoute role={["admin", "manager"]}>
227
180
  ```
228
181
 
229
182
  ---
230
183
 
231
- ## 📖 Guides & Patterns
232
-
233
- ### Roles vs Permissions
234
-
235
- - **Roles**: Use for high-level identity or persona checks (e.g., "Is this an Admin?").
236
- - **Permissions**: Use for granular capability checks (e.g., "Can they delete this post?").
237
-
238
- **Best Practice**: Combine them! Use `<ProtectedRoute role="admin">` for the page layout, and `<Can permission="settings:edit">` for specific buttons.
239
-
240
- ### Complex Logic (AND/OR)
241
-
242
- Use `requireAll` to enforce strict requirements on arrays.
243
-
244
- ```tsx
245
- // User must be 'admin' AND have 'post:delete' permission
246
- <Can permission={["role:admin", "post:delete"]} requireAll>
247
- <DeleteEverythingButton />
248
- </Can>
249
- ```
250
-
251
- ### SSR & Hydration (Eliminate Loading States)
252
-
253
- Prevent the "flicker" of loading states by passing server-side permissions directly to the provider.
254
-
255
- ```tsx
256
- // app/layout.tsx (Server Component)
257
- import { RBACProvider } from "@/lib/rbac";
258
- import { getSession } from "@/lib/auth";
259
-
260
- export default async function RootLayout({ children }) {
261
- const session = await getSession();
262
-
263
- // server-side: just pass the string array of permissions!
264
- const initialData = session?.permissions || [];
265
-
266
- return (
267
- <html>
268
- <body>
269
- {/* Hydrates instantly! */}
270
- <RBACProvider initialData={initialData}>{children}</RBACProvider>
271
- </body>
272
- </html>
273
- );
274
- }
275
- ```
276
-
277
- ### Logic Switching (Dynamic APIs)
278
-
279
- Use `useMatch` to execute different logic based on permissions or roles.
280
-
281
- ```tsx
282
- import { useMatch } from "@/lib/rbac";
283
-
284
- export default function Dashboard() {
285
- const getData = useMatch({
286
- "admin:view": () => api.getAdminStats(),
287
- "manager:view": () => api.getManagerStats(),
288
- default: () => api.getUserStats(),
289
- });
290
-
291
- return <button onClick={getData}>Refresh Data</button>;
292
- }
293
- ```
294
-
295
- ### Server Action Guards
296
-
297
- Protect arbitrary functions (like Server Actions) using the `guard` wrapper.
298
-
299
- ```typescript
300
- // actions/project.ts (Server Action)
301
- import { guard } from "rbac-shield";
302
- import { getSession } from "@/lib/auth";
303
-
304
- export async function deleteProject(id: string) {
305
- const session = await getSession();
306
-
307
- const safeAction = guard(
308
- session.permissions, // User's permissions
309
- "project:delete", // Required permission
310
- async () => {
311
- await db.project.delete(id);
312
- return "Deleted!";
313
- },
314
- );
315
-
316
- return safeAction();
317
- }
318
- ```
319
-
320
- ---
321
-
322
- ## 📚 API Reference
184
+ ## API Reference
323
185
 
324
186
  ### Components
325
187
 
326
188
  #### `<ProtectedRoute>`
327
189
 
328
- A wrapper component that guards an entire route or section.
190
+ Guards an entire route. Redirects if access denied.
329
191
 
330
- - **permission**: string | string[] (Optional)
331
- - **role**: string | string[] (Optional)
332
- - **requireAll**: boolean (Default: `false`)
333
- - **redirect**: boolean (Default: `true`)
334
- - **fallbackPath**: string (Default: `/`)
335
- - **fallback**: ReactNode (UI while redirecting/denied)
192
+ - **role**: `string | string[]`
193
+ - **permission**: `string | string[]`
194
+ - **requireAll**: `boolean` (Default: `false` - generally used for checking multiple permissions)
195
+ - **redirect**: `boolean` (Default: `true`)
196
+ - **fallbackPath**: `string` (Default: `/`)
197
+ - **fallback**: `ReactNode` (Shown while redirecting)
336
198
 
337
199
  #### `<Can>`
338
200
 
339
- Structural component for conditional rendering.
201
+ Conditionally renders children.
340
202
 
341
- - **permission**: string | string[] (Optional)
342
- - **role**: string | string[] (Optional)
343
- - **requireAll**: boolean
344
- - **fallback**: ReactNode
203
+ - **role**: `string | string[]`
204
+ - **permission**: `string | string[]`
205
+ - **fallback**: `ReactNode` (Shown if denied)
345
206
 
346
207
  ### Hooks
347
208
 
348
- #### `useHasRole(role: string)`
209
+ #### `useAccess({ roles?, permissions? })`
349
210
 
350
- Returns `boolean`. Checks if user has the specific role (or `*`).
211
+ Returns `boolean`. Checks if user matches ANY of the roles OR ANY of the permissions.
351
212
 
352
- #### `useHasPermission(permission: string)`
213
+ #### `useHasRole(role)`
353
214
 
354
- Returns `boolean`. Checks for exact permission match or wildcard `*`.
215
+ Returns `boolean`. Checks for specific role (or wildcard).
355
216
 
356
- #### `useRBAC()`
217
+ #### `useHasPermission(permission)`
218
+
219
+ Returns `boolean`. Checks for specific permission (or wildcard).
357
220
 
358
- Access raw state.
221
+ #### `useRBAC()`
359
222
 
360
- - `setAuth(authData)`: Valid inputs:
361
- - `string[]` (Permissions only)
362
- - `TenantAuthInput[]` (Full Multi-tenant data)
363
- - `switchTenant(id)`: Change active context.
223
+ Access raw state (`isLoading`, `activeTenantId`, etc.) and actions (`setAuth`).
364
224
 
365
225
  ---
366
226
 
367
- ## 🛡️ Security & Best Practices
368
-
369
- > [!IMPORTANT]
370
- > **Client-side checks are for User Experience (UX) only.**
227
+ ## 🛡️ Best Practices
371
228
 
372
- Always verify permissions on the server (API Routes, Server Actions, Middleware) using `checkPermission` or `guard`.
229
+ 1. **Server-Side Verification**: Always verify permissions on the server (API Routes, Server Actions) using the `checkPermission` utility or `guard` wrapper. Client-side checks are for UX only.
230
+ 2. **Combine Checks**: Use Roles for high-level page access, and Permissions for specific button visibility.
373
231
 
374
232
  ---
375
233
 
package/bin/templates.js CHANGED
@@ -33,7 +33,9 @@ export type Actions = ${actionsType};
33
33
  export const {
34
34
  RBACProvider,
35
35
  useRBAC,
36
- useHasPermission,
36
+ useHasRole,
37
+ useHasPermission,
38
+ useAccess,
37
39
  useHasAnyPermission,
38
40
  useHasAllPermissions,
39
41
  usePermissions,
@@ -53,7 +55,9 @@ import { createRBAC } from 'rbac-shield';
53
55
  export const {
54
56
  RBACProvider,
55
57
  useRBAC,
56
- useHasPermission,
58
+ useHasRole,
59
+ useHasPermission,
60
+ useAccess,
57
61
  useHasAnyPermission,
58
62
  useHasAllPermissions,
59
63
  usePermissions,
@@ -46,6 +46,10 @@ export interface RBACFactory<R extends string, A extends string> {
46
46
  };
47
47
  useHasRole: (role: string) => boolean;
48
48
  useHasPermission: (permission: PermissionString<R, A>) => boolean;
49
+ useAccess: (requirements: {
50
+ roles?: string[];
51
+ permissions?: string[];
52
+ }) => boolean;
49
53
  useHasAnyPermission: (permissions: PermissionString<R, A>[]) => boolean;
50
54
  useHasAllPermissions: (permissions: PermissionString<R, A>[]) => boolean;
51
55
  usePermissions: () => PermissionString<R, A>[];
package/dist/factory.d.ts CHANGED
@@ -46,6 +46,10 @@ export interface RBACFactory<R extends string, A extends string> {
46
46
  };
47
47
  useHasRole: (role: string) => boolean;
48
48
  useHasPermission: (permission: PermissionString<R, A>) => boolean;
49
+ useAccess: (requirements: {
50
+ roles?: string[];
51
+ permissions?: string[];
52
+ }) => boolean;
49
53
  useHasAnyPermission: (permissions: PermissionString<R, A>[]) => boolean;
50
54
  useHasAllPermissions: (permissions: PermissionString<R, A>[]) => boolean;
51
55
  usePermissions: () => PermissionString<R, A>[];
@@ -1 +1 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.tsx"],"names":[],"mappings":"AAEA,OAAO,KAON,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAavE,KAAK,QAAQ,CAAC,CAAC,IAAI;KAChB,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACrB,GAAG,EAAE,CAAC;AAEP,MAAM,WAAW,QAAQ,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM;IAC1D,yDAAyD;IACzD,UAAU,CAAC,EAAE,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;IAC/D,6CAA6C;IAC7C,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,gDAAgD;IAChD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,2EAA2E;IAC3E,UAAU,C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