@flusys/nestjs-iam 6.0.1 → 6.0.2
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/cjs/controllers/action.controller.js +17 -9
- package/cjs/controllers/user-action-permission.controller.js +0 -3
- package/cjs/docs/iam-swagger.config.js +6 -0
- package/cjs/dtos/action.dto.js +17 -0
- package/cjs/modules/iam.module.js +3 -1
- package/cjs/services/action.service.js +90 -7
- package/cjs/services/permission-cache.service.js +113 -110
- package/cjs/services/permission.service.js +213 -92
- package/cjs/services/role.service.js +47 -3
- package/controllers/action.controller.d.ts +5 -3
- package/dtos/action.dto.d.ts +3 -0
- package/entities/index.d.ts +2 -2
- package/fesm/controllers/action.controller.js +18 -10
- package/fesm/controllers/user-action-permission.controller.js +0 -3
- package/fesm/docs/iam-swagger.config.js +6 -0
- package/fesm/dtos/action.dto.js +14 -0
- package/fesm/modules/iam.module.js +4 -2
- package/fesm/services/action.service.js +90 -7
- package/fesm/services/permission-cache.service.js +101 -108
- package/fesm/services/permission.service.js +213 -92
- package/fesm/services/role.service.js +48 -4
- package/package.json +3 -3
- package/services/action.service.d.ts +7 -3
- package/services/permission-cache.service.d.ts +13 -19
- package/services/permission.service.d.ts +6 -3
- package/services/role.service.d.ts +7 -3
|
@@ -10,6 +10,7 @@ export declare class PermissionService {
|
|
|
10
10
|
private getPermissionRepository;
|
|
11
11
|
private getActionRepository;
|
|
12
12
|
private getRoleRepository;
|
|
13
|
+
private getActionsMap;
|
|
13
14
|
assignUserActions(dto: AssignUserActionsDto): Promise<PermissionOperationResultDto>;
|
|
14
15
|
getUserActions(userId: string, branchId: string | undefined, companyId?: string | undefined): Promise<UserActionResponseDto[]>;
|
|
15
16
|
assignRoleActions(dto: AssignRoleActionsDto): Promise<PermissionOperationResultDto>;
|
|
@@ -23,7 +24,6 @@ export declare class PermissionService {
|
|
|
23
24
|
getUserRoles(userId: string, branchId?: string | undefined, companyId?: string | undefined): Promise<UserRoleResponseDto[]>;
|
|
24
25
|
getMyPermissions(userId: string, branchId: string | null, companyId?: string | null, parentCodes?: string[]): Promise<MyPermissionsResponseDto>;
|
|
25
26
|
private buildResponseFromCache;
|
|
26
|
-
private getCurrentTenantId;
|
|
27
27
|
private getParentIdsByCodesWithCache;
|
|
28
28
|
private fetchAndCachePermissions;
|
|
29
29
|
private collectAllActionIds;
|
|
@@ -34,7 +34,10 @@ export declare class PermissionService {
|
|
|
34
34
|
private getUserRoleIds;
|
|
35
35
|
private getRoleActionIds;
|
|
36
36
|
private getUserActionIds;
|
|
37
|
-
private invalidateUserPermissionCache;
|
|
38
37
|
private invalidateRoleMembersCache;
|
|
39
|
-
|
|
38
|
+
invalidateCompanyMembersCache(companyId: string): Promise<number>;
|
|
39
|
+
revokeCompanyPermissions(companyId: string): Promise<void>;
|
|
40
|
+
revokeBranchPermissions(branchId: string, companyId: string): Promise<void>;
|
|
41
|
+
revokeUserCompanyAccess(userId: string, companyId: string): Promise<void>;
|
|
42
|
+
revokeUserBranchAccess(userId: string, branchId: string, companyId: string): Promise<void>;
|
|
40
43
|
}
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ApiService, HybridCache } from '@flusys/nestjs-shared/classes';
|
|
2
|
+
import { DeleteDto } from '@flusys/nestjs-shared/dtos';
|
|
2
3
|
import { ILoggedUserInfo } from '@flusys/nestjs-shared/interfaces';
|
|
3
4
|
import { UtilsService } from '@flusys/nestjs-shared/modules';
|
|
4
|
-
import { EntityTarget, SelectQueryBuilder } from 'typeorm';
|
|
5
|
+
import { EntityTarget, QueryRunner, SelectQueryBuilder } from 'typeorm';
|
|
5
6
|
import { CreateRoleDto, UpdateRoleDto } from '../dtos/role.dto';
|
|
6
7
|
import { RoleBase } from '../entities/role-base.entity';
|
|
7
8
|
import { IRole } from '../interfaces/role.interface';
|
|
8
9
|
import { IAMConfigService } from './iam-config.service';
|
|
9
10
|
import { IAMDataSourceService } from './iam-datasource.service';
|
|
11
|
+
import { PermissionCacheService } from './permission-cache.service';
|
|
10
12
|
export declare class RoleService extends ApiService<CreateRoleDto, UpdateRoleDto, IRole, RoleBase> {
|
|
11
13
|
protected cacheManager: HybridCache;
|
|
12
14
|
protected utilsService: UtilsService;
|
|
13
15
|
private readonly iamConfigService;
|
|
14
|
-
|
|
16
|
+
private readonly permissionCacheService;
|
|
17
|
+
constructor(cacheManager: HybridCache, utilsService: UtilsService, iamConfigService: IAMConfigService, dataSourceProvider: IAMDataSourceService, permissionCacheService: PermissionCacheService);
|
|
18
|
+
protected beforeDeleteOperation(dto: DeleteDto, user: ILoggedUserInfo | null, queryRunner: QueryRunner): Promise<void>;
|
|
15
19
|
protected resolveEntity(): EntityTarget<RoleBase>;
|
|
16
20
|
convertSingleDtoToEntity(dto: CreateRoleDto | UpdateRoleDto, user: ILoggedUserInfo | null): Promise<RoleBase>;
|
|
17
21
|
getSelectQuery(query: SelectQueryBuilder<RoleBase>, _user: ILoggedUserInfo | null, select?: string[]): Promise<{
|