@checkstack/backend 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,89 @@
|
|
|
1
1
|
# @checkstack/backend
|
|
2
2
|
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 8e43507: # Teams and Resource-Level Access Control
|
|
8
|
+
|
|
9
|
+
This release introduces a comprehensive Teams system for organizing users and controlling access to resources at a granular level.
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
### Team Management
|
|
14
|
+
|
|
15
|
+
- Create, update, and delete teams with name and description
|
|
16
|
+
- Add/remove users from teams
|
|
17
|
+
- Designate team managers with elevated privileges
|
|
18
|
+
- View team membership and manager status
|
|
19
|
+
|
|
20
|
+
### Resource-Level Access Control
|
|
21
|
+
|
|
22
|
+
- Grant teams access to specific resources (systems, health checks, incidents, maintenances)
|
|
23
|
+
- Configure read-only or manage permissions per team
|
|
24
|
+
- Resource-level "Team Only" mode that restricts access exclusively to team members
|
|
25
|
+
- Separate `resourceAccessSettings` table for resource-level settings (not per-grant)
|
|
26
|
+
- Automatic cleanup of grants when teams are deleted (database cascade)
|
|
27
|
+
|
|
28
|
+
### Middleware Integration
|
|
29
|
+
|
|
30
|
+
- Extended `autoAuthMiddleware` to support resource access checks
|
|
31
|
+
- Single-resource pre-handler validation for detail endpoints
|
|
32
|
+
- Automatic list filtering for collection endpoints
|
|
33
|
+
- S2S endpoints for access verification
|
|
34
|
+
|
|
35
|
+
### Frontend Components
|
|
36
|
+
|
|
37
|
+
- `TeamsTab` component for managing teams in Auth Settings
|
|
38
|
+
- `TeamAccessEditor` component for assigning team access to resources
|
|
39
|
+
- Resource-level "Team Only" toggle in `TeamAccessEditor`
|
|
40
|
+
- Integration into System, Health Check, Incident, and Maintenance editors
|
|
41
|
+
|
|
42
|
+
## Breaking Changes
|
|
43
|
+
|
|
44
|
+
### API Response Format Changes
|
|
45
|
+
|
|
46
|
+
List endpoints now return objects with named keys instead of arrays directly:
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
// Before
|
|
50
|
+
const systems = await catalogApi.getSystems();
|
|
51
|
+
|
|
52
|
+
// After
|
|
53
|
+
const { systems } = await catalogApi.getSystems();
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Affected endpoints:
|
|
57
|
+
|
|
58
|
+
- `catalog.getSystems` → `{ systems: [...] }`
|
|
59
|
+
- `healthcheck.getConfigurations` → `{ configurations: [...] }`
|
|
60
|
+
- `incident.listIncidents` → `{ incidents: [...] }`
|
|
61
|
+
- `maintenance.listMaintenances` → `{ maintenances: [...] }`
|
|
62
|
+
|
|
63
|
+
### User Identity Enrichment
|
|
64
|
+
|
|
65
|
+
`RealUser` and `ApplicationUser` types now include `teamIds: string[]` field with team memberships.
|
|
66
|
+
|
|
67
|
+
## Documentation
|
|
68
|
+
|
|
69
|
+
See `docs/backend/teams.md` for complete API reference and integration guide.
|
|
70
|
+
|
|
71
|
+
### Patch Changes
|
|
72
|
+
|
|
73
|
+
- 97c5a6b: Fix collector lookup when health check is assigned to a system
|
|
74
|
+
|
|
75
|
+
Collectors are now stored in the registry with their fully-qualified ID format (ownerPluginId.collectorId) to match how they are referenced in health check configurations. Added `qualifiedId` field to `RegisteredCollector` interface to avoid re-constructing the ID at query time. This fixes the "Collector not found" warning that occurred when executing health checks with assigned systems.
|
|
76
|
+
|
|
77
|
+
- Updated dependencies [97c5a6b]
|
|
78
|
+
- Updated dependencies [8e43507]
|
|
79
|
+
- @checkstack/backend-api@0.2.0
|
|
80
|
+
- @checkstack/auth-common@0.1.0
|
|
81
|
+
- @checkstack/common@0.1.0
|
|
82
|
+
- @checkstack/queue-api@0.0.4
|
|
83
|
+
- @checkstack/signal-backend@0.0.4
|
|
84
|
+
- @checkstack/api-docs-common@0.0.4
|
|
85
|
+
- @checkstack/signal-common@0.0.4
|
|
86
|
+
|
|
3
87
|
## 0.1.0
|
|
4
88
|
|
|
5
89
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -177,6 +177,32 @@ export function registerCoreServices({
|
|
|
177
177
|
return [];
|
|
178
178
|
}
|
|
179
179
|
},
|
|
180
|
+
|
|
181
|
+
checkResourceTeamAccess: async (params) => {
|
|
182
|
+
try {
|
|
183
|
+
const rpcClient = await registry.get(coreServices.rpcClient, {
|
|
184
|
+
pluginId: "core",
|
|
185
|
+
});
|
|
186
|
+
const authClient = rpcClient.forPlugin(AuthApi);
|
|
187
|
+
return await authClient.checkResourceTeamAccess(params);
|
|
188
|
+
} catch {
|
|
189
|
+
// Fall back to global permission on error
|
|
190
|
+
return { hasAccess: params.hasGlobalPermission };
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
|
|
194
|
+
getAccessibleResourceIds: async (params) => {
|
|
195
|
+
try {
|
|
196
|
+
const rpcClient = await registry.get(coreServices.rpcClient, {
|
|
197
|
+
pluginId: "core",
|
|
198
|
+
});
|
|
199
|
+
const authClient = rpcClient.forPlugin(AuthApi);
|
|
200
|
+
return await authClient.getAccessibleResourceIds(params);
|
|
201
|
+
} catch {
|
|
202
|
+
// Fall back to global permission on error
|
|
203
|
+
return params.hasGlobalPermission ? params.resourceIds : [];
|
|
204
|
+
}
|
|
205
|
+
},
|
|
180
206
|
};
|
|
181
207
|
return authService;
|
|
182
208
|
});
|
|
@@ -17,15 +17,15 @@ export class CoreCollectorRegistry {
|
|
|
17
17
|
collector: CollectorStrategy<TransportClient<unknown, unknown>>,
|
|
18
18
|
ownerPlugin: PluginMetadata
|
|
19
19
|
): void {
|
|
20
|
-
|
|
20
|
+
// Use fully-qualified ID: ownerPluginId.collectorId
|
|
21
|
+
const qualifiedId = `${ownerPlugin.pluginId}.${collector.id}`;
|
|
22
|
+
if (this.collectors.has(qualifiedId)) {
|
|
21
23
|
rootLogger.warn(
|
|
22
|
-
`CollectorStrategy '${
|
|
24
|
+
`CollectorStrategy '${qualifiedId}' is already registered. Overwriting.`
|
|
23
25
|
);
|
|
24
26
|
}
|
|
25
|
-
this.collectors.set(
|
|
26
|
-
rootLogger.debug(
|
|
27
|
-
`✅ Registered CollectorStrategy: ${ownerPlugin.pluginId}.${collector.id}`
|
|
28
|
-
);
|
|
27
|
+
this.collectors.set(qualifiedId, { qualifiedId, collector, ownerPlugin });
|
|
28
|
+
rootLogger.debug(`✅ Registered CollectorStrategy: ${qualifiedId}`);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
/**
|
package/src/test-preload.ts
CHANGED
|
@@ -60,6 +60,12 @@ mock.module(coreServicesPath, () => ({
|
|
|
60
60
|
authenticate: async () => {},
|
|
61
61
|
getCredentials: async () => ({ headers: {} }),
|
|
62
62
|
getAnonymousPermissions: async () => [],
|
|
63
|
+
checkResourceTeamAccess: async () => ({ hasAccess: true }),
|
|
64
|
+
getAccessibleResourceIds: async ({
|
|
65
|
+
resourceIds,
|
|
66
|
+
}: {
|
|
67
|
+
resourceIds: string[];
|
|
68
|
+
}) => resourceIds,
|
|
63
69
|
}));
|
|
64
70
|
|
|
65
71
|
// Register mock fetch factory
|