@flusys/nestjs-iam 8.1.2 → 8.1.4
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/dtos/permission.dto.d.ts +4 -0
- package/fesm/867.js +40 -8
- package/fesm/dtos/index.js +28 -0
- package/package.json +3 -3
package/dtos/permission.dto.d.ts
CHANGED
|
@@ -85,11 +85,15 @@ export declare class UserRoleResponseDto {
|
|
|
85
85
|
export declare class RoleUserResponseDto {
|
|
86
86
|
id: string;
|
|
87
87
|
userId: string;
|
|
88
|
+
companyId: string | null;
|
|
89
|
+
branchId: string | null;
|
|
88
90
|
createdAt: Date;
|
|
89
91
|
}
|
|
90
92
|
export declare class ActionUserResponseDto {
|
|
91
93
|
id: string;
|
|
92
94
|
userId: string;
|
|
95
|
+
companyId: string | null;
|
|
96
|
+
branchId: string | null;
|
|
93
97
|
createdAt: Date;
|
|
94
98
|
}
|
|
95
99
|
export declare class FrontendActionDto {
|
package/fesm/867.js
CHANGED
|
@@ -576,6 +576,8 @@ _ts_decorate([
|
|
|
576
576
|
class RoleUserResponseDto {
|
|
577
577
|
id;
|
|
578
578
|
userId;
|
|
579
|
+
companyId;
|
|
580
|
+
branchId;
|
|
579
581
|
createdAt;
|
|
580
582
|
}
|
|
581
583
|
_ts_decorate([
|
|
@@ -590,6 +592,18 @@ _ts_decorate([
|
|
|
590
592
|
}),
|
|
591
593
|
_ts_metadata("design:type", String)
|
|
592
594
|
], RoleUserResponseDto.prototype, "userId", void 0);
|
|
595
|
+
_ts_decorate([
|
|
596
|
+
(0,_nestjs_swagger__rspack_import_0.ApiPropertyOptional)({
|
|
597
|
+
description: 'Company ID (null = global)'
|
|
598
|
+
}),
|
|
599
|
+
_ts_metadata("design:type", Object)
|
|
600
|
+
], RoleUserResponseDto.prototype, "companyId", void 0);
|
|
601
|
+
_ts_decorate([
|
|
602
|
+
(0,_nestjs_swagger__rspack_import_0.ApiPropertyOptional)({
|
|
603
|
+
description: 'Branch ID (null = company-wide)'
|
|
604
|
+
}),
|
|
605
|
+
_ts_metadata("design:type", Object)
|
|
606
|
+
], RoleUserResponseDto.prototype, "branchId", void 0);
|
|
593
607
|
_ts_decorate([
|
|
594
608
|
(0,_nestjs_swagger__rspack_import_0.ApiProperty)({
|
|
595
609
|
description: 'When this permission was created'
|
|
@@ -599,6 +613,8 @@ _ts_decorate([
|
|
|
599
613
|
class ActionUserResponseDto {
|
|
600
614
|
id;
|
|
601
615
|
userId;
|
|
616
|
+
companyId;
|
|
617
|
+
branchId;
|
|
602
618
|
createdAt;
|
|
603
619
|
}
|
|
604
620
|
_ts_decorate([
|
|
@@ -613,6 +629,18 @@ _ts_decorate([
|
|
|
613
629
|
}),
|
|
614
630
|
_ts_metadata("design:type", String)
|
|
615
631
|
], ActionUserResponseDto.prototype, "userId", void 0);
|
|
632
|
+
_ts_decorate([
|
|
633
|
+
(0,_nestjs_swagger__rspack_import_0.ApiPropertyOptional)({
|
|
634
|
+
description: 'Company ID (null = global)'
|
|
635
|
+
}),
|
|
636
|
+
_ts_metadata("design:type", Object)
|
|
637
|
+
], ActionUserResponseDto.prototype, "companyId", void 0);
|
|
638
|
+
_ts_decorate([
|
|
639
|
+
(0,_nestjs_swagger__rspack_import_0.ApiPropertyOptional)({
|
|
640
|
+
description: 'Branch ID (null = company-wide)'
|
|
641
|
+
}),
|
|
642
|
+
_ts_metadata("design:type", Object)
|
|
643
|
+
], ActionUserResponseDto.prototype, "branchId", void 0);
|
|
616
644
|
_ts_decorate([
|
|
617
645
|
(0,_nestjs_swagger__rspack_import_0.ApiProperty)({
|
|
618
646
|
description: 'When this permission was created'
|
|
@@ -2655,8 +2683,8 @@ class PermissionService {
|
|
|
2655
2683
|
targetId: (0,typeorm__rspack_import_3.In)(actionIdsToAdd)
|
|
2656
2684
|
};
|
|
2657
2685
|
if (enableCompanyFeature) {
|
|
2658
|
-
|
|
2659
|
-
|
|
2686
|
+
whereFind.companyId = companyId === null ? (0,typeorm__rspack_import_3.IsNull)() : companyId;
|
|
2687
|
+
whereFind.branchId = branchId === null ? (0,typeorm__rspack_import_3.IsNull)() : branchId;
|
|
2660
2688
|
}
|
|
2661
2689
|
const existingPermissions = await permissionRepo.find({
|
|
2662
2690
|
where: whereFind,
|
|
@@ -2699,8 +2727,8 @@ class PermissionService {
|
|
|
2699
2727
|
targetId: (0,typeorm__rspack_import_3.In)(actionIdsToRemove)
|
|
2700
2728
|
};
|
|
2701
2729
|
if (enableCompanyFeature) {
|
|
2702
|
-
|
|
2703
|
-
|
|
2730
|
+
whereDelete.companyId = companyId === null ? (0,typeorm__rspack_import_3.IsNull)() : companyId;
|
|
2731
|
+
whereDelete.branchId = branchId === null ? (0,typeorm__rspack_import_3.IsNull)() : branchId;
|
|
2704
2732
|
}
|
|
2705
2733
|
const result = await permissionRepo.delete(whereDelete);
|
|
2706
2734
|
removed = result.affected || 0;
|
|
@@ -2758,6 +2786,8 @@ class PermissionService {
|
|
|
2758
2786
|
return permissions.map((p)=>({
|
|
2759
2787
|
id: p.id,
|
|
2760
2788
|
userId: p.sourceId,
|
|
2789
|
+
companyId: ('companyId' in p ? p.companyId : null) ?? null,
|
|
2790
|
+
branchId: ('branchId' in p ? p.branchId : null) ?? null,
|
|
2761
2791
|
createdAt: p.createdAt
|
|
2762
2792
|
}));
|
|
2763
2793
|
}
|
|
@@ -3007,8 +3037,8 @@ class PermissionService {
|
|
|
3007
3037
|
targetId: (0,typeorm__rspack_import_3.In)(roleIdsToAdd)
|
|
3008
3038
|
};
|
|
3009
3039
|
if (enableCompanyFeature) {
|
|
3010
|
-
|
|
3011
|
-
|
|
3040
|
+
whereFind.companyId = companyId === null ? (0,typeorm__rspack_import_3.IsNull)() : companyId;
|
|
3041
|
+
whereFind.branchId = branchId === null ? (0,typeorm__rspack_import_3.IsNull)() : branchId;
|
|
3012
3042
|
}
|
|
3013
3043
|
const existingPermissions = await permissionRepo.find({
|
|
3014
3044
|
where: whereFind,
|
|
@@ -3051,8 +3081,8 @@ class PermissionService {
|
|
|
3051
3081
|
targetId: (0,typeorm__rspack_import_3.In)(roleIdsToRemove)
|
|
3052
3082
|
};
|
|
3053
3083
|
if (enableCompanyFeature) {
|
|
3054
|
-
|
|
3055
|
-
|
|
3084
|
+
whereDelete.companyId = companyId === null ? (0,typeorm__rspack_import_3.IsNull)() : companyId;
|
|
3085
|
+
whereDelete.branchId = branchId === null ? (0,typeorm__rspack_import_3.IsNull)() : branchId;
|
|
3056
3086
|
}
|
|
3057
3087
|
const result = await permissionRepo.delete(whereDelete);
|
|
3058
3088
|
removed = result.affected || 0;
|
|
@@ -3119,6 +3149,8 @@ class PermissionService {
|
|
|
3119
3149
|
return permissions.map((p)=>({
|
|
3120
3150
|
id: p.id,
|
|
3121
3151
|
userId: p.sourceId,
|
|
3152
|
+
companyId: ('companyId' in p ? p.companyId : null) ?? null,
|
|
3153
|
+
branchId: ('branchId' in p ? p.branchId : null) ?? null,
|
|
3122
3154
|
createdAt: p.createdAt
|
|
3123
3155
|
}));
|
|
3124
3156
|
}
|
package/fesm/dtos/index.js
CHANGED
|
@@ -786,6 +786,8 @@ _ts_decorate([
|
|
|
786
786
|
class RoleUserResponseDto {
|
|
787
787
|
id;
|
|
788
788
|
userId;
|
|
789
|
+
companyId;
|
|
790
|
+
branchId;
|
|
789
791
|
createdAt;
|
|
790
792
|
}
|
|
791
793
|
_ts_decorate([
|
|
@@ -800,6 +802,18 @@ _ts_decorate([
|
|
|
800
802
|
}),
|
|
801
803
|
_ts_metadata("design:type", String)
|
|
802
804
|
], RoleUserResponseDto.prototype, "userId", void 0);
|
|
805
|
+
_ts_decorate([
|
|
806
|
+
(0,_nestjs_swagger__rspack_import_0.ApiPropertyOptional)({
|
|
807
|
+
description: 'Company ID (null = global)'
|
|
808
|
+
}),
|
|
809
|
+
_ts_metadata("design:type", Object)
|
|
810
|
+
], RoleUserResponseDto.prototype, "companyId", void 0);
|
|
811
|
+
_ts_decorate([
|
|
812
|
+
(0,_nestjs_swagger__rspack_import_0.ApiPropertyOptional)({
|
|
813
|
+
description: 'Branch ID (null = company-wide)'
|
|
814
|
+
}),
|
|
815
|
+
_ts_metadata("design:type", Object)
|
|
816
|
+
], RoleUserResponseDto.prototype, "branchId", void 0);
|
|
803
817
|
_ts_decorate([
|
|
804
818
|
(0,_nestjs_swagger__rspack_import_0.ApiProperty)({
|
|
805
819
|
description: 'When this permission was created'
|
|
@@ -809,6 +823,8 @@ _ts_decorate([
|
|
|
809
823
|
class ActionUserResponseDto {
|
|
810
824
|
id;
|
|
811
825
|
userId;
|
|
826
|
+
companyId;
|
|
827
|
+
branchId;
|
|
812
828
|
createdAt;
|
|
813
829
|
}
|
|
814
830
|
_ts_decorate([
|
|
@@ -823,6 +839,18 @@ _ts_decorate([
|
|
|
823
839
|
}),
|
|
824
840
|
_ts_metadata("design:type", String)
|
|
825
841
|
], ActionUserResponseDto.prototype, "userId", void 0);
|
|
842
|
+
_ts_decorate([
|
|
843
|
+
(0,_nestjs_swagger__rspack_import_0.ApiPropertyOptional)({
|
|
844
|
+
description: 'Company ID (null = global)'
|
|
845
|
+
}),
|
|
846
|
+
_ts_metadata("design:type", Object)
|
|
847
|
+
], ActionUserResponseDto.prototype, "companyId", void 0);
|
|
848
|
+
_ts_decorate([
|
|
849
|
+
(0,_nestjs_swagger__rspack_import_0.ApiPropertyOptional)({
|
|
850
|
+
description: 'Branch ID (null = company-wide)'
|
|
851
|
+
}),
|
|
852
|
+
_ts_metadata("design:type", Object)
|
|
853
|
+
], ActionUserResponseDto.prototype, "branchId", void 0);
|
|
826
854
|
_ts_decorate([
|
|
827
855
|
(0,_nestjs_swagger__rspack_import_0.ApiProperty)({
|
|
828
856
|
description: 'When this permission was created'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flusys/nestjs-iam",
|
|
3
|
-
"version": "8.1.
|
|
3
|
+
"version": "8.1.4",
|
|
4
4
|
"description": "Identity and Access Management (IAM) module for NestJS applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./fesm/index.js",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"express": "^5.0.0"
|
|
84
84
|
},
|
|
85
85
|
"dependencies": {
|
|
86
|
-
"@flusys/nestjs-core": "8.1.
|
|
87
|
-
"@flusys/nestjs-shared": "8.1.
|
|
86
|
+
"@flusys/nestjs-core": "8.1.4",
|
|
87
|
+
"@flusys/nestjs-shared": "8.1.4"
|
|
88
88
|
}
|
|
89
89
|
}
|