@valtimo/access-control-management 13.31.0 → 13.32.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/fesm2022/valtimo-access-control-management.mjs +668 -26
- package/fesm2022/valtimo-access-control-management.mjs.map +1 -1
- package/lib/access-control-management.module.d.ts +3 -1
- package/lib/components/access-control-json-editor-tab/access-control-json-editor-tab.component.d.ts +49 -0
- package/lib/components/access-control-overview-tab/access-control-overview-tab.component.d.ts +56 -0
- package/lib/components/editor/access-control-editor.component.d.ts +8 -4
- package/lib/constants/access-control-labels.d.ts +4 -0
- package/lib/constants/index.d.ts +1 -0
- package/lib/models/access-control-editor-tab.model.d.ts +9 -0
- package/lib/models/index.d.ts +2 -0
- package/lib/models/permission-schema.model.d.ts +46 -1
- package/lib/models/permission.model.d.ts +35 -0
- package/lib/pipes/index.d.ts +1 -0
- package/lib/pipes/resource-type-label.pipe.d.ts +10 -0
- package/lib/services/access-control.service.d.ts +2 -2
- package/lib/services/index.d.ts +1 -0
- package/lib/services/permission-schema-metadata.service.d.ts +20 -0
- package/lib/utils/format-condition.d.ts +8 -0
- package/lib/utils/index.d.ts +1 -0
- package/package.json +1 -1
package/lib/components/access-control-json-editor-tab/access-control-json-editor-tab.component.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { EventEmitter, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core';
|
|
2
|
+
import { ActivatedRoute, Router } from '@angular/router';
|
|
3
|
+
import { TranslateService } from '@ngx-translate/core';
|
|
4
|
+
import { EditorModel } from '@valtimo/components';
|
|
5
|
+
import { IconService, ListItem } from 'carbon-components-angular';
|
|
6
|
+
import { Observable } from 'rxjs';
|
|
7
|
+
import { PermissionSchema } from '../../models';
|
|
8
|
+
import { PermissionSchemaMetadataService } from '../../services';
|
|
9
|
+
import * as i0 from "@angular/core";
|
|
10
|
+
export declare class AccessControlJsonEditorTabComponent implements OnInit, OnChanges, OnDestroy {
|
|
11
|
+
private readonly activatedRoute;
|
|
12
|
+
private readonly iconService;
|
|
13
|
+
private readonly metadataService;
|
|
14
|
+
private readonly router;
|
|
15
|
+
private readonly translateService;
|
|
16
|
+
disabled: boolean | null;
|
|
17
|
+
model: EditorModel;
|
|
18
|
+
validEvent: EventEmitter<boolean>;
|
|
19
|
+
valueChangeEvent: EventEmitter<string>;
|
|
20
|
+
private readonly _sourceModel$;
|
|
21
|
+
private readonly _filter$;
|
|
22
|
+
private readonly _subscriptions;
|
|
23
|
+
readonly isFilterActive$: Observable<boolean>;
|
|
24
|
+
readonly resourceTypeItems$: Observable<ListItem[]>;
|
|
25
|
+
readonly actionItems$: Observable<ListItem[]>;
|
|
26
|
+
readonly filteredModel$: Observable<EditorModel | null>;
|
|
27
|
+
readonly editorDisabled$: Observable<boolean>;
|
|
28
|
+
readonly permissionSchema$: Observable<PermissionSchema>;
|
|
29
|
+
constructor(activatedRoute: ActivatedRoute, iconService: IconService, metadataService: PermissionSchemaMetadataService, router: Router, translateService: TranslateService);
|
|
30
|
+
ngOnInit(): void;
|
|
31
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
32
|
+
ngOnDestroy(): void;
|
|
33
|
+
onValid(valid: boolean): void;
|
|
34
|
+
onValueChange(value: string): void;
|
|
35
|
+
onResourceTypeSelected(event: {
|
|
36
|
+
item?: ListItem & {
|
|
37
|
+
resourceType?: string;
|
|
38
|
+
};
|
|
39
|
+
}): void;
|
|
40
|
+
onActionSelected(event: {
|
|
41
|
+
item?: ListItem & {
|
|
42
|
+
action?: string;
|
|
43
|
+
};
|
|
44
|
+
}): void;
|
|
45
|
+
onClearFilter(): void;
|
|
46
|
+
private parsePermissions;
|
|
47
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AccessControlJsonEditorTabComponent, never>;
|
|
48
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<AccessControlJsonEditorTabComponent, "valtimo-access-control-json-editor-tab", never, { "disabled": { "alias": "disabled"; "required": false; }; "model": { "alias": "model"; "required": false; }; }, { "validEvent": "validEvent"; "valueChangeEvent": "valueChangeEvent"; }, never, never, true, never>;
|
|
49
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { TranslateService } from '@ngx-translate/core';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { Permission, PermissionCondition } from '../../models';
|
|
4
|
+
import { PermissionSchemaMetadataService } from '../../services';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
interface FormattedFieldCondition {
|
|
7
|
+
kind: 'field';
|
|
8
|
+
field: string;
|
|
9
|
+
operator: string;
|
|
10
|
+
value: string;
|
|
11
|
+
customField: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface FormattedExpressionCondition {
|
|
14
|
+
kind: 'expression';
|
|
15
|
+
field: string;
|
|
16
|
+
path: string;
|
|
17
|
+
operator: string;
|
|
18
|
+
value: string;
|
|
19
|
+
clazz: string;
|
|
20
|
+
customField: boolean;
|
|
21
|
+
}
|
|
22
|
+
interface FormattedContainerCondition {
|
|
23
|
+
kind: 'container';
|
|
24
|
+
resourceType: string;
|
|
25
|
+
conditions: PermissionCondition[];
|
|
26
|
+
customResource: boolean;
|
|
27
|
+
}
|
|
28
|
+
type FormattedCondition = FormattedFieldCondition | FormattedExpressionCondition | FormattedContainerCondition;
|
|
29
|
+
interface ActionOverview {
|
|
30
|
+
action: string;
|
|
31
|
+
grants: Permission[];
|
|
32
|
+
}
|
|
33
|
+
interface ResourceOverview {
|
|
34
|
+
resourceType: string;
|
|
35
|
+
actions: ActionOverview[];
|
|
36
|
+
}
|
|
37
|
+
export declare class AccessControlOverviewTabComponent {
|
|
38
|
+
private readonly metadataService;
|
|
39
|
+
private readonly translateService;
|
|
40
|
+
roleKey: string | null;
|
|
41
|
+
set permissions(value: Permission[] | null);
|
|
42
|
+
private readonly _permissions$;
|
|
43
|
+
readonly overview$: Observable<ResourceOverview[]>;
|
|
44
|
+
constructor(metadataService: PermissionSchemaMetadataService, translateService: TranslateService);
|
|
45
|
+
formatConditions(conditions: PermissionCondition[] | null | undefined, resourceType: string): FormattedCondition[];
|
|
46
|
+
isNoContext(contextResourceType: string | null | undefined): boolean;
|
|
47
|
+
private buildOverview;
|
|
48
|
+
private permissionGrants;
|
|
49
|
+
private formatCondition;
|
|
50
|
+
private formatField;
|
|
51
|
+
private formatExpression;
|
|
52
|
+
private formatContainer;
|
|
53
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AccessControlOverviewTabComponent, never>;
|
|
54
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<AccessControlOverviewTabComponent, "valtimo-access-control-overview-tab", never, { "roleKey": { "alias": "roleKey"; "required": false; }; "permissions": { "alias": "permissions"; "required": false; }; }, {}, never, never, true, never>;
|
|
55
|
+
}
|
|
56
|
+
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { OnDestroy, OnInit } from '@angular/core';
|
|
2
2
|
import { AccessControlService } from '../../services/access-control.service';
|
|
3
|
-
import { BehaviorSubject
|
|
3
|
+
import { BehaviorSubject } from 'rxjs';
|
|
4
4
|
import { ActivatedRoute, Router } from '@angular/router';
|
|
5
5
|
import { EditorModel, PageHeaderService, PageTitleService } from '@valtimo/components';
|
|
6
|
-
import {
|
|
6
|
+
import { AccessControlEditorTab, Permission, Role } from '../../models';
|
|
7
7
|
import { TranslateService } from '@ngx-translate/core';
|
|
8
8
|
import { AccessControlExportService } from '../../services/access-control-export.service';
|
|
9
9
|
import { GlobalNotificationService } from '@valtimo/shared';
|
|
@@ -18,6 +18,7 @@ export declare class AccessControlEditorComponent implements OnInit, OnDestroy {
|
|
|
18
18
|
private readonly accessControlExportService;
|
|
19
19
|
private readonly pageHeaderService;
|
|
20
20
|
readonly model$: BehaviorSubject<EditorModel>;
|
|
21
|
+
readonly permissions$: BehaviorSubject<Permission[]>;
|
|
21
22
|
readonly roleKey$: BehaviorSubject<string>;
|
|
22
23
|
readonly saveDisabled$: BehaviorSubject<boolean>;
|
|
23
24
|
readonly editorDisabled$: BehaviorSubject<boolean>;
|
|
@@ -25,8 +26,9 @@ export declare class AccessControlEditorComponent implements OnInit, OnDestroy {
|
|
|
25
26
|
readonly showDeleteModal$: BehaviorSubject<boolean>;
|
|
26
27
|
readonly showEditModal$: BehaviorSubject<boolean>;
|
|
27
28
|
readonly selectedRowKeys$: BehaviorSubject<string[]>;
|
|
28
|
-
readonly compactMode$: Observable<boolean>;
|
|
29
|
-
readonly
|
|
29
|
+
readonly compactMode$: import("rxjs").Observable<boolean>;
|
|
30
|
+
readonly $activeTab: import("@angular/core").WritableSignal<AccessControlEditorTab>;
|
|
31
|
+
protected readonly AccessControlEditorTab: typeof AccessControlEditorTab;
|
|
30
32
|
private _roleKeySubscription;
|
|
31
33
|
private _roleKey;
|
|
32
34
|
private readonly _updatedModelValue$;
|
|
@@ -40,6 +42,8 @@ export declare class AccessControlEditorComponent implements OnInit, OnDestroy {
|
|
|
40
42
|
showDeleteModal(): void;
|
|
41
43
|
showEditModal(): void;
|
|
42
44
|
onEdit(currentRoleKey: string, data: Role | null): void;
|
|
45
|
+
setActiveTab(tab: AccessControlEditorTab): void;
|
|
46
|
+
private restoreActiveTabFromUrl;
|
|
43
47
|
exportPermissions(): void;
|
|
44
48
|
private openRoleKeySubscription;
|
|
45
49
|
private getPermissions;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './access-control-labels';
|
package/lib/models/index.d.ts
CHANGED
|
@@ -1,2 +1,47 @@
|
|
|
1
1
|
type PermissionSchema = object;
|
|
2
|
-
|
|
2
|
+
interface SchemaAllOfBranch {
|
|
3
|
+
if?: {
|
|
4
|
+
properties?: {
|
|
5
|
+
resourceType?: {
|
|
6
|
+
const?: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
then?: {
|
|
11
|
+
properties?: {
|
|
12
|
+
action?: {
|
|
13
|
+
enum?: string[];
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
interface SchemaOneOfEntry {
|
|
19
|
+
const?: string;
|
|
20
|
+
}
|
|
21
|
+
interface SchemaCondListVariant {
|
|
22
|
+
allOf?: Array<{
|
|
23
|
+
$ref?: string;
|
|
24
|
+
properties?: {
|
|
25
|
+
field?: {
|
|
26
|
+
enum?: string[];
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
}>;
|
|
30
|
+
}
|
|
31
|
+
interface SchemaCondListDefinition {
|
|
32
|
+
items?: {
|
|
33
|
+
oneOf?: SchemaCondListVariant[];
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
interface SchemaShape {
|
|
37
|
+
items?: {
|
|
38
|
+
allOf?: SchemaAllOfBranch[];
|
|
39
|
+
properties?: {
|
|
40
|
+
resourceType?: {
|
|
41
|
+
oneOf?: SchemaOneOfEntry[];
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
definitions?: Record<string, SchemaCondListDefinition>;
|
|
46
|
+
}
|
|
47
|
+
export { PermissionSchema, SchemaShape };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
type ConditionOperator = '==' | '!=' | '>' | '>=' | '<' | '<=' | 'in' | 'list_contains';
|
|
2
|
+
interface FieldCondition {
|
|
3
|
+
type: 'field';
|
|
4
|
+
field: string;
|
|
5
|
+
operator: ConditionOperator;
|
|
6
|
+
value: unknown;
|
|
7
|
+
}
|
|
8
|
+
interface ExpressionCondition {
|
|
9
|
+
type: 'expression';
|
|
10
|
+
field: string;
|
|
11
|
+
path: string;
|
|
12
|
+
operator: ConditionOperator;
|
|
13
|
+
value: unknown;
|
|
14
|
+
clazz: string;
|
|
15
|
+
}
|
|
16
|
+
interface ContainerCondition {
|
|
17
|
+
type: 'container';
|
|
18
|
+
resourceType: string;
|
|
19
|
+
conditions: PermissionCondition[];
|
|
20
|
+
}
|
|
21
|
+
type PermissionCondition = FieldCondition | ExpressionCondition | ContainerCondition;
|
|
22
|
+
interface Permission {
|
|
23
|
+
resourceType: string;
|
|
24
|
+
action?: string;
|
|
25
|
+
actions?: string[];
|
|
26
|
+
roleKey: string;
|
|
27
|
+
conditions?: PermissionCondition[];
|
|
28
|
+
contextResourceType?: string;
|
|
29
|
+
contextConditions?: PermissionCondition[];
|
|
30
|
+
}
|
|
31
|
+
interface ResourcePermissionGroup {
|
|
32
|
+
resourceType: string;
|
|
33
|
+
permissions: Permission[];
|
|
34
|
+
}
|
|
35
|
+
export { ConditionOperator, ContainerCondition, ExpressionCondition, FieldCondition, Permission, PermissionCondition, ResourcePermissionGroup, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './resource-type-label.pipe';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PipeTransform } from '@angular/core';
|
|
2
|
+
import { TranslateService } from '@ngx-translate/core';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class ResourceTypeLabelPipe implements PipeTransform {
|
|
5
|
+
private readonly translateService;
|
|
6
|
+
constructor(translateService: TranslateService);
|
|
7
|
+
transform(fqn: string | null | undefined): string;
|
|
8
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ResourceTypeLabelPipe, never>;
|
|
9
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<ResourceTypeLabelPipe, "resourceTypeLabel", true>;
|
|
10
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HttpClient } from '@angular/common/http';
|
|
2
2
|
import { ConfigService } from '@valtimo/shared';
|
|
3
3
|
import { BehaviorSubject, Observable } from 'rxjs';
|
|
4
|
-
import { DeleteRolesRequest, PermissionSchema, Role } from '../models';
|
|
4
|
+
import { DeleteRolesRequest, Permission, PermissionSchema, Role } from '../models';
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
6
6
|
export declare class AccessControlService {
|
|
7
7
|
private readonly configService;
|
|
@@ -15,7 +15,7 @@ export declare class AccessControlService {
|
|
|
15
15
|
deleteRoles(request: DeleteRolesRequest): Observable<null>;
|
|
16
16
|
dispatchAction(actionResult: Observable<Role | null>): void;
|
|
17
17
|
loadRoles(): void;
|
|
18
|
-
getRolePermissions(roleKey: string): Observable<
|
|
18
|
+
getRolePermissions(roleKey: string): Observable<Permission[]>;
|
|
19
19
|
exportRolePermissions(roles: string[]): Observable<object[]>;
|
|
20
20
|
updateRolePermissions(roleKey: string, updatedPermission: object): Observable<object>;
|
|
21
21
|
getPermissionSchema(): Observable<PermissionSchema>;
|
package/lib/services/index.d.ts
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { PermissionSchema } from '../models';
|
|
3
|
+
import { AccessControlService } from './access-control.service';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class PermissionSchemaMetadataService {
|
|
6
|
+
private readonly accessControlService;
|
|
7
|
+
private readonly _knownResourceTypes$;
|
|
8
|
+
private readonly _fieldsByResourceType$;
|
|
9
|
+
readonly schema$: Observable<PermissionSchema>;
|
|
10
|
+
readonly actionsByResourceType$: Observable<Record<string, string[]>>;
|
|
11
|
+
readonly allResourceTypes$: Observable<string[]>;
|
|
12
|
+
constructor(accessControlService: AccessControlService);
|
|
13
|
+
isResourceTypeKnown(fqn: string): boolean;
|
|
14
|
+
isFieldKnown(resourceType: string, field: string): boolean;
|
|
15
|
+
private extractActionsByResourceType;
|
|
16
|
+
private extractKnownResourceTypes;
|
|
17
|
+
private extractFieldsByResourceType;
|
|
18
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PermissionSchemaMetadataService, never>;
|
|
19
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<PermissionSchemaMetadataService>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TranslateService } from '@ngx-translate/core';
|
|
2
|
+
import { ConditionOperator } from '../models';
|
|
3
|
+
declare function formatResourceType(translate: TranslateService, fqn: string): string;
|
|
4
|
+
declare function formatField(translate: TranslateService, resourceType: string, field: string): string;
|
|
5
|
+
declare function formatOperator(translate: TranslateService, operator: ConditionOperator): string;
|
|
6
|
+
declare function formatValue(translate: TranslateService, value: unknown): string;
|
|
7
|
+
declare function humanizeFieldPath(field: string): string;
|
|
8
|
+
export { formatField, formatOperator, formatResourceType, formatValue, humanizeFieldPath };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './format-condition';
|