@checkstack/catalog-frontend 0.1.0 → 0.2.0
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,85 @@
|
|
|
1
1
|
# @checkstack/catalog-frontend
|
|
2
2
|
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 9faec1f: # Unified AccessRule Terminology Refactoring
|
|
8
|
+
|
|
9
|
+
This release completes a comprehensive terminology refactoring from "permission" to "accessRule" across the entire codebase, establishing a consistent and modern access control vocabulary.
|
|
10
|
+
|
|
11
|
+
## Changes
|
|
12
|
+
|
|
13
|
+
### Core Infrastructure (`@checkstack/common`)
|
|
14
|
+
|
|
15
|
+
- Introduced `AccessRule` interface as the primary access control type
|
|
16
|
+
- Added `accessPair()` helper for creating read/manage access rule pairs
|
|
17
|
+
- Added `access()` builder for individual access rules
|
|
18
|
+
- Replaced `Permission` type with `AccessRule` throughout
|
|
19
|
+
|
|
20
|
+
### API Changes
|
|
21
|
+
|
|
22
|
+
- `env.registerPermissions()` → `env.registerAccessRules()`
|
|
23
|
+
- `meta.permissions` → `meta.access` in RPC contracts
|
|
24
|
+
- `usePermission()` → `useAccess()` in frontend hooks
|
|
25
|
+
- Route `permission:` field → `accessRule:` field
|
|
26
|
+
|
|
27
|
+
### UI Changes
|
|
28
|
+
|
|
29
|
+
- "Roles & Permissions" tab → "Roles & Access Rules"
|
|
30
|
+
- "You don't have permission..." → "You don't have access..."
|
|
31
|
+
- All permission-related UI text updated
|
|
32
|
+
|
|
33
|
+
### Documentation & Templates
|
|
34
|
+
|
|
35
|
+
- Updated 18 documentation files with AccessRule terminology
|
|
36
|
+
- Updated 7 scaffolding templates with `accessPair()` pattern
|
|
37
|
+
- All code examples use new AccessRule API
|
|
38
|
+
|
|
39
|
+
## Migration Guide
|
|
40
|
+
|
|
41
|
+
### Backend Plugins
|
|
42
|
+
|
|
43
|
+
```diff
|
|
44
|
+
- import { permissionList } from "./permissions";
|
|
45
|
+
- env.registerPermissions(permissionList);
|
|
46
|
+
+ import { accessRules } from "./access";
|
|
47
|
+
+ env.registerAccessRules(accessRules);
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### RPC Contracts
|
|
51
|
+
|
|
52
|
+
```diff
|
|
53
|
+
- .meta({ userType: "user", permissions: [permissions.read.id] })
|
|
54
|
+
+ .meta({ userType: "user", access: [access.read] })
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Frontend Hooks
|
|
58
|
+
|
|
59
|
+
```diff
|
|
60
|
+
- const canRead = accessApi.usePermission(permissions.read.id);
|
|
61
|
+
+ const canRead = accessApi.useAccess(access.read);
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Routes
|
|
65
|
+
|
|
66
|
+
```diff
|
|
67
|
+
- permission: permissions.entityRead.id,
|
|
68
|
+
+ accessRule: access.read,
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Patch Changes
|
|
72
|
+
|
|
73
|
+
- Updated dependencies [9faec1f]
|
|
74
|
+
- Updated dependencies [95eeec7]
|
|
75
|
+
- Updated dependencies [f533141]
|
|
76
|
+
- @checkstack/auth-frontend@0.2.0
|
|
77
|
+
- @checkstack/catalog-common@1.1.0
|
|
78
|
+
- @checkstack/common@0.2.0
|
|
79
|
+
- @checkstack/frontend-api@0.1.0
|
|
80
|
+
- @checkstack/notification-common@0.1.0
|
|
81
|
+
- @checkstack/ui@0.2.0
|
|
82
|
+
|
|
3
83
|
## 0.1.0
|
|
4
84
|
|
|
5
85
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -2,11 +2,14 @@ import React, { useState, useEffect } from "react";
|
|
|
2
2
|
import { useSearchParams } from "react-router-dom";
|
|
3
3
|
import {
|
|
4
4
|
useApi,
|
|
5
|
-
|
|
5
|
+
accessApiRef,
|
|
6
6
|
ExtensionSlot,
|
|
7
7
|
} from "@checkstack/frontend-api";
|
|
8
8
|
import { catalogApiRef, System, Group } from "../api";
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
CatalogSystemActionsSlot,
|
|
11
|
+
catalogAccess,
|
|
12
|
+
} from "@checkstack/catalog-common";
|
|
10
13
|
import {
|
|
11
14
|
SectionHeader,
|
|
12
15
|
Card,
|
|
@@ -17,7 +20,7 @@ import {
|
|
|
17
20
|
Label,
|
|
18
21
|
LoadingSpinner,
|
|
19
22
|
EmptyState,
|
|
20
|
-
|
|
23
|
+
AccessDenied,
|
|
21
24
|
EditableText,
|
|
22
25
|
ConfirmationModal,
|
|
23
26
|
useToast,
|
|
@@ -28,11 +31,11 @@ import { GroupEditor } from "./GroupEditor";
|
|
|
28
31
|
|
|
29
32
|
export const CatalogConfigPage = () => {
|
|
30
33
|
const catalogApi = useApi(catalogApiRef);
|
|
31
|
-
const
|
|
34
|
+
const accessApi = useApi(accessApiRef);
|
|
32
35
|
const toast = useToast();
|
|
33
36
|
const [searchParams, setSearchParams] = useSearchParams();
|
|
34
|
-
const { allowed: canManage, loading:
|
|
35
|
-
|
|
37
|
+
const { allowed: canManage, loading: accessLoading } =
|
|
38
|
+
accessApi.useAccess(catalogAccess.system.manage);
|
|
36
39
|
|
|
37
40
|
const [systems, setSystems] = useState<System[]>([]);
|
|
38
41
|
const [groups, setGroups] = useState<Group[]>([]);
|
|
@@ -219,10 +222,10 @@ export const CatalogConfigPage = () => {
|
|
|
219
222
|
}
|
|
220
223
|
};
|
|
221
224
|
|
|
222
|
-
if (loading ||
|
|
225
|
+
if (loading || accessLoading) return <LoadingSpinner />;
|
|
223
226
|
|
|
224
227
|
if (!canManage) {
|
|
225
|
-
return <
|
|
228
|
+
return <AccessDenied />;
|
|
226
229
|
}
|
|
227
230
|
|
|
228
231
|
const selectedGroup = groups.find((g) => g.id === selectedGroupId);
|
|
@@ -3,20 +3,18 @@ import { Link } from "react-router-dom";
|
|
|
3
3
|
import { Settings } from "lucide-react";
|
|
4
4
|
import type { UserMenuItemsContext } from "@checkstack/frontend-api";
|
|
5
5
|
import { DropdownMenuItem } from "@checkstack/ui";
|
|
6
|
-
import {
|
|
6
|
+
import { resolveRoute } from "@checkstack/common";
|
|
7
7
|
import {
|
|
8
8
|
catalogRoutes,
|
|
9
|
-
|
|
9
|
+
catalogAccess,
|
|
10
10
|
pluginMetadata,
|
|
11
11
|
} from "@checkstack/catalog-common";
|
|
12
12
|
|
|
13
13
|
export const CatalogUserMenuItems = ({
|
|
14
|
-
|
|
14
|
+
accessRules: userPerms,
|
|
15
15
|
}: UserMenuItemsContext) => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
permissions.catalogManage
|
|
19
|
-
);
|
|
16
|
+
// Use the access rule's id directly
|
|
17
|
+
const qualifiedId = `${pluginMetadata.pluginId}.${catalogAccess.system.manage.id}`;
|
|
20
18
|
const canManage = userPerms.includes("*") || userPerms.includes(qualifiedId);
|
|
21
19
|
|
|
22
20
|
if (!canManage) {
|
package/src/index.tsx
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
catalogRoutes,
|
|
11
11
|
CatalogApi,
|
|
12
12
|
pluginMetadata,
|
|
13
|
-
|
|
13
|
+
catalogAccess,
|
|
14
14
|
} from "@checkstack/catalog-common";
|
|
15
15
|
|
|
16
16
|
import { CatalogPage } from "./components/CatalogPage";
|
|
@@ -38,7 +38,7 @@ export const catalogPlugin = createFrontendPlugin({
|
|
|
38
38
|
{
|
|
39
39
|
route: catalogRoutes.routes.config,
|
|
40
40
|
element: <CatalogConfigPage />,
|
|
41
|
-
|
|
41
|
+
accessRule: catalogAccess.system.manage,
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
44
|
route: catalogRoutes.routes.systemDetail,
|