@aristid/leav-types 1.6.0-9e3d23c8 → 1.6.0-a54099d3
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/apps/core/config/default.d.ts +1 -0
- package/apps/core/src/__tests__/e2e/api/_fixtures/fakeplugin/index.d.ts +5 -1
- package/apps/core/src/__tests__/e2e/api/e2eUtils.d.ts +3 -0
- package/apps/core/src/__tests__/e2e/api/permissions/dependentValuesTreeAttributePermissions.test.d.ts +1 -0
- package/apps/core/src/__tests__/e2e/api/taskUtils.d.ts +4 -0
- package/apps/core/src/__tests__/integration/infra/integrationTestRepoUtils.d.ts +2 -0
- package/apps/core/src/__tests__/integration/infra/permissionRepo.test.d.ts +1 -0
- package/apps/core/src/__tests__/mocks/attribute.d.ts +1 -0
- package/apps/core/src/_types/actionsList.d.ts +2 -0
- package/apps/core/src/_types/attribute.d.ts +5 -1
- package/apps/core/src/_types/config.d.ts +3 -1
- package/apps/core/src/_types/errors.d.ts +1 -0
- package/apps/core/src/_types/permissions.d.ts +20 -1
- package/apps/core/src/app/core/libraryApp/libraryApp.d.ts +3 -1
- package/apps/core/src/app/core/permissionApp/_types.d.ts +2 -1
- package/apps/core/src/domain/attribute/helpers/attributeALHelper.d.ts +2 -1
- package/apps/core/src/domain/export/exportProfileDomain.d.ts +18 -8
- package/apps/core/src/domain/permission/_types.d.ts +4 -1
- package/apps/core/src/domain/permission/attributeDependentValuesPermissionDomain.d.ts +35 -0
- package/apps/core/src/domain/permission/helpers/permissionByUserGroups.d.ts +2 -1
- package/apps/core/src/domain/permission/index.d.ts +1 -0
- package/apps/core/src/domain/permission/permissionDomain.d.ts +4 -2
- package/apps/core/src/domain/value/helpers/canSaveRecordValue.d.ts +3 -1
- package/apps/core/src/domain/value/helpers/postDeleteValue.d.ts +28 -0
- package/apps/core/src/domain/value/helpers/postSaveValue.d.ts +28 -0
- package/apps/core/src/domain/value/valueDomain.d.ts +3 -1
- package/apps/core/src/infra/db/helpers/libraryUtils.d.ts +2 -0
- package/apps/core/src/infra/permission/permissionRepo.d.ts +3 -2
- package/package.json +1 -1
|
@@ -128,6 +128,7 @@ export declare namespace permissions {
|
|
|
128
128
|
let enableCache_1: boolean;
|
|
129
129
|
export { enableCache_1 as enableCache };
|
|
130
130
|
export let enableAccessRecordByDefaultBackendFilter: boolean;
|
|
131
|
+
export let enableAttributeDependentValuesPermissions: boolean;
|
|
131
132
|
}
|
|
132
133
|
export declare namespace amqp {
|
|
133
134
|
namespace connOpt {
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { type i18n } from 'i18next';
|
|
2
2
|
import { type IPluginInitModule } from '_types/plugin';
|
|
3
|
+
import { type IValueRepo } from '../../../../../infra/value/valueRepo';
|
|
4
|
+
import { type IAttributeDomain } from '../../../../../domain/attribute/attributeDomain';
|
|
3
5
|
interface IDeps {
|
|
4
6
|
translator: i18n;
|
|
7
|
+
'core.infra.value': IValueRepo;
|
|
8
|
+
'core.domain.attribute': IAttributeDomain;
|
|
5
9
|
}
|
|
6
|
-
export default function ({ translator }: IDeps): IPluginInitModule;
|
|
10
|
+
export default function ({ translator, 'core.infra.value': valueRepo, 'core.domain.attribute': attributeDomain, }: IDeps): IPluginInitModule;
|
|
7
11
|
export {};
|
|
@@ -5,6 +5,7 @@ import FormData from 'form-data';
|
|
|
5
5
|
import { type ActionsListConfig } from '_types/actionsList';
|
|
6
6
|
import { type ITreeElement } from '_types/tree';
|
|
7
7
|
import { AttributeFormats, type AttributeTypes, type IAttributeVersionsConf, type IEmbeddedAttribute } from '../../../_types/attribute';
|
|
8
|
+
import { type ITreePermissionsDependentValuesConf } from '_types/permissions';
|
|
8
9
|
export interface IGlobalThis {
|
|
9
10
|
guestUser: IE2EUserParams;
|
|
10
11
|
nonAdminUser: IE2EUserParams;
|
|
@@ -51,6 +52,7 @@ export declare function gqlSaveAttribute(params: {
|
|
|
51
52
|
unique?: boolean;
|
|
52
53
|
actionsList?: ActionsListConfig;
|
|
53
54
|
required?: boolean;
|
|
55
|
+
permissions_conf_dependent_values?: ITreePermissionsDependentValuesConf;
|
|
54
56
|
}): Promise<any>;
|
|
55
57
|
export declare function gqlSaveTree(id: string, label: string, libraries: string[]): Promise<any>;
|
|
56
58
|
export declare function gqlCreateRecord(library: string): Promise<string>;
|
|
@@ -63,6 +65,7 @@ export declare function gqlCreateRecord(library: string): Promise<string>;
|
|
|
63
65
|
* @return Node ID
|
|
64
66
|
*/
|
|
65
67
|
export declare function gqlAddElemToTree(treeId: string, element: ITreeElement, parent?: string | null, order?: number): Promise<string>;
|
|
68
|
+
export declare function gqlGetValue(libraryId: string, recordId: string, attributeId: string): Promise<any>;
|
|
66
69
|
export declare function gqlSaveValue(attributeId: string, libraryId: string, recordId: string, value: string | number): Promise<void>;
|
|
67
70
|
export declare function gqlSaveVersionProfile(profileId: string, label: string, trees: string[]): Promise<void>;
|
|
68
71
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type ITask, TaskStatus } from '../../../_types/tasksManager';
|
|
2
|
+
export declare function getTask(taskId: string): Promise<ITask>;
|
|
3
|
+
export declare function waitForTaskCompletion(id: string, timeout?: number, interval?: number): Promise<ITask>;
|
|
4
|
+
export declare function waitForTaskCompletedWithStatus(taskId: string, expectedStatus: TaskStatus.DONE | TaskStatus.FAILED): Promise<ITask>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { type ILibraryRepo } from 'infra/library/libraryRepo';
|
|
2
|
+
import { type IPermissionRepo } from 'infra/permission/permissionRepo';
|
|
2
3
|
import { type IRecordRepo } from 'infra/record/recordRepo';
|
|
3
4
|
import { type ITreeRepo } from 'infra/tree/treeRepo';
|
|
4
5
|
export declare const getLibraryRepo: () => ILibraryRepo;
|
|
5
6
|
export declare const getRecordRepo: () => IRecordRepo;
|
|
6
7
|
export declare const getTreeRepo: () => ITreeRepo;
|
|
8
|
+
export declare const getPermissionRepo: () => IPermissionRepo;
|
|
7
9
|
export * from '../integrationTestUtils';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -33,6 +33,7 @@ export declare const mockAttrTree: {
|
|
|
33
33
|
settings?: import("../../_types/shared").IKeyValue<any>;
|
|
34
34
|
multi_link_display_option?: MultiDisplayOption;
|
|
35
35
|
multi_tree_display_option?: MultiDisplayOption;
|
|
36
|
+
permissions_conf_dependent_values?: import("../../_types/permissions").ITreePermissionsDependentValuesConf;
|
|
36
37
|
label?: import("../../_types/systemTranslation").ISystemTranslation | string;
|
|
37
38
|
};
|
|
38
39
|
export declare const mockAttrTreeVersionable: IAttribute;
|
|
@@ -5,7 +5,9 @@ import { type IValue } from './value';
|
|
|
5
5
|
import { type Errors } from './errors';
|
|
6
6
|
export declare enum ActionsListEvents {
|
|
7
7
|
SAVE_VALUE = "saveValue",
|
|
8
|
+
POST_SAVE_VALUE = "postSaveValue",
|
|
8
9
|
DELETE_VALUE = "deleteValue",
|
|
10
|
+
POST_DELETE_VALUE = "postDeleteValue",
|
|
9
11
|
GET_VALUE = "getValue"
|
|
10
12
|
}
|
|
11
13
|
export declare enum ActionsListIOTypes {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ActionsListEvents, type ActionsListIOTypes, type ActionsListConfig } from './actionsList';
|
|
2
|
-
import { type ITreePermissionsConf } from './permissions';
|
|
2
|
+
import { type ITreePermissionsDependentValuesConf, type ITreePermissionsConf } from './permissions';
|
|
3
3
|
import { type IQueryInfos } from './queryInfos';
|
|
4
4
|
import { type IRecord } from './record';
|
|
5
5
|
import { type IGetCoreEntitiesParams, type IKeyValue } from './shared';
|
|
@@ -28,6 +28,10 @@ export interface IAttribute extends ICoreEntity {
|
|
|
28
28
|
settings?: IKeyValue<any>;
|
|
29
29
|
multi_link_display_option?: MultiDisplayOption;
|
|
30
30
|
multi_tree_display_option?: MultiDisplayOption;
|
|
31
|
+
/**
|
|
32
|
+
* only for tree attribute
|
|
33
|
+
*/
|
|
34
|
+
permissions_conf_dependent_values?: ITreePermissionsDependentValuesConf;
|
|
31
35
|
}
|
|
32
36
|
export declare enum ValueVersionMode {
|
|
33
37
|
SIMPLE = "simple",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Options } from 'amqplib';
|
|
2
2
|
import { type IKeyValue } from './shared';
|
|
3
|
-
import { type PermissionsActions, type AdminPermissionsActions, type ApplicationPermissionsActions, type AttributePermissionsActions, type LibraryPermissionsActions, type PermissionTypes, type RecordAttributePermissionsActions, type RecordPermissionsActions, type TreeNodePermissionsActions, type TreePermissionsActions } from './permissions';
|
|
3
|
+
import { type PermissionsActions, type AdminPermissionsActions, type ApplicationPermissionsActions, type AttributePermissionsActions, type LibraryPermissionsActions, type PermissionTypes, type RecordAttributePermissionsActions, type RecordPermissionsActions, type TreeNodePermissionsActions, type TreePermissionsActions, type AttributeDependentValuesPermissionsActions } from './permissions';
|
|
4
4
|
export interface IConfig {
|
|
5
5
|
coreMode: CoreMode;
|
|
6
6
|
server: IServer;
|
|
@@ -158,6 +158,7 @@ interface IPermissionsByTypesAndActions {
|
|
|
158
158
|
[PermissionTypes.ADMIN]?: IPermissionsByActions<AdminPermissionsActions>;
|
|
159
159
|
[PermissionTypes.APPLICATION]?: IPermissionsByActions<ApplicationPermissionsActions>;
|
|
160
160
|
[PermissionTypes.ATTRIBUTE]?: IPermissionsByActions<AttributePermissionsActions>;
|
|
161
|
+
[PermissionTypes.ATTRIBUTE_DEPENDENT_VALUES]?: IPermissionsByActions<AttributeDependentValuesPermissionsActions>;
|
|
161
162
|
[PermissionTypes.LIBRARY]?: IPermissionsByActions<LibraryPermissionsActions>;
|
|
162
163
|
[PermissionTypes.RECORD]?: IPermissionsByActions<RecordPermissionsActions>;
|
|
163
164
|
[PermissionTypes.RECORD_ATTRIBUTE]?: IPermissionsByActions<RecordAttributePermissionsActions>;
|
|
@@ -170,6 +171,7 @@ export interface IPermissions {
|
|
|
170
171
|
adminGroup: IPermissionsByTypesAndActions;
|
|
171
172
|
enableCache: boolean;
|
|
172
173
|
enableAccessRecordByDefaultBackendFilter: boolean;
|
|
174
|
+
enableAttributeDependentValuesPermissions: boolean;
|
|
173
175
|
}
|
|
174
176
|
export interface IAmqp {
|
|
175
177
|
connOpt: Options.Connect;
|
|
@@ -8,6 +8,7 @@ export declare enum Errors {
|
|
|
8
8
|
ATTRIBUTE_USED_BY_LIBRARY = "ATTRIBUTE_USED_BY_LIBRARY",
|
|
9
9
|
ATTRIBUTE_USED_IN_METADATA = "ATTRIBUTE_USED_IN_METADATA",
|
|
10
10
|
CANNOT_SAVE_METADATA = "CANNOT_SAVE_METADATA",
|
|
11
|
+
CANNOT_SAVE_PERMISSIONS_DEPENDENT_VALUES = "CANNOT_SAVE_PERMISSIONS_DEPENDENT_VALUES",
|
|
11
12
|
DUPLICATE_DIRECTORY_NAMES = "DUPLICATE_DIRECTORY_NAMES",
|
|
12
13
|
DUPLICATE_FILENAMES = "DUPLICATE_FILENAMES",
|
|
13
14
|
ELEMENT_ALREADY_PRESENT = "ELEMENT_ALREADY_PRESENT",
|
|
@@ -5,6 +5,7 @@ export declare enum PermissionTypes {
|
|
|
5
5
|
ADMIN = "admin",
|
|
6
6
|
LIBRARY = "library",
|
|
7
7
|
ATTRIBUTE = "attribute",
|
|
8
|
+
ATTRIBUTE_DEPENDENT_VALUES = "attribute_dependent_values",
|
|
8
9
|
TREE = "tree",
|
|
9
10
|
TREE_NODE = "tree_node",
|
|
10
11
|
TREE_LIBRARY = "tree_library",
|
|
@@ -33,6 +34,9 @@ export declare enum AttributePermissionsActions {
|
|
|
33
34
|
ACCESS_ATTRIBUTE = "access_attribute",
|
|
34
35
|
EDIT_VALUE = "edit_value"
|
|
35
36
|
}
|
|
37
|
+
export declare enum AttributeDependentValuesPermissionsActions {
|
|
38
|
+
SET_VALUE = "set_value"
|
|
39
|
+
}
|
|
36
40
|
export declare enum TreePermissionsActions {
|
|
37
41
|
ACCESS_TREE = "access_tree",
|
|
38
42
|
EDIT_CHILDREN = "edit_children",
|
|
@@ -82,7 +86,7 @@ export declare enum AdminPermissionsActions {
|
|
|
82
86
|
ACCESS_LOGS = "admin_access_logs",
|
|
83
87
|
IMPORT_CONFIG_CLEAR_DATABASE = "admin_import_config_clear_database"
|
|
84
88
|
}
|
|
85
|
-
export type PermissionsActions = LibraryPermissionsActions | RecordPermissionsActions | RecordAttributePermissionsActions | AdminPermissionsActions | AttributePermissionsActions | TreePermissionsActions | TreeNodePermissionsActions | ApplicationPermissionsActions;
|
|
89
|
+
export type PermissionsActions = LibraryPermissionsActions | RecordPermissionsActions | RecordAttributePermissionsActions | AdminPermissionsActions | AttributePermissionsActions | AttributeDependentValuesPermissionsActions | TreePermissionsActions | TreeNodePermissionsActions | ApplicationPermissionsActions;
|
|
86
90
|
export interface ILabeledPermissionsAction {
|
|
87
91
|
label: ISystemTranslation;
|
|
88
92
|
name: PermissionsActions | string;
|
|
@@ -104,6 +108,12 @@ export interface ITreePermissionsConf {
|
|
|
104
108
|
*/
|
|
105
109
|
relation: PermissionsRelations;
|
|
106
110
|
}
|
|
111
|
+
export interface ITreePermissionsDependentValuesConf {
|
|
112
|
+
/**
|
|
113
|
+
* IDs of attributes used for permissions
|
|
114
|
+
*/
|
|
115
|
+
dependenciesTreeAttributes: string[];
|
|
116
|
+
}
|
|
107
117
|
export interface IPermissionsTreeTarget {
|
|
108
118
|
/**
|
|
109
119
|
* Tree ID
|
|
@@ -114,6 +124,9 @@ export interface IPermissionsTreeTarget {
|
|
|
114
124
|
*/
|
|
115
125
|
nodeId: string | null;
|
|
116
126
|
}
|
|
127
|
+
export interface IPermissionsDependenciesTreeTarget extends IPermissionsTreeTarget {
|
|
128
|
+
attributeId: string;
|
|
129
|
+
}
|
|
117
130
|
export interface IPermission {
|
|
118
131
|
/**
|
|
119
132
|
* Permission type
|
|
@@ -136,6 +149,12 @@ export interface IPermission {
|
|
|
136
149
|
};
|
|
137
150
|
/**
|
|
138
151
|
* What element on permissions tree is concerned by this permission
|
|
152
|
+
* In case of type PermissionTypes.ATTRIBUTE_DEPENDENT_VALUES, this is the value tree target
|
|
139
153
|
*/
|
|
140
154
|
permissionTreeTarget?: IPermissionsTreeTarget;
|
|
155
|
+
/**
|
|
156
|
+
* For dependent values tree attribute permissions, the list of attributes on which this permission depends
|
|
157
|
+
* Only for PermissionTypes.ATTRIBUTE_DEPENDENT_VALUES
|
|
158
|
+
*/
|
|
159
|
+
dependenciesTreeTargets?: IPermissionsDependenciesTreeTarget[];
|
|
141
160
|
}
|
|
@@ -6,6 +6,7 @@ import { type ITreeDomain } from 'domain/tree/treeDomain';
|
|
|
6
6
|
import { type IViewDomain } from 'domain/view/viewDomain';
|
|
7
7
|
import { type IGraphqlAppModule, type IGraphqlApp } from '../../graphql/graphqlApp';
|
|
8
8
|
import { type ICoreApp } from '../coreApp';
|
|
9
|
+
import { type IExportProfileDomain } from 'domain/export/exportProfileDomain';
|
|
9
10
|
export type ICoreLibraryApp = IGraphqlAppModule;
|
|
10
11
|
interface IDeps {
|
|
11
12
|
'core.domain.library'?: ILibraryDomain;
|
|
@@ -14,8 +15,9 @@ interface IDeps {
|
|
|
14
15
|
'core.domain.tree'?: ITreeDomain;
|
|
15
16
|
'core.domain.view'?: IViewDomain;
|
|
16
17
|
'core.domain.permission'?: IPermissionDomain;
|
|
18
|
+
'core.domain.export.exportProfile'?: IExportProfileDomain;
|
|
17
19
|
'core.app.graphql'?: IGraphqlApp;
|
|
18
20
|
'core.app.core'?: ICoreApp;
|
|
19
21
|
}
|
|
20
|
-
export default function ({ 'core.domain.library': libraryDomain, 'core.domain.record': recordDomain, 'core.domain.attribute': attributeDomain, 'core.domain.tree': treeDomain, 'core.domain.view': viewDomain, 'core.domain.permission': permissionDomain, 'core.app.graphql': graphqlApp, 'core.app.core': coreApp, }?: IDeps): ICoreLibraryApp;
|
|
22
|
+
export default function ({ 'core.domain.library': libraryDomain, 'core.domain.record': recordDomain, 'core.domain.attribute': attributeDomain, 'core.domain.tree': treeDomain, 'core.domain.view': viewDomain, 'core.domain.permission': permissionDomain, 'core.domain.export.exportProfile': exportProfileDomain, 'core.app.graphql': graphqlApp, 'core.app.core': coreApp, }?: IDeps): ICoreLibraryApp;
|
|
21
23
|
export {};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { type IPermissionsTreeTarget, type PermissionsActions, type PermissionTypes } from '_types/permissions';
|
|
1
|
+
import { type IPermissionsDependenciesTreeTarget, type IPermissionsTreeTarget, type PermissionsActions, type PermissionTypes } from '_types/permissions';
|
|
2
2
|
export interface IInheritedPermissionsQueryParams {
|
|
3
3
|
type: PermissionTypes;
|
|
4
4
|
applyTo: string;
|
|
5
5
|
actions: PermissionsActions[];
|
|
6
6
|
userGroupNodeId: string;
|
|
7
7
|
permissionTreeTarget: IPermissionsTreeTarget;
|
|
8
|
+
dependenciesTreeTargets: IPermissionsDependenciesTreeTarget[];
|
|
8
9
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type IUtils } from 'utils/utils';
|
|
2
2
|
import { type ActionsListConfig } from '../../../_types/actionsList';
|
|
3
3
|
import { type IAttribute, type IOAllowedTypes } from '../../../_types/attribute';
|
|
4
|
-
|
|
4
|
+
declare const getAllowedInputTypes: (attribute: IAttribute) => IOAllowedTypes;
|
|
5
|
+
export default getAllowedInputTypes;
|
|
5
6
|
export declare const getAllowedOutputTypes: (attribute: IAttribute) => IOAllowedTypes;
|
|
6
7
|
export declare const getActionsListToSave: (attrDataToSave: IAttribute, existingAttrData: IAttribute, newAttr: boolean, utils: IUtils) => ActionsListConfig;
|
|
@@ -1,23 +1,33 @@
|
|
|
1
1
|
import { type ILibraryDomain } from '../library/libraryDomain';
|
|
2
2
|
import { type IQueryInfos } from '../../_types/queryInfos';
|
|
3
|
+
import { type IAttributeDomain } from 'domain/attribute/attributeDomain';
|
|
4
|
+
import { type IConfig } from '_types/config';
|
|
5
|
+
export interface IExportProfileColumn {
|
|
6
|
+
columnLabel: string;
|
|
7
|
+
attribute: string;
|
|
8
|
+
}
|
|
9
|
+
export interface IExportProfile {
|
|
10
|
+
label: string;
|
|
11
|
+
columns: IExportProfileColumn[];
|
|
12
|
+
error?: {
|
|
13
|
+
message: string;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
3
16
|
export interface IExportProfileConfig {
|
|
4
17
|
defaultProfile: string;
|
|
5
|
-
profiles:
|
|
6
|
-
label: string;
|
|
7
|
-
columns: Array<{
|
|
8
|
-
columnLabel: string;
|
|
9
|
-
attribute: string;
|
|
10
|
-
}>;
|
|
11
|
-
}>;
|
|
18
|
+
profiles: IExportProfile[];
|
|
12
19
|
}
|
|
13
20
|
export interface IExportColumn {
|
|
14
21
|
columnLabel: string;
|
|
15
22
|
attribute: string;
|
|
16
23
|
}
|
|
17
24
|
export interface IExportProfileDomain {
|
|
25
|
+
getExportProfileConfig(libraryId: string, ctx: IQueryInfos): Promise<IExportProfileConfig | null>;
|
|
18
26
|
getColumnsFromProfileConfig(profile: string | undefined, library: string, ctx: IQueryInfos): Promise<IExportColumn[]>;
|
|
19
27
|
}
|
|
20
28
|
export interface IExportProfileDomainDeps {
|
|
21
29
|
'core.domain.library': ILibraryDomain;
|
|
30
|
+
'core.domain.attribute': IAttributeDomain;
|
|
31
|
+
config: IConfig;
|
|
22
32
|
}
|
|
23
|
-
export default function ({ 'core.domain.library': libraryDomain }: IExportProfileDomainDeps): IExportProfileDomain;
|
|
33
|
+
export default function ({ 'core.domain.library': libraryDomain, 'core.domain.attribute': attributeDomain, config, }: IExportProfileDomainDeps): IExportProfileDomain;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AdminPermissionsActions, type ApplicationPermissionsActions, type AttributePermissionsActions, type IPermissionsTreeTarget, type ITreePermissionsConf, type LibraryPermissionsActions, type PermissionsActions, type PermissionTypes, type RecordAttributePermissionsActions, type RecordPermissionsActions, type TreeNodePermissionsActions, type TreePermissionsActions } from '_types/permissions';
|
|
1
|
+
import { type IPermissionsDependenciesTreeTarget, type AdminPermissionsActions, type ApplicationPermissionsActions, type AttributePermissionsActions, type IPermissionsTreeTarget, type ITreePermissionsConf, type LibraryPermissionsActions, type PermissionsActions, type PermissionTypes, type RecordAttributePermissionsActions, type RecordPermissionsActions, type TreeNodePermissionsActions, type TreePermissionsActions } from '_types/permissions';
|
|
2
2
|
import { type IQueryInfos } from '_types/queryInfos';
|
|
3
3
|
import { type IGetDefaultPermissionParams } from './helpers/defaultPermission';
|
|
4
4
|
export declare const PERMISSIONS_CACHE_HEADER = "permissions";
|
|
@@ -15,6 +15,7 @@ export interface IGetSimplePermissionsParams {
|
|
|
15
15
|
action: PermissionsActions;
|
|
16
16
|
usersGroupNodeId: string;
|
|
17
17
|
permissionTreeTarget?: IPermissionsTreeTarget;
|
|
18
|
+
dependenciesTreeTargets?: IPermissionsDependenciesTreeTarget[];
|
|
18
19
|
ctx: IQueryInfos;
|
|
19
20
|
}
|
|
20
21
|
export interface IGetPermissionsByActionsParams {
|
|
@@ -23,6 +24,7 @@ export interface IGetPermissionsByActionsParams {
|
|
|
23
24
|
actions: PermissionsActions[];
|
|
24
25
|
usersGroupNodeId: string;
|
|
25
26
|
permissionTreeTarget?: IPermissionsTreeTarget;
|
|
27
|
+
dependenciesTreeTargets?: IPermissionsDependenciesTreeTarget[];
|
|
26
28
|
ctx: IQueryInfos;
|
|
27
29
|
}
|
|
28
30
|
export type PermByActionsRes = {
|
|
@@ -121,6 +123,7 @@ export interface IGetInheritedPermissionsParams {
|
|
|
121
123
|
action: PermissionsActions;
|
|
122
124
|
userGroupId: string;
|
|
123
125
|
permissionTreeTarget?: IPermissionsTreeTarget;
|
|
126
|
+
dependenciesTreeTargets?: IPermissionsDependenciesTreeTarget[];
|
|
124
127
|
ctx: IQueryInfos;
|
|
125
128
|
}
|
|
126
129
|
export interface IIsAllowedParams {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type IQueryInfos } from '_types/queryInfos';
|
|
2
|
+
import { type IValueRepo } from 'infra/value/valueRepo';
|
|
3
|
+
import { type AttributeDependentValuesPermissionsActions, type IPermissionsDependenciesTreeTarget, type IPermissionsTreeTarget } from '../../_types/permissions';
|
|
4
|
+
import { type IAttributeDomain } from '../attribute/attributeDomain';
|
|
5
|
+
import { type IPermissionByUserGroupsHelper } from './helpers/permissionByUserGroups';
|
|
6
|
+
import { type IElementAncestorsHelper } from 'domain/tree/helpers/elementAncestors';
|
|
7
|
+
import { type IDefaultPermissionHelper } from './helpers/defaultPermission';
|
|
8
|
+
import { type IConfig } from '_types/config';
|
|
9
|
+
export interface IAttributeDependentValuesPermissionDomain {
|
|
10
|
+
getAttributeDependentValuesPermission(params: {
|
|
11
|
+
action: AttributeDependentValuesPermissionsActions;
|
|
12
|
+
attributeId: string;
|
|
13
|
+
recordLibrary: string;
|
|
14
|
+
recordId: string;
|
|
15
|
+
valueNodeId: string;
|
|
16
|
+
ctx: IQueryInfos;
|
|
17
|
+
}): Promise<boolean>;
|
|
18
|
+
getInheritedAttributeDependentValuesPermission(params: {
|
|
19
|
+
action: AttributeDependentValuesPermissionsActions;
|
|
20
|
+
attributeId: string;
|
|
21
|
+
userGroupId: string;
|
|
22
|
+
permissionTreeTarget: IPermissionsTreeTarget;
|
|
23
|
+
dependenciesTreeTargets: IPermissionsDependenciesTreeTarget[];
|
|
24
|
+
ctx: IQueryInfos;
|
|
25
|
+
}): Promise<boolean>;
|
|
26
|
+
}
|
|
27
|
+
export interface IRecordAttributePermissionDomainDeps {
|
|
28
|
+
'core.domain.permission.helpers.permissionByUserGroups': IPermissionByUserGroupsHelper;
|
|
29
|
+
'core.domain.permission.helpers.defaultPermission': IDefaultPermissionHelper;
|
|
30
|
+
'core.domain.attribute': IAttributeDomain;
|
|
31
|
+
'core.domain.tree.helpers.elementAncestors': IElementAncestorsHelper;
|
|
32
|
+
'core.infra.value': IValueRepo;
|
|
33
|
+
config: IConfig;
|
|
34
|
+
}
|
|
35
|
+
export default function (deps: IRecordAttributePermissionDomainDeps): IAttributeDependentValuesPermissionDomain;
|
|
@@ -2,7 +2,7 @@ import { type IReducePermissionsArrayHelper } from './reducePermissionsArray';
|
|
|
2
2
|
import { type ISimplePermissionHelper } from './simplePermission';
|
|
3
3
|
import { type IDefaultPermissionHelper } from './defaultPermission';
|
|
4
4
|
import { type TreePath } from '../../../_types/tree';
|
|
5
|
-
import { type
|
|
5
|
+
import { PermissionTypes, type IPermissionsDependenciesTreeTarget, type PermissionsActions } from '../../../_types/permissions';
|
|
6
6
|
import { type IQueryInfos } from '../../../_types/queryInfos';
|
|
7
7
|
import { type ICachesService } from '../../../infra/cache/cacheService';
|
|
8
8
|
import { type IConfig } from '_types/config';
|
|
@@ -23,6 +23,7 @@ interface IGetPermissionByUserGroupsParams {
|
|
|
23
23
|
tree: string;
|
|
24
24
|
path: TreePath;
|
|
25
25
|
};
|
|
26
|
+
dependenciesTreeTargets?: IPermissionsDependenciesTreeTarget[];
|
|
26
27
|
getDefaultGlobalPermission?: GetDefaultGlobalPermission;
|
|
27
28
|
ctx: IQueryInfos;
|
|
28
29
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { default as admin } from './adminPermissionDomain';
|
|
2
2
|
export { default as application } from './applicationPermissionDomain';
|
|
3
3
|
export { default as attribute } from './attributePermissionDomain';
|
|
4
|
+
export { default as attributeDependentValues } from './attributeDependentValuesPermissionDomain';
|
|
4
5
|
export { default as library } from './libraryPermissionDomain';
|
|
5
6
|
export { default } from './permissionDomain';
|
|
6
7
|
export { default as recordAttribute } from './recordAttributePermissionDomain';
|
|
@@ -8,6 +8,7 @@ import { type ILabeledPermissionsAction, type IPermission, PermissionTypes } fro
|
|
|
8
8
|
import { type IAdminPermissionDomain } from './adminPermissionDomain';
|
|
9
9
|
import { type IApplicationPermissionDomain } from './applicationPermissionDomain';
|
|
10
10
|
import { type IAttributePermissionDomain } from './attributePermissionDomain';
|
|
11
|
+
import { type IAttributeDependentValuesPermissionDomain } from './attributeDependentValuesPermissionDomain';
|
|
11
12
|
import { type ILibraryPermissionDomain } from './libraryPermissionDomain';
|
|
12
13
|
import { type IRecordAttributePermissionDomain } from './recordAttributePermissionDomain';
|
|
13
14
|
import { type IRecordPermissionDomain } from './recordPermissionDomain';
|
|
@@ -18,11 +19,11 @@ import { type IGetActionsByTypeParams, type IGetInheritedPermissionsParams, type
|
|
|
18
19
|
import { type IDefaultPermissionHelper } from './helpers/defaultPermission';
|
|
19
20
|
export interface IPermissionDomain {
|
|
20
21
|
savePermission(permData: IPermission, ctx: IQueryInfos): Promise<IPermission>;
|
|
21
|
-
getPermissionsByActions({ type, applyTo, actions, usersGroupNodeId, permissionTreeTarget, ctx, }: IGetPermissionsByActionsParams): Promise<PermByActionsRes>;
|
|
22
|
+
getPermissionsByActions({ type, applyTo, actions, usersGroupNodeId, permissionTreeTarget, dependenciesTreeTargets, ctx, }: IGetPermissionsByActionsParams): Promise<PermByActionsRes>;
|
|
22
23
|
/**
|
|
23
24
|
* Retrieve herited permission: ignore permission defined on given element, force retrieval of herited permission
|
|
24
25
|
*/
|
|
25
|
-
getInheritedPermissions({ type, applyTo, action, userGroupId, permissionTreeTarget, ctx, }: IGetInheritedPermissionsParams): Promise<boolean>;
|
|
26
|
+
getInheritedPermissions({ type, applyTo, action, userGroupId, permissionTreeTarget, dependenciesTreeTargets, ctx, }: IGetInheritedPermissionsParams): Promise<boolean>;
|
|
26
27
|
isAllowed({ type, action, applyTo, target, ctx }: IIsAllowedParams): Promise<boolean>;
|
|
27
28
|
getActionsByType(params: IGetActionsByTypeParams): Promise<ILabeledPermissionsAction[]>;
|
|
28
29
|
registerActions(type: PermissionTypes, actions: string[], applyOn?: string[]): void;
|
|
@@ -33,6 +34,7 @@ export interface IPermissionDomainDeps {
|
|
|
33
34
|
'core.domain.permission.library': ILibraryPermissionDomain;
|
|
34
35
|
'core.domain.permission.record': IRecordPermissionDomain;
|
|
35
36
|
'core.domain.permission.attribute': IAttributePermissionDomain;
|
|
37
|
+
'core.domain.permission.attributeDependentValues': IAttributeDependentValuesPermissionDomain;
|
|
36
38
|
'core.domain.permission.recordAttribute': IRecordAttributePermissionDomain;
|
|
37
39
|
'core.domain.permission.tree': ITreePermissionDomain;
|
|
38
40
|
'core.domain.permission.treeNode': ITreeNodePermissionDomain;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { type IAttributeDependentValuesPermissionDomain } from 'domain/permission/attributeDependentValuesPermissionDomain';
|
|
1
2
|
import { type IRecordAttributePermissionDomain } from 'domain/permission/recordAttributePermissionDomain';
|
|
2
3
|
import { type IRecordPermissionDomain } from 'domain/permission/recordPermissionDomain';
|
|
3
|
-
import { type IAttribute } from '_types/attribute';
|
|
4
|
+
import { type IAttribute } from '../../../_types/attribute';
|
|
4
5
|
import { type IConfig } from '_types/config';
|
|
5
6
|
import { type IQueryInfos } from '_types/queryInfos';
|
|
6
7
|
import { type IValue } from '_types/value';
|
|
@@ -21,6 +22,7 @@ interface ICanSaveRecordValueParams {
|
|
|
21
22
|
deps: {
|
|
22
23
|
recordPermissionDomain: IRecordPermissionDomain;
|
|
23
24
|
recordAttributePermissionDomain: IRecordAttributePermissionDomain;
|
|
25
|
+
attributeDependentValuesPermissionDomain: IAttributeDependentValuesPermissionDomain;
|
|
24
26
|
config: IConfig;
|
|
25
27
|
};
|
|
26
28
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type IActionsListDomain } from 'domain/actionsList/actionsListDomain';
|
|
2
|
+
import { type IAttributeDomain } from 'domain/attribute/attributeDomain';
|
|
3
|
+
import { type IUtils } from 'utils/utils';
|
|
4
|
+
import { type IAttribute } from '_types/attribute';
|
|
5
|
+
import { type IQueryInfos } from '_types/queryInfos';
|
|
6
|
+
import { type IValue } from '_types/value';
|
|
7
|
+
/**
|
|
8
|
+
* Parameters for post-delete value processing.
|
|
9
|
+
*/
|
|
10
|
+
interface IPostDeleteValueParams {
|
|
11
|
+
libraryId: string;
|
|
12
|
+
recordId: string;
|
|
13
|
+
attribute: IAttribute;
|
|
14
|
+
value: IValue;
|
|
15
|
+
ctx: IQueryInfos;
|
|
16
|
+
deps: {
|
|
17
|
+
actionsListDomain: IActionsListDomain;
|
|
18
|
+
attributeDomain: IAttributeDomain;
|
|
19
|
+
utils: IUtils;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Executes post-delete action lists on deleted value
|
|
24
|
+
* Action lists can perform side effects
|
|
25
|
+
* Unlike pre-delete value actions, this runs AFTER the value is persisted to the database.
|
|
26
|
+
*/
|
|
27
|
+
declare const postDeleteValue: (params: IPostDeleteValueParams) => Promise<void>;
|
|
28
|
+
export default postDeleteValue;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type IActionsListDomain } from 'domain/actionsList/actionsListDomain';
|
|
2
|
+
import { type IAttributeDomain } from 'domain/attribute/attributeDomain';
|
|
3
|
+
import { type IUtils } from 'utils/utils';
|
|
4
|
+
import { type IAttribute } from '_types/attribute';
|
|
5
|
+
import { type IQueryInfos } from '_types/queryInfos';
|
|
6
|
+
import { type IValue } from '_types/value';
|
|
7
|
+
/**
|
|
8
|
+
* Parameters for post-save value processing.
|
|
9
|
+
*/
|
|
10
|
+
interface IPostSaveValueParams {
|
|
11
|
+
libraryId: string;
|
|
12
|
+
recordId: string;
|
|
13
|
+
attribute: IAttribute;
|
|
14
|
+
value: IValue;
|
|
15
|
+
ctx: IQueryInfos;
|
|
16
|
+
deps: {
|
|
17
|
+
actionsListDomain: IActionsListDomain;
|
|
18
|
+
attributeDomain: IAttributeDomain;
|
|
19
|
+
utils: IUtils;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Executes post-save action lists on saved value
|
|
24
|
+
* Action lists can perform side effects
|
|
25
|
+
* Unlike pre-save value actions, this runs AFTER the value is persisted to the database.
|
|
26
|
+
*/
|
|
27
|
+
declare const postSaveValue: (params: IPostSaveValueParams) => Promise<void>;
|
|
28
|
+
export default postSaveValue;
|
|
@@ -18,6 +18,7 @@ import { type IValueVersion, type ISaveValue, type IValue, type IValuesOptions,
|
|
|
18
18
|
import { type IActionsListDomain } from '../actionsList/actionsListDomain';
|
|
19
19
|
import { type IAttributeDomain } from '../attribute/attributeDomain';
|
|
20
20
|
import { type IValidateHelper } from '../helpers/validate';
|
|
21
|
+
import { type IAttributeDependentValuesPermissionDomain } from 'domain/permission/attributeDependentValuesPermissionDomain';
|
|
21
22
|
import { type IRecordAttributePermissionDomain } from '../permission/recordAttributePermissionDomain';
|
|
22
23
|
import { type IRecordPermissionDomain } from '../permission/recordPermissionDomain';
|
|
23
24
|
import { type IDeleteValueParams } from './_types';
|
|
@@ -121,6 +122,7 @@ export interface IValueDomainDeps {
|
|
|
121
122
|
config: Config.IConfig;
|
|
122
123
|
'core.domain.actionsList': IActionsListDomain;
|
|
123
124
|
'core.domain.attribute': IAttributeDomain;
|
|
125
|
+
'core.domain.permission.attributeDependentValues': IAttributeDependentValuesPermissionDomain;
|
|
124
126
|
'core.domain.permission.recordAttribute': IRecordAttributePermissionDomain;
|
|
125
127
|
'core.domain.permission.record': IRecordPermissionDomain;
|
|
126
128
|
'core.domain.eventsManager': IEventsManagerDomain;
|
|
@@ -142,5 +144,5 @@ export interface IValueDomainDeps {
|
|
|
142
144
|
'core.utils.logger': ILogger;
|
|
143
145
|
'core.domain.tree': ITreeDomain;
|
|
144
146
|
}
|
|
145
|
-
declare const valueDomain: ({ config, "core.domain.actionsList": actionsListDomain, "core.domain.attribute": attributeDomain, "core.domain.permission.recordAttribute": recordAttributePermissionDomain, "core.domain.permission.record": recordPermissionDomain, "core.domain.eventsManager": eventsManager, "core.domain.helpers.validate": validate, "core.domain.helpers.updateRecordLastModif": updateRecordLastModif, "core.domain.tree.helpers.elementAncestors": elementAncestors, "core.domain.tree.helpers.getDefaultElement": getDefaultElementHelper, "core.domain.record.helpers.sendRecordUpdateEvent": sendRecordUpdateEvent, "core.domain.record.helpers.createRecord": createRecordHelper, "core.domain.record.helpers.findRecords": findRecordsHelper, "core.domain.permission.helpers.recordInCreationBypass": recordInCreationBypassHelper, "core.domain.record.helpers.deleteRecord": deleteRecordHelper, "core.domain.attribute.helpers.ifLibraryJoinLinkAttribute": ifLibraryJoinLinkAttribute, "core.domain.versionProfile": versionProfileDomain, "core.infra.record": recordRepo, "core.infra.tree": treeRepo, "core.infra.value": valueRepo, "core.utils": utils, "core.utils.logger": logger, }: IValueDomainDeps) => IValueDomain;
|
|
147
|
+
declare const valueDomain: ({ config, "core.domain.actionsList": actionsListDomain, "core.domain.attribute": attributeDomain, "core.domain.permission.attributeDependentValues": attributeDependentValuesPermissionDomain, "core.domain.permission.recordAttribute": recordAttributePermissionDomain, "core.domain.permission.record": recordPermissionDomain, "core.domain.eventsManager": eventsManager, "core.domain.helpers.validate": validate, "core.domain.helpers.updateRecordLastModif": updateRecordLastModif, "core.domain.tree.helpers.elementAncestors": elementAncestors, "core.domain.tree.helpers.getDefaultElement": getDefaultElementHelper, "core.domain.record.helpers.sendRecordUpdateEvent": sendRecordUpdateEvent, "core.domain.record.helpers.createRecord": createRecordHelper, "core.domain.record.helpers.findRecords": findRecordsHelper, "core.domain.permission.helpers.recordInCreationBypass": recordInCreationBypassHelper, "core.domain.record.helpers.deleteRecord": deleteRecordHelper, "core.domain.attribute.helpers.ifLibraryJoinLinkAttribute": ifLibraryJoinLinkAttribute, "core.domain.versionProfile": versionProfileDomain, "core.infra.record": recordRepo, "core.infra.tree": treeRepo, "core.infra.value": valueRepo, "core.utils": utils, "core.utils.logger": logger, }: IValueDomainDeps) => IValueDomain;
|
|
146
148
|
export default valueDomain;
|
|
@@ -26,7 +26,9 @@ export declare const commonAttributeData: {
|
|
|
26
26
|
name: string;
|
|
27
27
|
is_system: boolean;
|
|
28
28
|
}[];
|
|
29
|
+
postSaveValue: any[];
|
|
29
30
|
deleteValue: any[];
|
|
31
|
+
postDeleteValue: any[];
|
|
30
32
|
};
|
|
31
33
|
};
|
|
32
34
|
export declare const createLibraries: (libraries: MigrationLibraryToCreate[], dbService: IDbService, libraryRepo: ILibraryRepo, ctx: IQueryInfos) => Promise<void>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type IQueryInfos } from '_types/queryInfos';
|
|
2
|
-
import { type IPermission, type IPermissionsTreeTarget, type PermissionsActions, type PermissionTypes } from '../../_types/permissions';
|
|
2
|
+
import { type IPermissionsDependenciesTreeTarget, type IPermission, type IPermissionsTreeTarget, type PermissionsActions, type PermissionTypes } from '../../_types/permissions';
|
|
3
3
|
import { type IDbService } from '../db/dbService';
|
|
4
4
|
import { type IDbUtils } from '../db/dbUtils';
|
|
5
5
|
export interface IPermissionRepo {
|
|
@@ -7,11 +7,12 @@ export interface IPermissionRepo {
|
|
|
7
7
|
permData: IPermission;
|
|
8
8
|
ctx: IQueryInfos;
|
|
9
9
|
}): Promise<IPermission>;
|
|
10
|
-
getPermissions({ type, applyTo, usersGroupNodeId, permissionTreeTarget, ctx, }: {
|
|
10
|
+
getPermissions({ type, applyTo, usersGroupNodeId, permissionTreeTarget, dependenciesTreeTargets, ctx, }: {
|
|
11
11
|
type: PermissionTypes;
|
|
12
12
|
applyTo: string;
|
|
13
13
|
usersGroupNodeId: string | null;
|
|
14
14
|
permissionTreeTarget?: IPermissionsTreeTarget;
|
|
15
|
+
dependenciesTreeTargets?: IPermissionsDependenciesTreeTarget[];
|
|
15
16
|
ctx: IQueryInfos;
|
|
16
17
|
}): Promise<IPermission | null>;
|
|
17
18
|
getAllPermissionsForTree({ type, applyTo, actionKey, treeId, groupsIds, ctx, }: {
|