mftsccs-node 0.0.77 → 0.0.79-dev
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 +60 -50
- package/dist/bundle.js +1 -1
- package/dist/bundle.mjs +1 -1
- package/dist/types/Api/MakeTheTypeConceptApi.d.ts +1 -30
- package/dist/types/DataStructures/AccessControl/AccessControlModels.d.ts +176 -0
- package/dist/types/DataStructures/BaseUrl.d.ts +2 -0
- package/dist/types/DataStructures/CCSConfig.d.ts +15 -1
- package/dist/types/DataStructures/Transaction/Transaction.d.ts +1 -0
- package/dist/types/Services/AccessControl/APIClientService.d.ts +162 -0
- package/dist/types/Services/AccessControl/AccessControlCacheService.d.ts +76 -18
- package/dist/types/Services/AccessControl/AccessControlService.d.ts +223 -237
- package/dist/types/Services/AccessControl/PermissionSet.d.ts +18 -3
- package/dist/types/Services/AccessControl/index.d.ts +15 -0
- package/dist/types/Services/CreateTypeConcept.d.ts +2 -0
- package/dist/types/app.d.ts +8 -1
- package/package.json +8 -3
|
@@ -1,267 +1,253 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* AccessControlService
|
|
3
|
+
*
|
|
4
|
+
* This service provides access control functionality including:
|
|
5
|
+
* - 5-phase bulk access check with BFS inheritance graph traversal
|
|
6
|
+
* - Assign and revoke access permissions
|
|
7
|
+
* - Bulk operations for access management
|
|
8
|
+
* - Super admin checks with caching
|
|
9
|
+
* - Access inheritance management (including parent access inheritance)
|
|
10
|
+
*
|
|
11
|
+
* This is the TypeScript equivalent of the C# AccessControlService class (v3.4.0).
|
|
12
|
+
* All methods are static and can be called directly on the class.
|
|
13
|
+
*/
|
|
14
|
+
import { AccessResult, BulkAccessRequest, BulkParentAccessInheritanceResult } from '../../DataStructures/AccessControl/AccessControlModels';
|
|
15
|
+
import { PermissionSet } from './PermissionSet';
|
|
2
16
|
export declare class AccessControlService {
|
|
3
|
-
private static
|
|
4
|
-
private static
|
|
17
|
+
private static cacheService;
|
|
18
|
+
private static apiClient;
|
|
19
|
+
private static isAccessControlEnabled;
|
|
5
20
|
private static initialize;
|
|
6
21
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*
|
|
13
|
-
*/
|
|
14
|
-
static
|
|
15
|
-
/**
|
|
16
|
-
*
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
*
|
|
26
|
-
* @
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
*
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
*
|
|
41
|
-
* @param
|
|
42
|
-
* @returns Promise<
|
|
43
|
-
*/
|
|
44
|
-
static
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
*
|
|
52
|
-
* @
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
*
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
*
|
|
100
|
-
* @param
|
|
101
|
-
* @
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
*
|
|
110
|
-
* @
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
*
|
|
133
|
-
* @param
|
|
134
|
-
* @returns Promise<
|
|
135
|
-
*/
|
|
136
|
-
static
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
*
|
|
142
|
-
* @
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
* Filters concepts by access for a user.
|
|
162
|
-
* @param request - Object containing userId, access, conceptIdList, connectionIdList.
|
|
163
|
-
* @returns Promise<any> - API response.
|
|
164
|
-
*/
|
|
165
|
-
static filterConceptsByAccess(request: {
|
|
166
|
-
userId: number;
|
|
167
|
-
access: string;
|
|
168
|
-
conceptIdList?: number[];
|
|
169
|
-
connectionIdList?: number[];
|
|
170
|
-
}): Promise<any>;
|
|
171
|
-
/**
|
|
172
|
-
* Checks access for a user on multiple concepts in bulk.
|
|
173
|
-
* @param request - Object containing userId, access, conceptIdList.
|
|
174
|
-
* @returns Promise<any> - API response.
|
|
175
|
-
*/
|
|
176
|
-
static checkAccessOfConceptBulk(request: {
|
|
177
|
-
userId: number;
|
|
178
|
-
access: string;
|
|
179
|
-
conceptIdList: number[];
|
|
180
|
-
}): Promise<any>;
|
|
22
|
+
* Enable or disable access control checks globally.
|
|
23
|
+
* When disabled, checkAccess/checkAccessBulk/getConceptIdsWithPermission allow all input concepts.
|
|
24
|
+
*/
|
|
25
|
+
static setEnabled(isEnabled: boolean): void;
|
|
26
|
+
/**
|
|
27
|
+
* Returns whether access control checks are currently enabled.
|
|
28
|
+
*/
|
|
29
|
+
static getEnabled(): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Set access-control API base URL. If omitted, APIClientService fallback order is used.
|
|
32
|
+
*/
|
|
33
|
+
static setBaseUrl(baseUrl?: string): void;
|
|
34
|
+
/**
|
|
35
|
+
* Check whether a user/entity has the specified permission on a single concept.
|
|
36
|
+
* Delegates to checkAccessBulk for full inheritance + group resolution.
|
|
37
|
+
*
|
|
38
|
+
* @param conceptId - The ID of the concept to check access for
|
|
39
|
+
* @param permission - The permission to check (PermissionSet flags)
|
|
40
|
+
* @param entityId - Optional entity ID to check access for
|
|
41
|
+
* @returns Promise<boolean> - True if access is granted, false otherwise
|
|
42
|
+
*/
|
|
43
|
+
static checkAccess(conceptId: number, permission: PermissionSet, entityId?: number | null): Promise<boolean>;
|
|
44
|
+
/**
|
|
45
|
+
* 5-phase bulk access check algorithm.
|
|
46
|
+
* Matches the C# AccessControlService.CheckAccessBulk implementation.
|
|
47
|
+
*
|
|
48
|
+
* Phase 1: Super-admin short-circuit
|
|
49
|
+
* Phase 2: Fast-path classification (owner, public, type concepts)
|
|
50
|
+
* Phase 3: BFS inheritance graph resolution (3 sources)
|
|
51
|
+
* Phase 4: Bulk access decision resolution (cache + API)
|
|
52
|
+
* Phase 5: Grant-only merge per concept
|
|
53
|
+
*
|
|
54
|
+
* @param conceptIds - List of concept IDs to check
|
|
55
|
+
* @param permission - The permission to check (PermissionSet flags)
|
|
56
|
+
* @param entityId - Optional entity ID
|
|
57
|
+
* @returns Promise<Map<number, boolean>> - conceptId → hasAccess
|
|
58
|
+
*/
|
|
59
|
+
static checkAccessBulk(conceptIds: number[], permission: PermissionSet, entityId?: number | null): Promise<Map<number, boolean>>;
|
|
60
|
+
/**
|
|
61
|
+
* Get all conceptIds which have a certain permission for an entity.
|
|
62
|
+
* Delegates to checkAccessBulk for full inheritance support.
|
|
63
|
+
*
|
|
64
|
+
* @param permission - The permission to check (PermissionSet flags)
|
|
65
|
+
* @param conceptIdsFilter - List of concept IDs to filter
|
|
66
|
+
* @param entityId - Optional entity ID
|
|
67
|
+
* @returns Promise<number[]> - Array of concept IDs that have the permission
|
|
68
|
+
*/
|
|
69
|
+
static getConceptIdsWithPermission(permission: PermissionSet, conceptIdsFilter: number[], entityId?: number | null): Promise<number[]>;
|
|
70
|
+
/**
|
|
71
|
+
* Resolve inheritance graph via 3-source BFS, depth-limited to MAX_BFS_DEPTH.
|
|
72
|
+
*
|
|
73
|
+
* Source 1: FreeSchema internal connections ("the_parent_access_inheritance")
|
|
74
|
+
* Source 2: Explicit parent access links (via Access API)
|
|
75
|
+
* Source 3: Concept-connection access inheritance
|
|
76
|
+
*
|
|
77
|
+
* @returns Map<number, number[]> — accessId → [self, parent1, grandparent1, ...]
|
|
78
|
+
*/
|
|
79
|
+
private static resolveBulkInheritanceGraph;
|
|
80
|
+
/**
|
|
81
|
+
* Resolve access decisions for all (accessId × subject) combinations.
|
|
82
|
+
* Probes cache first, then makes bulk API calls for misses.
|
|
83
|
+
*
|
|
84
|
+
* @returns Map with key "accessId:subjectId" → hasAccess
|
|
85
|
+
*/
|
|
86
|
+
private static resolveBulkDecisions;
|
|
87
|
+
/**
|
|
88
|
+
* Resolve all subjects for an entity: [null, entityId, ...groupIds]
|
|
89
|
+
*/
|
|
90
|
+
private static resolveSubjects;
|
|
91
|
+
/**
|
|
92
|
+
* Check if any grant exists across own chain + type chain for any subject.
|
|
93
|
+
* Grant-only model: any grant → ALLOW, no grants → DENY.
|
|
94
|
+
*/
|
|
95
|
+
private static hasAnyGrant;
|
|
96
|
+
/**
|
|
97
|
+
* Assign access permission to an entity
|
|
98
|
+
*
|
|
99
|
+
* @param conceptId - The concept ID to assign access for
|
|
100
|
+
* @param permission - The permission to assign (PermissionSet flags)
|
|
101
|
+
* @param entityId - Optional entity ID
|
|
102
|
+
* @returns Promise<boolean> - True if successful, false otherwise
|
|
103
|
+
*/
|
|
104
|
+
static assignAccess(conceptId: number, permission: PermissionSet, entityId?: number | null): Promise<boolean>;
|
|
105
|
+
/**
|
|
106
|
+
* Assign access permissions to multiple targets in bulk
|
|
107
|
+
*
|
|
108
|
+
* @param request - Bulk access request containing targets
|
|
109
|
+
* @returns Promise<AccessResult[]> - Array of access results
|
|
110
|
+
*/
|
|
111
|
+
static assignAccessBulk(request: BulkAccessRequest): Promise<AccessResult[]>;
|
|
112
|
+
/**
|
|
113
|
+
* Revoke access permission from an entity
|
|
114
|
+
*
|
|
115
|
+
* @param conceptId - The concept ID to revoke access for
|
|
116
|
+
* @param permission - The permission to revoke (PermissionSet flags)
|
|
117
|
+
* @param entityId - Optional entity ID
|
|
118
|
+
* @returns Promise<boolean> - True if successfully revoked, false otherwise
|
|
119
|
+
*/
|
|
120
|
+
static revokeAccess(conceptId: number, permission: PermissionSet, entityId?: number | null): Promise<boolean>;
|
|
121
|
+
/**
|
|
122
|
+
* Revoke access permissions from multiple targets in bulk
|
|
123
|
+
*
|
|
124
|
+
* @param request - Bulk access request containing targets
|
|
125
|
+
* @returns Promise<AccessResult[]> - Array of access results
|
|
126
|
+
*/
|
|
127
|
+
static revokeAccessBulk(request: BulkAccessRequest): Promise<AccessResult[]>;
|
|
128
|
+
/**
|
|
129
|
+
* Set access inheritance for a concept
|
|
130
|
+
*
|
|
131
|
+
* @param conceptId - The concept ID to set inheritance for
|
|
132
|
+
* @returns Promise<boolean> - True if successful, false otherwise
|
|
133
|
+
*/
|
|
134
|
+
static setAccessInheritance(conceptId: number): Promise<boolean>;
|
|
135
|
+
/**
|
|
136
|
+
* Get access inheritance status for a concept
|
|
137
|
+
*
|
|
138
|
+
* @param conceptId - The concept ID to check
|
|
139
|
+
* @param connectionTypeId - The connection type ID (default: 999)
|
|
140
|
+
* @returns Promise<boolean> - True if inheritance is enabled, false otherwise
|
|
141
|
+
*/
|
|
142
|
+
static getAccessInheritanceStatus(conceptId: number, connectionTypeId?: number): Promise<boolean>;
|
|
143
|
+
/**
|
|
144
|
+
* Set access inheritance status for a concept
|
|
145
|
+
*
|
|
146
|
+
* @param conceptId - The concept ID to set inheritance status for
|
|
147
|
+
* @param isEnabled - Whether to enable or disable inheritance
|
|
148
|
+
* @param connectionTypeId - The connection type ID (default: 999)
|
|
149
|
+
* @returns Promise<boolean> - True if successful, false otherwise
|
|
150
|
+
*/
|
|
151
|
+
static setAccessInheritanceStatus(conceptId: number, isEnabled: boolean, connectionTypeId?: number): Promise<boolean>;
|
|
152
|
+
/**
|
|
153
|
+
* Set parent access inheritance link for a concept
|
|
154
|
+
*
|
|
155
|
+
* @param conceptId - The child concept ID
|
|
156
|
+
* @param parentConceptId - The parent concept ID to inherit from
|
|
157
|
+
* @returns Promise<number> - The new access ID, or existing access ID
|
|
158
|
+
*/
|
|
159
|
+
static setParentAccessInheritance(conceptId: number, parentConceptId: number): Promise<number>;
|
|
160
|
+
/**
|
|
161
|
+
* Remove parent access inheritance link
|
|
162
|
+
*
|
|
163
|
+
* @param conceptId - The child concept ID
|
|
164
|
+
* @param parentConceptId - Optional parent concept ID (removes specific link or all)
|
|
165
|
+
* @returns Promise<string> - Status message
|
|
166
|
+
*/
|
|
167
|
+
static removeParentAccessInheritance(conceptId: number, parentConceptId?: number): Promise<string>;
|
|
168
|
+
/**
|
|
169
|
+
* Check if parent access inheritance link exists
|
|
170
|
+
*
|
|
171
|
+
* @param conceptId - The child concept ID
|
|
172
|
+
* @param parentConceptId - Optional parent concept ID to check specific link
|
|
173
|
+
* @returns Promise<boolean> - True if link exists
|
|
174
|
+
*/
|
|
175
|
+
static hasParentAccessInheritance(conceptId: number, parentConceptId?: number): Promise<boolean>;
|
|
181
176
|
/**
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
* @param
|
|
185
|
-
* @returns Promise<
|
|
177
|
+
* Get the parent access ID for a concept
|
|
178
|
+
*
|
|
179
|
+
* @param conceptId - The child concept ID
|
|
180
|
+
* @returns Promise<number | null> - Parent access ID or null
|
|
186
181
|
*/
|
|
187
|
-
static
|
|
182
|
+
static getParentAccessId(conceptId: number): Promise<number | null>;
|
|
188
183
|
/**
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
* @
|
|
184
|
+
* Set parent access inheritance for multiple children with one parent
|
|
185
|
+
*
|
|
186
|
+
* @param childConceptIds - List of child concept IDs
|
|
187
|
+
* @param parentConceptId - The parent concept ID to inherit from
|
|
188
|
+
* @returns Promise<BulkParentAccessInheritanceResult[]> - Results per child
|
|
192
189
|
*/
|
|
193
|
-
static
|
|
190
|
+
static setParentAccessInheritanceBulk(childConceptIds: number[], parentConceptId: number): Promise<BulkParentAccessInheritanceResult[]>;
|
|
194
191
|
/**
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
* @
|
|
192
|
+
* Remove parent access inheritance for multiple children
|
|
193
|
+
*
|
|
194
|
+
* @param childConceptIds - List of child concept IDs
|
|
195
|
+
* @param parentConceptId - Optional parent concept ID
|
|
196
|
+
* @returns Promise<BulkParentAccessInheritanceResult[]> - Results per child
|
|
198
197
|
*/
|
|
199
|
-
static
|
|
198
|
+
static removeParentAccessInheritanceBulk(childConceptIds: number[], parentConceptId?: number): Promise<BulkParentAccessInheritanceResult[]>;
|
|
200
199
|
/**
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
200
|
+
* Check if an entity is a super admin
|
|
201
|
+
* Uses caching for performance
|
|
202
|
+
*
|
|
203
|
+
* @param entityId - The entity ID to check
|
|
204
|
+
* @returns Promise<boolean> - True if super admin, false otherwise
|
|
204
205
|
*/
|
|
205
|
-
static
|
|
206
|
+
static isSuperAdmin(entityId: number): Promise<boolean>;
|
|
206
207
|
/**
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
* @
|
|
208
|
+
* Assign super admin access to an entity
|
|
209
|
+
*
|
|
210
|
+
* @param entityId - The entity ID to grant super admin access to
|
|
211
|
+
* @returns Promise<number> - The entity ID if successful, 0 otherwise
|
|
210
212
|
*/
|
|
211
|
-
static
|
|
213
|
+
static assignSuperAdmin(entityId: number): Promise<number>;
|
|
212
214
|
/**
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
+
* Revoke super admin access from an entity
|
|
216
|
+
*
|
|
217
|
+
* @param entityId - The entity ID to revoke super admin access from
|
|
218
|
+
* @returns Promise<string> - Success message or error message
|
|
215
219
|
*/
|
|
216
|
-
static
|
|
220
|
+
static revokeSuperAdmin(entityId: number): Promise<string>;
|
|
217
221
|
/**
|
|
218
|
-
*
|
|
219
|
-
*
|
|
222
|
+
* Parse boolean from API response data.
|
|
223
|
+
* Handles: raw boolean, string, object with known property names.
|
|
224
|
+
* Matches C# ParseBoolData helper.
|
|
220
225
|
*/
|
|
221
|
-
static
|
|
226
|
+
private static parseBoolData;
|
|
222
227
|
/**
|
|
223
|
-
*
|
|
224
|
-
*
|
|
228
|
+
* Parse integer from API response data.
|
|
229
|
+
* Handles: raw number, string, object with known property names.
|
|
230
|
+
* Matches C# ParseIntData helper.
|
|
225
231
|
*/
|
|
226
|
-
static
|
|
232
|
+
private static parseIntData;
|
|
227
233
|
/**
|
|
228
|
-
*
|
|
229
|
-
* @param request - Object containing mainConceptId, enable, connectionTypeId.
|
|
230
|
-
* @returns Promise<any> - API response.
|
|
234
|
+
* Convert PermissionSet to string for API calls
|
|
231
235
|
*/
|
|
232
|
-
static
|
|
233
|
-
mainConceptId: number;
|
|
234
|
-
enable: boolean;
|
|
235
|
-
connectionTypeId?: number;
|
|
236
|
-
}): Promise<any>;
|
|
236
|
+
private static permissionSetToString;
|
|
237
237
|
/**
|
|
238
|
-
*
|
|
239
|
-
* @param mainConceptId - The main concept ID.
|
|
240
|
-
* @param connectionTypeId - The connection type ID (default: 999).
|
|
241
|
-
* @returns Promise<any> - API response.
|
|
238
|
+
* Clear all access cache entries
|
|
242
239
|
*/
|
|
243
|
-
static
|
|
240
|
+
static clearCache(): void;
|
|
244
241
|
/**
|
|
245
|
-
*
|
|
246
|
-
* @param path - The API path.
|
|
247
|
-
* @param errorMsg - Error message to throw if request fails.
|
|
248
|
-
* @returns Promise<any> - API response.
|
|
242
|
+
* Clear super admin cache
|
|
249
243
|
*/
|
|
250
|
-
|
|
244
|
+
static clearSuperAdminCache(): void;
|
|
251
245
|
/**
|
|
252
|
-
*
|
|
253
|
-
* @param path - The API path.
|
|
254
|
-
* @param body - Request body.
|
|
255
|
-
* @param errorMsg - Error message to throw if request fails.
|
|
256
|
-
* @returns Promise<any> - API response.
|
|
246
|
+
* Update access cache entry (for MQTT-driven cache sync)
|
|
257
247
|
*/
|
|
258
|
-
|
|
248
|
+
static updateAccessCache(accessId: number, permission: string, entityId: number | null | undefined, hasAccess: boolean): void;
|
|
259
249
|
/**
|
|
260
|
-
*
|
|
261
|
-
* @param path - The API path.
|
|
262
|
-
* @param body - Optional request body.
|
|
263
|
-
* @param errorMsg - Error message to throw if request fails.
|
|
264
|
-
* @returns Promise<any> - API response.
|
|
250
|
+
* Update super admin cache entry (for MQTT-driven cache sync)
|
|
265
251
|
*/
|
|
266
|
-
|
|
252
|
+
static updateSuperAdminCache(entityId: number, isSuperAdmin: boolean): void;
|
|
267
253
|
}
|
|
@@ -1,8 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Permission set enum (bitwise flags)
|
|
3
|
+
* Mirrors C# PermissionSet enum
|
|
4
|
+
*/
|
|
1
5
|
export declare enum PermissionSet {
|
|
2
6
|
None = 0,
|
|
3
|
-
Read = 1
|
|
4
|
-
Write = 2
|
|
5
|
-
Execute = 4
|
|
7
|
+
Read = 1,// 1
|
|
8
|
+
Write = 2,// 2
|
|
9
|
+
Execute = 4,// 4
|
|
6
10
|
Delete = 8
|
|
7
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Convert an array of permission strings to a PermissionSet bitfield
|
|
14
|
+
*/
|
|
8
15
|
export declare function getPermissionSetFromStrings(permissions: string[]): PermissionSet;
|
|
16
|
+
/**
|
|
17
|
+
* Convert a PermissionSet bitfield to an array of permission strings
|
|
18
|
+
*/
|
|
19
|
+
export declare function getStringsFromPermissionSet(permissions: PermissionSet): string[];
|
|
20
|
+
/**
|
|
21
|
+
* Check if a permission string is valid
|
|
22
|
+
*/
|
|
23
|
+
export declare function isValidPermission(permission: string): boolean;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Access Control Services
|
|
3
|
+
*
|
|
4
|
+
* This module exports all access control components:
|
|
5
|
+
* - AccessControlService: Main service for access control operations
|
|
6
|
+
* - CacheService: In-memory caching for access checks
|
|
7
|
+
* - APIClientService: HTTP client for access control API endpoints
|
|
8
|
+
* - PermissionSet: Permission flags and utilities
|
|
9
|
+
* - Models: Data types for access control operations
|
|
10
|
+
*/
|
|
11
|
+
export { AccessControlService } from './AccessControlService';
|
|
12
|
+
export { CacheService, ICacheService } from './AccessControlCacheService';
|
|
13
|
+
export { APIClientService, IAPIClientService } from './APIClientService';
|
|
14
|
+
export { PermissionSet, getPermissionSetFromStrings, getStringsFromPermissionSet, isValidPermission } from './PermissionSet';
|
|
15
|
+
export { PermissionSet as PermissionSetEnum, AccessRequest, AccessResult, BulkAccessRequest, BulkAccessTarget, BulkCheckAccessRequest, AccessInheritanceRequest, SuperAdminRequest, AccessControlAPIResponse, AccessControlApiResponse, AddAccessByEntityRequest, AddPublicAccessToConcept, AddAccessByEntityBulkRequest, AddAccessByUserRequest, CheckAccessBulk, ParentAccessInheritanceRequest, VALID_PERMISSIONS, isValidPermission as isValidPermissionFromModels } from '../../DataStructures/AccessControl/AccessControlModels';
|
package/dist/types/app.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export { default as CreateComposition } from './Services/CreateTheComposition';
|
|
|
20
20
|
export { CreateConnectionBetweenTwoConcepts, CreateConnectionBetweenTwoConceptsGeneral } from './Services/CreateConnectionBetweenTwoConcepts';
|
|
21
21
|
export { default as GetTheConcept } from './Services/GetTheConcept';
|
|
22
22
|
export { default as MakeTheInstanceConcept } from './Services/MakeTheInstanceConcept';
|
|
23
|
+
export { CreateTypeConcept } from './Services/CreateTypeConcept';
|
|
23
24
|
export { storeToDatabase, getFromDatabaseWithType, getFromDatabaseWithTypeOld } from './Database/NoIndexDb';
|
|
24
25
|
export { default as GetConceptByCharacter } from './Services/GetConceptByCharacter';
|
|
25
26
|
export { GetLink, GetLinkRaw } from './Services/GetLink';
|
|
@@ -98,6 +99,8 @@ export { GetConnectionsBetweenApi } from './Api/GetConnections/GetConnectionsBet
|
|
|
98
99
|
export { buildFetchConnection } from './DataStructures/FetchConnection';
|
|
99
100
|
export type { FetchConnection, FetchConnectionQuery } from './DataStructures/FetchConnection';
|
|
100
101
|
export { DATAID, NORMAL, JUSTDATA, ALLID, DATAIDDATE, RAW, LISTNORMAL, DATAV2 } from './Constants/FormatConstants';
|
|
102
|
+
export { AccessControlService } from './Services/AccessControl/AccessControlService';
|
|
103
|
+
export { PermissionSet } from './Services/AccessControl/PermissionSet';
|
|
101
104
|
export { Transaction } from './DataStructures/Transaction/Transaction';
|
|
102
105
|
export type { InnerActions } from './DataStructures/Transaction/Transaction';
|
|
103
106
|
export { ReservedIds, ReservedConnectionIds } from './DataStructures/ReservedIds';
|
|
@@ -160,7 +163,9 @@ declare function updateAccessToken(accessToken?: string): void;
|
|
|
160
163
|
* clientId: '101084838',
|
|
161
164
|
* clientSecret: 'your-client-secret',
|
|
162
165
|
* aiUrl: 'https://ai.freeschema.com',
|
|
163
|
-
* enableAi: true
|
|
166
|
+
* enableAi: true,
|
|
167
|
+
* enableAccessControl: true,
|
|
168
|
+
* accessControlBaseUrl: 'https://access.example.com/api/access-control'
|
|
164
169
|
* });
|
|
165
170
|
* init('https://api.freeschema.com', '', 'MyApp', config);
|
|
166
171
|
* ```
|
|
@@ -172,6 +177,8 @@ declare function updateAccessToken(accessToken?: string): void;
|
|
|
172
177
|
* aiUrl: 'https://ai.example.com',
|
|
173
178
|
* accessToken: 'token',
|
|
174
179
|
* enableAi: true,
|
|
180
|
+
* enableAccessControl: true,
|
|
181
|
+
* accessControlBaseUrl: 'https://access.example.com/api/access-control',
|
|
175
182
|
* flags: {
|
|
176
183
|
* logApplication: true,
|
|
177
184
|
* accessTracker: true
|