@rockster/core 0.0.4 → 0.1.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/access/access.module.js +3 -7
- package/access/access.module.js.map +1 -1
- package/access/constants.d.ts +2 -0
- package/access/constants.js +6 -0
- package/access/constants.js.map +1 -0
- package/access/controllers/controllers.d.ts +2 -1
- package/access/controllers/controllers.js +3 -1
- package/access/controllers/controllers.js.map +1 -1
- package/access/controllers/scope-access-profile.controller.d.ts +17 -0
- package/access/controllers/scope-access-profile.controller.js +111 -0
- package/access/controllers/scope-access-profile.controller.js.map +1 -0
- package/access/controllers/scope-group-user.controller.d.ts +11 -4
- package/access/controllers/scope-group-user.controller.js +57 -9
- package/access/controllers/scope-group-user.controller.js.map +1 -1
- package/access/controllers/scope-group.controller.d.ts +8 -5
- package/access/controllers/scope-group.controller.js +66 -12
- package/access/controllers/scope-group.controller.js.map +1 -1
- package/access/controllers/scope-owner.controller.d.ts +3 -2
- package/access/controllers/scope-owner.controller.js +18 -4
- package/access/controllers/scope-owner.controller.js.map +1 -1
- package/access/controllers/scope-user.controller.d.ts +2 -2
- package/access/controllers/scope-user.controller.js +19 -5
- package/access/controllers/scope-user.controller.js.map +1 -1
- package/access/decorators/context-params.decorator.d.ts +2 -0
- package/access/decorators/context-params.decorator.js +13 -0
- package/access/decorators/context-params.decorator.js.map +1 -0
- package/access/decorators/index.d.ts +2 -0
- package/access/decorators/index.js +19 -0
- package/access/decorators/index.js.map +1 -0
- package/access/decorators/scope-context-id-resolver.decorator.d.ts +10 -0
- package/access/decorators/scope-context-id-resolver.decorator.js +22 -0
- package/access/decorators/scope-context-id-resolver.decorator.js.map +1 -0
- package/access/entities/entities.d.ts +3 -1
- package/access/entities/entities.js +4 -0
- package/access/entities/entities.js.map +1 -1
- package/access/entities/index.d.ts +2 -0
- package/access/entities/index.js +2 -0
- package/access/entities/index.js.map +1 -1
- package/access/entities/scope-access-profile-key.d.ts +6 -0
- package/access/entities/scope-access-profile-key.js +40 -0
- package/access/entities/scope-access-profile-key.js.map +1 -0
- package/access/entities/scope-access-profile.d.ts +6 -0
- package/access/entities/scope-access-profile.js +37 -0
- package/access/entities/scope-access-profile.js.map +1 -0
- package/access/entities/scope-group.d.ts +3 -0
- package/access/entities/scope-group.js +16 -0
- package/access/entities/scope-group.js.map +1 -1
- package/access/functions/assert-context-admin-access.d.ts +15 -0
- package/access/functions/assert-context-admin-access.js +62 -0
- package/access/functions/assert-context-admin-access.js.map +1 -0
- package/access/functions/assert-master-or-owner.d.ts +9 -0
- package/access/functions/assert-master-or-owner.js +40 -0
- package/access/functions/assert-master-or-owner.js.map +1 -0
- package/access/functions/assert-scope-action-access.d.ts +32 -0
- package/access/functions/assert-scope-action-access.js +189 -0
- package/access/functions/assert-scope-action-access.js.map +1 -0
- package/access/functions/build-scope-resolver-initial-data.d.ts +4 -0
- package/access/functions/build-scope-resolver-initial-data.js +17 -0
- package/access/functions/build-scope-resolver-initial-data.js.map +1 -0
- package/access/functions/describe-action-scope.d.ts +9 -0
- package/access/functions/describe-action-scope.js +27 -0
- package/access/functions/describe-action-scope.js.map +1 -0
- package/access/functions/index.d.ts +5 -0
- package/access/functions/index.js +5 -0
- package/access/functions/index.js.map +1 -1
- package/access/functions/init-scope-service-executors.d.ts +3 -0
- package/access/functions/init-scope-service-executors.js +38 -0
- package/access/functions/init-scope-service-executors.js.map +1 -0
- package/access/functions/normalize-scope-keys.d.ts +4 -0
- package/access/functions/normalize-scope-keys.js +17 -0
- package/access/functions/normalize-scope-keys.js.map +1 -0
- package/access/functions/register-scope.d.ts +16 -5
- package/access/functions/register-scope.js +57 -45
- package/access/functions/register-scope.js.map +1 -1
- package/access/functions/resolve-scope-context-id.d.ts +9 -0
- package/access/functions/resolve-scope-context-id.js +71 -0
- package/access/functions/resolve-scope-context-id.js.map +1 -0
- package/access/functions/warn-if-public.d.ts +12 -0
- package/access/functions/warn-if-public.js +20 -0
- package/access/functions/warn-if-public.js.map +1 -0
- package/access/index.d.ts +2 -0
- package/access/index.js +2 -0
- package/access/index.js.map +1 -1
- package/access/interfaces/index.d.ts +1 -0
- package/access/interfaces/index.js +1 -0
- package/access/interfaces/index.js.map +1 -1
- package/access/interfaces/resolve-scope-context-id.d.ts +21 -0
- package/access/interfaces/resolve-scope-context-id.js +3 -0
- package/access/interfaces/resolve-scope-context-id.js.map +1 -0
- package/access/interfaces/scope-service-registry.d.ts +16 -1
- package/access/interfaces/scope-service.d.ts +6 -7
- package/access/models/scope-access-profile-keys-update.d.ts +5 -0
- package/access/models/scope-access-profile-keys-update.js +27 -0
- package/access/models/scope-access-profile-keys-update.js.map +1 -0
- package/access/models/scope-group-apply-access-profile.d.ts +6 -0
- package/access/models/scope-group-apply-access-profile.js +32 -0
- package/access/models/scope-group-apply-access-profile.js.map +1 -0
- package/access/models/scope-user-mapped.d.ts +1 -0
- package/access/models/scope-user-mapped.js +6 -0
- package/access/models/scope-user-mapped.js.map +1 -1
- package/access/models/scope-user.js +4 -2
- package/access/models/scope-user.js.map +1 -1
- package/access/queries/scope-access-profile.query.d.ts +1 -0
- package/access/queries/scope-access-profile.query.js +10 -0
- package/access/queries/scope-access-profile.query.js.map +1 -0
- package/access/queries/scope-group.query.js +9 -2
- package/access/queries/scope-group.query.js.map +1 -1
- package/access/services/index.d.ts +1 -0
- package/access/services/index.js +1 -0
- package/access/services/index.js.map +1 -1
- package/access/services/scope-access-profile.service.d.ts +13 -0
- package/access/services/scope-access-profile.service.js +75 -0
- package/access/services/scope-access-profile.service.js.map +1 -0
- package/access/services/scope-access.service.js +4 -2
- package/access/services/scope-access.service.js.map +1 -1
- package/access/services/scope-group-user.service.js +2 -2
- package/access/services/scope-group-user.service.js.map +1 -1
- package/access/services/scope-group.service.d.ts +10 -0
- package/access/services/scope-group.service.js +38 -1
- package/access/services/scope-group.service.js.map +1 -1
- package/access/services/scope-owner.service.d.ts +3 -0
- package/access/services/scope-owner.service.js +26 -1
- package/access/services/scope-owner.service.js.map +1 -1
- package/command/services/post-action-builder.js +19 -17
- package/command/services/post-action-builder.js.map +1 -1
- package/command/services/remove-action-builder.js +30 -22
- package/command/services/remove-action-builder.js.map +1 -1
- package/controllers/interfaces/controller-property.d.ts +7 -1
- package/controllers/services/default-action-builder.js +12 -30
- package/controllers/services/default-action-builder.js.map +1 -1
- package/controllers/services/restful-action-builder.js +25 -1
- package/controllers/services/restful-action-builder.js.map +1 -1
- package/core/contexts/request-context.d.ts +5 -0
- package/core/contexts/request-context.js +6 -0
- package/core/contexts/request-context.js.map +1 -0
- package/core/core.controller.js +6 -1
- package/core/core.controller.js.map +1 -1
- package/core/interfaces/action-docs.d.ts +15 -0
- package/core/interfaces/request-context.d.ts +5 -0
- package/core/services/request-router.js +2 -1
- package/core/services/request-router.js.map +1 -1
- package/database/database.controller.d.ts +1 -3
- package/database/database.controller.js +1 -5
- package/database/database.controller.js.map +1 -1
- package/database/decorators/protect-entity.decorator.d.ts +1 -0
- package/database/decorators/protect-entity.decorator.js +2 -3
- package/database/decorators/protect-entity.decorator.js.map +1 -1
- package/database/decorators/protected-entity.decorator.d.ts +1 -0
- package/database/decorators/protected-entity.decorator.js +2 -16
- package/database/decorators/protected-entity.decorator.js.map +1 -1
- package/database/functions/inject-repository-handle.js +4 -3
- package/database/functions/inject-repository-handle.js.map +1 -1
- package/database/interfaces/entity-object.d.ts +0 -6
- package/database/interfaces/index.d.ts +0 -1
- package/database/interfaces/index.js +0 -1
- package/database/interfaces/index.js.map +1 -1
- package/database/interfaces/repository.d.ts +8 -8
- package/docs/docs.module.js +3 -1
- package/docs/docs.module.js.map +1 -1
- package/docs/migrations/1747584000000-CreateDocsTables.d.ts +5 -0
- package/docs/migrations/1747584000000-CreateDocsTables.js +90 -0
- package/docs/migrations/1747584000000-CreateDocsTables.js.map +1 -0
- package/docs/migrations/migrations.d.ts +2 -0
- package/docs/migrations/migrations.js +8 -0
- package/docs/migrations/migrations.js.map +1 -0
- package/global.d.ts +2 -0
- package/global.js +1 -0
- package/global.js.map +1 -1
- package/index.d.ts +2 -1
- package/index.js +2 -1
- package/index.js.map +1 -1
- package/jobs/jobs.controller.d.ts +2 -0
- package/jobs/jobs.controller.js +20 -16
- package/jobs/jobs.controller.js.map +1 -1
- package/package.json +70 -70
- package/query/functions/add-join.js +2 -13
- package/query/functions/add-join.js.map +1 -1
- package/query/functions/create-query-builder.js +0 -10
- package/query/functions/create-query-builder.js.map +1 -1
- package/query/functions/execute-query.js +34 -0
- package/query/functions/execute-query.js.map +1 -1
- package/query/functions/load-properties.js +73 -5
- package/query/functions/load-properties.js.map +1 -1
- package/query/services/query-action-builder.js +12 -18
- package/query/services/query-action-builder.js.map +1 -1
- package/remote-logs/dtos/index.d.ts +2 -0
- package/remote-logs/dtos/index.js +19 -0
- package/remote-logs/dtos/index.js.map +1 -0
- package/remote-logs/dtos/remote-log-hooks.dto.d.ts +72 -0
- package/remote-logs/dtos/remote-log-hooks.dto.js +280 -0
- package/remote-logs/dtos/remote-log-hooks.dto.js.map +1 -0
- package/remote-logs/dtos/remote-log-search.dto.d.ts +34 -0
- package/remote-logs/dtos/remote-log-search.dto.js +146 -0
- package/remote-logs/dtos/remote-log-search.dto.js.map +1 -0
- package/remote-logs/environment.d.ts +4 -0
- package/remote-logs/environment.js +5 -0
- package/remote-logs/environment.js.map +1 -0
- package/remote-logs/index.d.ts +3 -0
- package/remote-logs/index.js +20 -0
- package/remote-logs/index.js.map +1 -0
- package/remote-logs/interfaces/index.d.ts +1 -0
- package/remote-logs/interfaces/index.js +18 -0
- package/remote-logs/interfaces/index.js.map +1 -0
- package/remote-logs/interfaces/remote-logs-module-options.d.ts +8 -0
- package/remote-logs/interfaces/remote-logs-module-options.js +3 -0
- package/remote-logs/interfaces/remote-logs-module-options.js.map +1 -0
- package/remote-logs/remote-logs-hooks.controller.d.ts +60 -0
- package/remote-logs/remote-logs-hooks.controller.js +331 -0
- package/remote-logs/remote-logs-hooks.controller.js.map +1 -0
- package/remote-logs/remote-logs.controller.d.ts +8 -0
- package/remote-logs/remote-logs.controller.js +41 -0
- package/remote-logs/remote-logs.controller.js.map +1 -0
- package/remote-logs/remote-logs.module.d.ts +12 -0
- package/remote-logs/remote-logs.module.js +107 -0
- package/remote-logs/remote-logs.module.js.map +1 -0
- package/remote-logs/services/opensearch.service.d.ts +13 -0
- package/remote-logs/services/opensearch.service.js +167 -0
- package/remote-logs/services/opensearch.service.js.map +1 -0
- package/security/auth.controller.js +4 -4
- package/security/auth.controller.js.map +1 -1
- package/security/functions/add-protected.d.ts +2 -2
- package/security/functions/add-protected.js +8 -5
- package/security/functions/add-protected.js.map +1 -1
- package/security/functions/create-authentication-interceptor.d.ts +44 -0
- package/security/functions/create-authentication-interceptor.js +114 -0
- package/security/functions/create-authentication-interceptor.js.map +1 -0
- package/security/functions/find-auth-context.d.ts +1 -2
- package/security/functions/find-auth-context.js +6 -11
- package/security/functions/find-auth-context.js.map +1 -1
- package/security/index.d.ts +1 -0
- package/security/index.js +1 -0
- package/security/index.js.map +1 -1
- package/security/interfaces/authorization-schema.d.ts +3 -1
- package/security/services/authorization.service.d.ts +5 -3
- package/security/services/authorization.service.js +56 -37
- package/security/services/authorization.service.js.map +1 -1
- package/storage/services/routes.service.js +1 -1
- package/storage/services/routes.service.js.map +1 -1
- package/tasks/constants.d.ts +3 -0
- package/tasks/constants.js +2 -1
- package/tasks/constants.js.map +1 -1
- package/tasks/controllers/task.controller.d.ts +3 -2
- package/tasks/controllers/task.controller.js +11 -40
- package/tasks/controllers/task.controller.js.map +1 -1
- package/tasks/decorators/index.d.ts +1 -0
- package/tasks/decorators/index.js +1 -0
- package/tasks/decorators/index.js.map +1 -1
- package/tasks/decorators/task-payload.decorator.d.ts +1 -0
- package/tasks/decorators/task-payload.decorator.js +12 -0
- package/tasks/decorators/task-payload.decorator.js.map +1 -0
- package/tasks/decorators/task.decorator.js +3 -0
- package/tasks/decorators/task.decorator.js.map +1 -1
- package/tasks/functions/compile-all-task-post-hooks.d.ts +1 -0
- package/tasks/functions/compile-all-task-post-hooks.js +27 -0
- package/tasks/functions/compile-all-task-post-hooks.js.map +1 -0
- package/tasks/functions/compile-task-hook-handle.d.ts +6 -0
- package/tasks/functions/compile-task-hook-handle.js +67 -0
- package/tasks/functions/compile-task-hook-handle.js.map +1 -0
- package/tasks/functions/create-task-hook.d.ts +9 -0
- package/tasks/functions/create-task-hook.js +13 -0
- package/tasks/functions/create-task-hook.js.map +1 -0
- package/tasks/functions/create-task-message-post.js +2 -0
- package/tasks/functions/create-task-message-post.js.map +1 -1
- package/tasks/functions/register-task-post-hook-interceptors.d.ts +3 -0
- package/tasks/functions/register-task-post-hook-interceptors.js +86 -0
- package/tasks/functions/register-task-post-hook-interceptors.js.map +1 -0
- package/tasks/functions/run-task-post-hooks.d.ts +11 -0
- package/tasks/functions/run-task-post-hooks.js +18 -0
- package/tasks/functions/run-task-post-hooks.js.map +1 -0
- package/tasks/functions/task-message-operations.d.ts +18 -0
- package/tasks/functions/task-message-operations.js +100 -0
- package/tasks/functions/task-message-operations.js.map +1 -0
- package/tasks/functions/validate-task-payload.d.ts +2 -0
- package/tasks/functions/validate-task-payload.js +19 -0
- package/tasks/functions/validate-task-payload.js.map +1 -0
- package/tasks/hook-constants.d.ts +2 -0
- package/tasks/hook-constants.js +6 -0
- package/tasks/hook-constants.js.map +1 -0
- package/tasks/index.d.ts +3 -0
- package/tasks/index.js +3 -0
- package/tasks/index.js.map +1 -1
- package/tasks/interfaces/compiled-task-post-hooks.d.ts +17 -0
- package/tasks/interfaces/compiled-task-post-hooks.js +3 -0
- package/tasks/interfaces/compiled-task-post-hooks.js.map +1 -0
- package/tasks/interfaces/index.d.ts +3 -0
- package/tasks/interfaces/index.js +3 -0
- package/tasks/interfaces/index.js.map +1 -1
- package/tasks/interfaces/task-hook.d.ts +16 -0
- package/tasks/interfaces/task-hook.js +8 -0
- package/tasks/interfaces/task-hook.js.map +1 -0
- package/tasks/interfaces/task-object.d.ts +4 -0
- package/tasks/interfaces/task-post-hook.d.ts +2 -0
- package/{database/interfaces/protector.js → tasks/interfaces/task-post-hook.js} +1 -1
- package/tasks/interfaces/task-post-hook.js.map +1 -0
- package/tasks/interfaces/task-settings.d.ts +5 -0
- package/tasks/services/task-runner.service.d.ts +24 -3
- package/tasks/services/task-runner.service.js +66 -28
- package/tasks/services/task-runner.service.js.map +1 -1
- package/database/functions/use-protector.d.ts +0 -2
- package/database/functions/use-protector.js +0 -11
- package/database/functions/use-protector.js.map +0 -1
- package/database/interfaces/protector.d.ts +0 -51
- package/database/interfaces/protector.js.map +0 -1
- package/database/services/protect-builder.d.ts +0 -60
- package/database/services/protect-builder.js +0 -524
- package/database/services/protect-builder.js.map +0 -1
- package/security/functions/add-protect.d.ts +0 -2
- package/security/functions/add-protect.js +0 -11
- package/security/functions/add-protect.js.map +0 -1
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { ObjectNote, PropertyNote } from "@rockster/class-memory";
|
|
2
|
-
import { Dictionary, Instantiable } from "@rockster/common";
|
|
3
|
-
import { EntityManager } from "typeorm";
|
|
4
|
-
import { GetUserPermissionsHandle, SetUserPermissionsHandle } from "../interfaces/protector";
|
|
5
|
-
import { IProtectedEntityOptions } from "../decorators/protected-entity.decorator";
|
|
6
|
-
import { IEntityObject } from "../interfaces/entity-object";
|
|
7
|
-
import { IEntityProperty } from "../interfaces/entity-property";
|
|
8
|
-
type ProtectedData = {
|
|
9
|
-
object: ObjectNote<IEntityObject>;
|
|
10
|
-
context?: PropertyNote<IEntityProperty>;
|
|
11
|
-
options?: IProtectedEntityOptions;
|
|
12
|
-
isContext: boolean;
|
|
13
|
-
};
|
|
14
|
-
type ProtectorData = {
|
|
15
|
-
object: ObjectNote<IEntityObject>;
|
|
16
|
-
target: PropertyNote<IEntityProperty>;
|
|
17
|
-
context?: PropertyNote<IEntityProperty>;
|
|
18
|
-
key?: PropertyNote<IEntityProperty>;
|
|
19
|
-
};
|
|
20
|
-
export declare class ProtectBuilder {
|
|
21
|
-
build(object: ObjectNote<IEntityObject>): Promise<void>;
|
|
22
|
-
protected buildProtectorConfig(object: ObjectNote<IEntityObject>): void;
|
|
23
|
-
protected getRepository(target: Instantiable, entityManager?: EntityManager): import("typeorm").Repository<any>;
|
|
24
|
-
protected createQueryBuilder({ authKeys, data, protectorData, userId, displayContext, entityManager, protectedData }: {
|
|
25
|
-
protectorData: ProtectorData;
|
|
26
|
-
userId: string;
|
|
27
|
-
data: any;
|
|
28
|
-
authKeys: string[];
|
|
29
|
-
displayContext?: string;
|
|
30
|
-
entityManager?: EntityManager;
|
|
31
|
-
protectedData?: ProtectedData;
|
|
32
|
-
}): import("typeorm").SelectQueryBuilder<any>;
|
|
33
|
-
protected buildFilterKeys(protectorAlias: string, protectorKey: string, keys: string[]): string;
|
|
34
|
-
protected getQueryContextAndKeyCondition(protectorData: ProtectorData, protectedData: ProtectedData, protectorAlias: string, alias: string, contextParams: Dictionary<any>, rootPath?: Instantiable): {
|
|
35
|
-
context: string;
|
|
36
|
-
key: string;
|
|
37
|
-
};
|
|
38
|
-
protected buildProtectedConfig(object: ObjectNote<IEntityObject>): void;
|
|
39
|
-
protected getSetUserPermissions(data: ProtectorData): SetUserPermissionsHandle;
|
|
40
|
-
protected getGetUserPermissions(data: ProtectorData): GetUserPermissionsHandle;
|
|
41
|
-
protected getAuthContextFilter(targetUserId: string, data: ProtectorData, contextId: string): {
|
|
42
|
-
where: {
|
|
43
|
-
[x: string]: string;
|
|
44
|
-
};
|
|
45
|
-
keyProperty: PropertyNote<IEntityProperty>;
|
|
46
|
-
contextProperty: PropertyNote<IEntityProperty>;
|
|
47
|
-
targetProperty: PropertyNote<IEntityProperty>;
|
|
48
|
-
};
|
|
49
|
-
protected checkIsAuthorized({ data, userId, entityManager, keys, context, contextId }: {
|
|
50
|
-
data: ProtectorData;
|
|
51
|
-
entityManager?: EntityManager;
|
|
52
|
-
keys: string[];
|
|
53
|
-
context: string;
|
|
54
|
-
contextId: string;
|
|
55
|
-
userId: string;
|
|
56
|
-
}): Promise<void>;
|
|
57
|
-
protected getProtectedData(protector: ProtectorData, object: ObjectNote<IEntityObject>): ProtectedData;
|
|
58
|
-
protected getProtectorData(protector: Instantiable): ProtectorData;
|
|
59
|
-
}
|
|
60
|
-
export {};
|
|
@@ -1,524 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.ProtectBuilder = void 0;
|
|
10
|
-
const class_injector_1 = require("@rockster/class-injector");
|
|
11
|
-
const common_1 = require("@rockster/common");
|
|
12
|
-
const use_repository_1 = require("../functions/use-repository");
|
|
13
|
-
const find_auth_context_1 = require("../../security/functions/find-auth-context");
|
|
14
|
-
const get_id_property_1 = require("../functions/get-id-property");
|
|
15
|
-
let ProtectBuilder = class ProtectBuilder {
|
|
16
|
-
async build(object) {
|
|
17
|
-
if (object.protected) {
|
|
18
|
-
core.isAuthRequired = true;
|
|
19
|
-
await this.buildProtectedConfig(object);
|
|
20
|
-
}
|
|
21
|
-
if (object.isProtect) {
|
|
22
|
-
await this.buildProtectorConfig(object);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
buildProtectorConfig(object) {
|
|
26
|
-
const protectorData = this
|
|
27
|
-
.getProtectorData(object.objectClass);
|
|
28
|
-
object.protector = {
|
|
29
|
-
isAuthorized: ({ keys, userId, context, contextId, entityManager }) => {
|
|
30
|
-
return this.checkIsAuthorized({
|
|
31
|
-
context,
|
|
32
|
-
contextId,
|
|
33
|
-
data: protectorData,
|
|
34
|
-
keys,
|
|
35
|
-
userId,
|
|
36
|
-
entityManager
|
|
37
|
-
});
|
|
38
|
-
},
|
|
39
|
-
getUserPermissions: this.getGetUserPermissions(protectorData),
|
|
40
|
-
setUserPermissions: this.getSetUserPermissions(protectorData)
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
getRepository(target, entityManager) {
|
|
44
|
-
return entityManager
|
|
45
|
-
? entityManager.getRepository(target)
|
|
46
|
-
: (0, use_repository_1.useRepository)(target);
|
|
47
|
-
}
|
|
48
|
-
createQueryBuilder({ authKeys, data, protectorData, userId, displayContext, entityManager, protectedData }) {
|
|
49
|
-
let contextSQL = '';
|
|
50
|
-
let keySQL = '';
|
|
51
|
-
let contextName = protectedData
|
|
52
|
-
? protectedData.object.objectKey
|
|
53
|
-
: displayContext;
|
|
54
|
-
const repository = this
|
|
55
|
-
.getRepository(protectorData.object.objectClass, entityManager);
|
|
56
|
-
const userIdValue = Number.isInteger(userId)
|
|
57
|
-
? userId
|
|
58
|
-
: `'${userId}'`;
|
|
59
|
-
if (protectorData.context) {
|
|
60
|
-
const contextId = protectedData
|
|
61
|
-
? data[protectedData.context.propertyKey]
|
|
62
|
-
: data[protectorData.context.propertyKey];
|
|
63
|
-
if (!contextId) {
|
|
64
|
-
throw new common_1.ForbiddenError({
|
|
65
|
-
message: `Context value not found for [${contextName}]`
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
const contextIdValue = Number.isInteger(contextId)
|
|
69
|
-
? contextId
|
|
70
|
-
: `'${contextId}'`;
|
|
71
|
-
contextSQL = ` AND "${protectorData.object.alias}"."${protectorData.context.propertyKey}" = ${contextIdValue}`;
|
|
72
|
-
}
|
|
73
|
-
if (protectorData.key && authKeys?.length > 0) {
|
|
74
|
-
const keysFilter = this
|
|
75
|
-
.buildFilterKeys(protectorData.object.alias, protectorData.key.propertyKey, authKeys);
|
|
76
|
-
keySQL = ` AND (${keysFilter})`;
|
|
77
|
-
}
|
|
78
|
-
const queryBuilder = repository
|
|
79
|
-
.createQueryBuilder(protectorData.object.alias)
|
|
80
|
-
.where(`
|
|
81
|
-
"${protectorData.object.alias}"."${protectorData.target.propertyKey}" = ${userIdValue}
|
|
82
|
-
${contextSQL}
|
|
83
|
-
${keySQL}
|
|
84
|
-
`);
|
|
85
|
-
return queryBuilder;
|
|
86
|
-
}
|
|
87
|
-
buildFilterKeys(protectorAlias, protectorKey, keys) {
|
|
88
|
-
let keysFilter = '';
|
|
89
|
-
for (const key of keys) {
|
|
90
|
-
if (keysFilter) {
|
|
91
|
-
keysFilter += ' OR ';
|
|
92
|
-
}
|
|
93
|
-
;
|
|
94
|
-
keysFilter += `"${protectorAlias}"."${protectorKey}" = '${key}'`;
|
|
95
|
-
}
|
|
96
|
-
return keysFilter;
|
|
97
|
-
}
|
|
98
|
-
getQueryContextAndKeyCondition(protectorData, protectedData, protectorAlias, alias, contextParams, rootPath) {
|
|
99
|
-
let context = '';
|
|
100
|
-
let key = '';
|
|
101
|
-
if (protectorData.context) {
|
|
102
|
-
const protectorContext = protectorData.context.propertyKey;
|
|
103
|
-
const protectedContext = protectedData.context.propertyKey;
|
|
104
|
-
context = ` AND "${alias}"."${protectedContext}" = "${protectorAlias}"."${protectorContext}"`;
|
|
105
|
-
if (!protectedData.isContext) {
|
|
106
|
-
if (rootPath && rootPath !== protectorData.context.getRelationType()) {
|
|
107
|
-
const contextId = contextParams[`$${protectorContext}`];
|
|
108
|
-
if (!contextId) {
|
|
109
|
-
throw new common_1.ValidationError({
|
|
110
|
-
properties: [{
|
|
111
|
-
message: `Context value is required to this query`,
|
|
112
|
-
property: `$${protectorContext}`,
|
|
113
|
-
value: contextId
|
|
114
|
-
}]
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
const contextIdValue = Number.isInteger(contextId)
|
|
118
|
-
? contextId
|
|
119
|
-
: `'${contextId}'`;
|
|
120
|
-
context = `${context} AND "${alias}"."${protectedContext}" = ${contextIdValue}`;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
if (protectorData.key
|
|
125
|
-
&& protectedData.options?.keys?.read) {
|
|
126
|
-
const authContext = (0, find_auth_context_1.findAuthContext)(protectorData.object.objectClass);
|
|
127
|
-
const keysFilter = this
|
|
128
|
-
.buildFilterKeys(protectorAlias, protectorData.key.propertyKey, [
|
|
129
|
-
protectedData.options.keys.read.name,
|
|
130
|
-
authContext.adminKey.name,
|
|
131
|
-
authContext.ownerKey.name
|
|
132
|
-
]);
|
|
133
|
-
key = ` AND (${keysFilter})`;
|
|
134
|
-
}
|
|
135
|
-
return {
|
|
136
|
-
context,
|
|
137
|
-
key
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
buildProtectedConfig(object) {
|
|
141
|
-
const protectorData = this
|
|
142
|
-
.getProtectorData(object.protected.type());
|
|
143
|
-
const protectedData = this
|
|
144
|
-
.getProtectedData(protectorData, object);
|
|
145
|
-
const overrideData = {
|
|
146
|
-
canCreateProtector: null,
|
|
147
|
-
canCreateProtected: null,
|
|
148
|
-
canRemoveProtector: null,
|
|
149
|
-
canRemoveProtected: null,
|
|
150
|
-
canModifyProtector: null,
|
|
151
|
-
canModifyProtected: null,
|
|
152
|
-
canReadProtector: null,
|
|
153
|
-
canReadProtected: null
|
|
154
|
-
};
|
|
155
|
-
if (protectedData.options?.keys?.create?.protector) {
|
|
156
|
-
overrideData.canCreateProtector = this.getProtectorData(protectedData.options.keys.create.protector());
|
|
157
|
-
overrideData.canCreateProtected = this.getProtectedData(overrideData.canCreateProtector, object);
|
|
158
|
-
}
|
|
159
|
-
if (protectedData.options?.keys?.modify?.protector) {
|
|
160
|
-
overrideData.canModifyProtector = this.getProtectorData(protectedData.options.keys.modify.protector());
|
|
161
|
-
overrideData.canModifyProtected = this.getProtectedData(overrideData.canModifyProtector, object);
|
|
162
|
-
}
|
|
163
|
-
if (protectedData.options?.keys?.read?.protector) {
|
|
164
|
-
overrideData.canReadProtector = this.getProtectorData(protectedData.options.keys.read.protector());
|
|
165
|
-
overrideData.canReadProtected = this.getProtectedData(overrideData.canReadProtector, object);
|
|
166
|
-
}
|
|
167
|
-
if (protectedData.options?.keys?.remove?.protector) {
|
|
168
|
-
overrideData.canRemoveProtector = this.getProtectorData(protectedData.options.keys.remove.protector());
|
|
169
|
-
overrideData.canRemoveProtected = this.getProtectedData(overrideData.canRemoveProtector, object);
|
|
170
|
-
}
|
|
171
|
-
object.protector = {
|
|
172
|
-
target: protectorData.object.objectClass,
|
|
173
|
-
relationCondition: ({ userId, contextParams, alias, rootPath }) => {
|
|
174
|
-
const protectorAlias = `${protectorData.object.alias}_${protectedData.object.alias}`;
|
|
175
|
-
const protectorTarget = protectorData.target.propertyKey;
|
|
176
|
-
const userIdValue = Number.isInteger(userId)
|
|
177
|
-
? userId
|
|
178
|
-
: `'${userId}'`;
|
|
179
|
-
const { context, key } = this
|
|
180
|
-
.getQueryContextAndKeyCondition(protectorData, protectedData, protectorAlias, alias, contextParams, rootPath);
|
|
181
|
-
let condition = `
|
|
182
|
-
AND EXISTS (
|
|
183
|
-
SELECT * FROM "${protectorData.object.tableName}" "${protectorAlias}"
|
|
184
|
-
WHERE "${protectorAlias}"."${protectorTarget}" = ${userIdValue}
|
|
185
|
-
${context}${key}
|
|
186
|
-
)
|
|
187
|
-
`;
|
|
188
|
-
return condition;
|
|
189
|
-
},
|
|
190
|
-
rootCondition: ({ userId, contextParams, queryBuilder, rootAlias }) => {
|
|
191
|
-
const protectorAlias = `${protectorData.object.alias}_${protectedData.object.alias}`;
|
|
192
|
-
const protectorTarget = protectorData.target.propertyKey;
|
|
193
|
-
const userIdValue = Number.isInteger(userId)
|
|
194
|
-
? userId
|
|
195
|
-
: `'${userId}'`;
|
|
196
|
-
const { context, key } = this
|
|
197
|
-
.getQueryContextAndKeyCondition(protectorData, protectedData, protectorAlias, rootAlias, contextParams);
|
|
198
|
-
queryBuilder.innerJoin(protectorData.object.objectClass, protectorAlias, `"${protectorAlias}"."${protectorTarget}" = ${userIdValue}${context}${key}`);
|
|
199
|
-
return queryBuilder;
|
|
200
|
-
},
|
|
201
|
-
canCreate: async (userId, data, entityManager) => {
|
|
202
|
-
const canCreateProtectorData = overrideData.canCreateProtector || protectorData;
|
|
203
|
-
const canCreateProtectedData = overrideData.canCreateProtected || protectedData;
|
|
204
|
-
const key = canCreateProtectedData.options?.keys?.create?.name;
|
|
205
|
-
if (!key) {
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
208
|
-
const forbiddenError = new common_1.ForbiddenError({
|
|
209
|
-
message: `Current user [${userId}] cannot create [${canCreateProtectedData.object.objectClass.name}]`,
|
|
210
|
-
requirements: [key]
|
|
211
|
-
});
|
|
212
|
-
const authContext = (0, find_auth_context_1.findAuthContext)(canCreateProtectorData.object.objectClass);
|
|
213
|
-
const exists = await this
|
|
214
|
-
.createQueryBuilder({
|
|
215
|
-
protectorData: canCreateProtectorData,
|
|
216
|
-
userId,
|
|
217
|
-
data,
|
|
218
|
-
authKeys: key
|
|
219
|
-
? [
|
|
220
|
-
key,
|
|
221
|
-
authContext.adminKey.name,
|
|
222
|
-
authContext.ownerKey.name
|
|
223
|
-
]
|
|
224
|
-
: [],
|
|
225
|
-
protectedData: canCreateProtectedData,
|
|
226
|
-
entityManager
|
|
227
|
-
})
|
|
228
|
-
.getOne();
|
|
229
|
-
if (!exists) {
|
|
230
|
-
throw forbiddenError;
|
|
231
|
-
}
|
|
232
|
-
},
|
|
233
|
-
canRemove: async (userId, entityId, entityManager) => {
|
|
234
|
-
const canRemoveProtectorData = overrideData.canRemoveProtector || protectorData;
|
|
235
|
-
const canRemoveProtectedData = overrideData.canRemoveProtected || protectedData;
|
|
236
|
-
const key = canRemoveProtectedData.options?.keys?.remove?.name;
|
|
237
|
-
if (!key) {
|
|
238
|
-
return;
|
|
239
|
-
}
|
|
240
|
-
const forbiddenError = new common_1.ForbiddenError({
|
|
241
|
-
message: `Current user [${userId}] cannot remove [${canRemoveProtectedData.object.objectClass.name}]`,
|
|
242
|
-
requirements: [key]
|
|
243
|
-
});
|
|
244
|
-
let storedValue;
|
|
245
|
-
const repository = this
|
|
246
|
-
.getRepository(canRemoveProtectedData.object.objectClass, entityManager);
|
|
247
|
-
const invalidError = new common_1.BadRequestError({
|
|
248
|
-
message: `invalid id value [${entityId}]`
|
|
249
|
-
});
|
|
250
|
-
try {
|
|
251
|
-
storedValue = await repository
|
|
252
|
-
.findOneBy({
|
|
253
|
-
[canRemoveProtectedData.object.idProperty]: entityId
|
|
254
|
-
});
|
|
255
|
-
if (!storedValue) {
|
|
256
|
-
throw invalidError;
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
catch (error) {
|
|
260
|
-
throw invalidError;
|
|
261
|
-
}
|
|
262
|
-
const authContext = (0, find_auth_context_1.findAuthContext)(canRemoveProtectorData.object.objectClass);
|
|
263
|
-
const exists = await this
|
|
264
|
-
.createQueryBuilder({
|
|
265
|
-
protectorData: canRemoveProtectorData,
|
|
266
|
-
userId,
|
|
267
|
-
data: storedValue,
|
|
268
|
-
authKeys: key
|
|
269
|
-
? [
|
|
270
|
-
key,
|
|
271
|
-
authContext.adminKey.name,
|
|
272
|
-
authContext.ownerKey.name
|
|
273
|
-
]
|
|
274
|
-
: [],
|
|
275
|
-
protectedData: canRemoveProtectedData,
|
|
276
|
-
entityManager
|
|
277
|
-
})
|
|
278
|
-
.getOne();
|
|
279
|
-
if (!exists) {
|
|
280
|
-
throw forbiddenError;
|
|
281
|
-
}
|
|
282
|
-
},
|
|
283
|
-
canModify: async (userId, data, entityManager) => {
|
|
284
|
-
const canModifyProtectorData = overrideData.canModifyProtector || protectorData;
|
|
285
|
-
const canModifyProtectedData = overrideData.canModifyProtected || protectedData;
|
|
286
|
-
const key = canModifyProtectedData.options?.keys?.modify?.name;
|
|
287
|
-
if (!key) {
|
|
288
|
-
return;
|
|
289
|
-
}
|
|
290
|
-
const forbiddenError = new common_1.ForbiddenError({
|
|
291
|
-
message: `Current user [${userId}] cannot modify [${canModifyProtectedData.object.objectClass.name}]`,
|
|
292
|
-
requirements: [key]
|
|
293
|
-
});
|
|
294
|
-
const repository = this
|
|
295
|
-
.getRepository(canModifyProtectedData.object.objectClass, entityManager);
|
|
296
|
-
const storedId = data[canModifyProtectedData.object.idProperty];
|
|
297
|
-
if (!storedId) {
|
|
298
|
-
throw new common_1.ForbiddenError({
|
|
299
|
-
message: `Context value not found for [${canModifyProtectedData.object.objectClass.name}]`
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
|
-
if (canModifyProtectorData.context) {
|
|
303
|
-
try {
|
|
304
|
-
const storedValue = await repository
|
|
305
|
-
.findOneBy({
|
|
306
|
-
[canModifyProtectedData.object.idProperty]: storedId
|
|
307
|
-
});
|
|
308
|
-
data[canModifyProtectedData.context.propertyKey] = storedValue[canModifyProtectedData.context.propertyKey];
|
|
309
|
-
}
|
|
310
|
-
catch (error) {
|
|
311
|
-
throw new common_1.BadRequestError({
|
|
312
|
-
message: `invalid id value [${storedId}]`
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
const authContext = (0, find_auth_context_1.findAuthContext)(canModifyProtectorData.object.objectClass);
|
|
317
|
-
const exists = await this
|
|
318
|
-
.createQueryBuilder({
|
|
319
|
-
protectorData: canModifyProtectorData,
|
|
320
|
-
userId,
|
|
321
|
-
data,
|
|
322
|
-
authKeys: key
|
|
323
|
-
? [
|
|
324
|
-
key,
|
|
325
|
-
authContext.adminKey.name,
|
|
326
|
-
authContext.ownerKey.name
|
|
327
|
-
]
|
|
328
|
-
: [],
|
|
329
|
-
protectedData: canModifyProtectedData,
|
|
330
|
-
entityManager
|
|
331
|
-
})
|
|
332
|
-
.getOne();
|
|
333
|
-
if (!exists) {
|
|
334
|
-
throw forbiddenError;
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
};
|
|
338
|
-
}
|
|
339
|
-
getSetUserPermissions(data) {
|
|
340
|
-
return async ({ contextId, userId, entityManager, context, targetUserId, accessKeys }) => {
|
|
341
|
-
const authContext = (0, find_auth_context_1.findAuthContext)(context);
|
|
342
|
-
await this.checkIsAuthorized({
|
|
343
|
-
data,
|
|
344
|
-
context,
|
|
345
|
-
contextId,
|
|
346
|
-
keys: [
|
|
347
|
-
authContext.adminKey.name,
|
|
348
|
-
authContext.ownerKey.name
|
|
349
|
-
],
|
|
350
|
-
userId,
|
|
351
|
-
entityManager
|
|
352
|
-
});
|
|
353
|
-
if (targetUserId === userId
|
|
354
|
-
&& !accessKeys.find((accessKey) => accessKey === authContext.ownerKey.name)
|
|
355
|
-
&& !accessKeys.find((accessKey) => accessKey === authContext.adminKey.name)) {
|
|
356
|
-
throw new common_1.ForbiddenError({
|
|
357
|
-
message: `User cannot revoke their own permissions`
|
|
358
|
-
});
|
|
359
|
-
}
|
|
360
|
-
const repository = entityManager
|
|
361
|
-
.getRepository(data.object.objectClass);
|
|
362
|
-
const { keyProperty, contextProperty, targetProperty, where } = this.getAuthContextFilter(targetUserId, data, contextId);
|
|
363
|
-
const newAccessKeys = accessKeys.map((accessKey, i) => {
|
|
364
|
-
const isKey = authContext
|
|
365
|
-
.keys
|
|
366
|
-
?.find((key) => {
|
|
367
|
-
return key.name === accessKey;
|
|
368
|
-
});
|
|
369
|
-
if (!isKey
|
|
370
|
-
&& accessKey !== authContext.adminKey.name
|
|
371
|
-
&& accessKey !== authContext.ownerKey.name) {
|
|
372
|
-
throw new common_1.BadRequestError({
|
|
373
|
-
message: `accessKeys[${i}] is not valid`
|
|
374
|
-
});
|
|
375
|
-
}
|
|
376
|
-
const newAccessKey = {
|
|
377
|
-
[targetProperty.propertyKey]: targetUserId,
|
|
378
|
-
[keyProperty.propertyKey]: accessKey
|
|
379
|
-
};
|
|
380
|
-
if (contextProperty) {
|
|
381
|
-
newAccessKey[contextProperty.propertyKey] = contextId;
|
|
382
|
-
}
|
|
383
|
-
return newAccessKey;
|
|
384
|
-
});
|
|
385
|
-
await repository.delete(where);
|
|
386
|
-
await repository.save(newAccessKeys);
|
|
387
|
-
};
|
|
388
|
-
}
|
|
389
|
-
getGetUserPermissions(data) {
|
|
390
|
-
return async ({ contextId, userId, targetUserId, entityManager, context }) => {
|
|
391
|
-
const authContext = (0, find_auth_context_1.findAuthContext)(context);
|
|
392
|
-
if (userId !== targetUserId) {
|
|
393
|
-
await this.checkIsAuthorized({
|
|
394
|
-
data,
|
|
395
|
-
context,
|
|
396
|
-
contextId,
|
|
397
|
-
keys: [
|
|
398
|
-
authContext.adminKey.name,
|
|
399
|
-
authContext.ownerKey.name
|
|
400
|
-
],
|
|
401
|
-
userId,
|
|
402
|
-
entityManager
|
|
403
|
-
});
|
|
404
|
-
}
|
|
405
|
-
const repository = entityManager
|
|
406
|
-
.getRepository(data.object.objectClass);
|
|
407
|
-
const { keyProperty, where } = this.getAuthContextFilter(targetUserId, data, contextId);
|
|
408
|
-
const accessKeys = await repository.findBy(where);
|
|
409
|
-
return accessKeys.map((accessKey) => {
|
|
410
|
-
return accessKey[keyProperty.propertyKey];
|
|
411
|
-
});
|
|
412
|
-
};
|
|
413
|
-
}
|
|
414
|
-
getAuthContextFilter(targetUserId, data, contextId) {
|
|
415
|
-
const properties = core
|
|
416
|
-
.storage
|
|
417
|
-
.getProperties(data.object.objectClass);
|
|
418
|
-
const contextProperty = properties
|
|
419
|
-
.find((property) => {
|
|
420
|
-
return property.isProtectContext;
|
|
421
|
-
});
|
|
422
|
-
const keyProperty = properties
|
|
423
|
-
.find((property) => {
|
|
424
|
-
return property.isProtectKey;
|
|
425
|
-
});
|
|
426
|
-
const targetProperty = properties
|
|
427
|
-
.find((property) => {
|
|
428
|
-
return property.isProtectTarget;
|
|
429
|
-
});
|
|
430
|
-
const where = {
|
|
431
|
-
[targetProperty.propertyKey]: targetUserId
|
|
432
|
-
};
|
|
433
|
-
if (contextProperty) {
|
|
434
|
-
where[contextProperty.propertyKey] = contextId;
|
|
435
|
-
}
|
|
436
|
-
return {
|
|
437
|
-
where,
|
|
438
|
-
keyProperty,
|
|
439
|
-
contextProperty,
|
|
440
|
-
targetProperty
|
|
441
|
-
};
|
|
442
|
-
}
|
|
443
|
-
async checkIsAuthorized({ data, userId, entityManager, keys, context, contextId }) {
|
|
444
|
-
const forbiddenError = new common_1.ForbiddenError({
|
|
445
|
-
message: `[${userId}] cannot execute action on [${context || data.object.objectKey}]`,
|
|
446
|
-
requirements: [keys.join(',')]
|
|
447
|
-
});
|
|
448
|
-
const exists = await this
|
|
449
|
-
.createQueryBuilder({
|
|
450
|
-
protectorData: data,
|
|
451
|
-
userId,
|
|
452
|
-
data: data.context
|
|
453
|
-
? { [data.context.propertyKey]: contextId }
|
|
454
|
-
: {},
|
|
455
|
-
authKeys: keys,
|
|
456
|
-
displayContext: context,
|
|
457
|
-
entityManager
|
|
458
|
-
})
|
|
459
|
-
.getOne();
|
|
460
|
-
if (!exists) {
|
|
461
|
-
throw forbiddenError;
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
getProtectedData(protector, object) {
|
|
465
|
-
let context;
|
|
466
|
-
let options = object.protected;
|
|
467
|
-
let isContext = false;
|
|
468
|
-
if (protector.context) {
|
|
469
|
-
isContext = object.objectClass === protector.context.getRelationType();
|
|
470
|
-
context = isContext
|
|
471
|
-
? (0, get_id_property_1.getIdProperty)(object.objectClass)
|
|
472
|
-
: core
|
|
473
|
-
.storage
|
|
474
|
-
.getProperties(object.objectClass)
|
|
475
|
-
.find((property) => {
|
|
476
|
-
return property.isRelation
|
|
477
|
-
&& property.getRelationType() === protector.context.getRelationType();
|
|
478
|
-
});
|
|
479
|
-
if (!context) {
|
|
480
|
-
throw new Error(`[${protector.object.objectClass.name}] Context property not found on protected entity [${object.objectClass.name}]`);
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
return {
|
|
484
|
-
object,
|
|
485
|
-
options,
|
|
486
|
-
context: context,
|
|
487
|
-
isContext
|
|
488
|
-
};
|
|
489
|
-
}
|
|
490
|
-
getProtectorData(protector) {
|
|
491
|
-
const object = core
|
|
492
|
-
.storage
|
|
493
|
-
.findObject(protector);
|
|
494
|
-
const target = core
|
|
495
|
-
.storage
|
|
496
|
-
.getProperties(protector)
|
|
497
|
-
.find((property) => {
|
|
498
|
-
return property.isProtectTarget;
|
|
499
|
-
});
|
|
500
|
-
const context = core
|
|
501
|
-
.storage
|
|
502
|
-
.getProperties(protector)
|
|
503
|
-
.find((property) => {
|
|
504
|
-
return property.isProtectContext;
|
|
505
|
-
});
|
|
506
|
-
const key = core
|
|
507
|
-
.storage
|
|
508
|
-
.getProperties(protector)
|
|
509
|
-
.find((property) => {
|
|
510
|
-
return property.isProtectKey;
|
|
511
|
-
});
|
|
512
|
-
return {
|
|
513
|
-
object,
|
|
514
|
-
target: target,
|
|
515
|
-
context: context,
|
|
516
|
-
key: key
|
|
517
|
-
};
|
|
518
|
-
}
|
|
519
|
-
};
|
|
520
|
-
exports.ProtectBuilder = ProtectBuilder;
|
|
521
|
-
exports.ProtectBuilder = ProtectBuilder = __decorate([
|
|
522
|
-
(0, class_injector_1.Injectable)()
|
|
523
|
-
], ProtectBuilder);
|
|
524
|
-
//# sourceMappingURL=protect-builder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"protect-builder.js","sourceRoot":"./","sources":["database/services/protect-builder.ts"],"names":[],"mappings":";;;;;;;;;AAIA,6DAAsD;AACtD,6CAM0B;AAE1B,gEAA4D;AAM5D,kFAA6E;AAI7E,kEAA6D;AAiBtD,IAAM,cAAc,GAApB,MAAM,cAAc;IAExB,KAAK,CAAC,KAAK,CAAC,MAAiC;QAC1C,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;YACpB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;YAC3B,MAAM,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;QAC3C,CAAC;QACD,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;YACpB,MAAM,IAAI,CAAC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A,2BAAU,GAAE;GACA,cAAc,CA6qB1B"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addProtect = void 0;
|
|
4
|
-
const env_1 = require("../env");
|
|
5
|
-
const addProtect = (target) => {
|
|
6
|
-
env_1.env.preSchema.contexts.push({
|
|
7
|
-
protector: () => target
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
exports.addProtect = addProtect;
|
|
11
|
-
//# sourceMappingURL=add-protect.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"add-protect.js","sourceRoot":"./","sources":["security/functions/add-protect.ts"],"names":[],"mappings":";;;AAAA,gCAA6B;AAItB,MAAM,UAAU,GAAG,CAAC,MAAoB,EAAE,EAAE;IAChD,SAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC;QACzB,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM;KACA,CAAC,CAAC;AAC/B,CAAC,CAAA;AAJY,QAAA,UAAU,cAItB"}
|