@tomei/sso 0.39.2 → 0.39.3
Sign up to get free protection for your applications and to get access to all the features.
package/package.json
CHANGED
@@ -910,22 +910,25 @@ export class User extends UserBase {
|
|
910
910
|
transaction: dbTransaction,
|
911
911
|
});
|
912
912
|
|
913
|
+
const gp = group?.GroupPrivileges || [];
|
914
|
+
const op = objectPrivileges || [];
|
915
|
+
|
913
916
|
let privileges: string[] = [];
|
914
917
|
// Add privileges from the group to the privileges array
|
915
918
|
const groupPrivileges: string[] = [];
|
916
|
-
for (const groupPrivilege of
|
919
|
+
for (const groupPrivilege of gp) {
|
917
920
|
groupPrivileges.push(groupPrivilege.Privilege.PrivilegeCode);
|
918
921
|
}
|
919
922
|
|
920
923
|
const ops: string[] = [];
|
921
|
-
for (const objectPrivilege of
|
924
|
+
for (const objectPrivilege of op) {
|
922
925
|
ops.push(objectPrivilege.Privilege.PrivilegeCode);
|
923
926
|
}
|
924
927
|
|
925
928
|
privileges = [...privileges, ...groupPrivileges, ...ops];
|
926
929
|
|
927
930
|
// Recursive call if not root and allow inherit privileges from parent group
|
928
|
-
if (group
|
931
|
+
if (group?.ParentGroupCode && group?.InheritParentPrivilegeYN === 'Y') {
|
929
932
|
const parentGroupPrivileges = await this.getInheritedPrivileges(
|
930
933
|
group.ParentGroupCode,
|
931
934
|
systemCode,
|
@@ -945,20 +948,21 @@ export class User extends UserBase {
|
|
945
948
|
dbTransaction?: any,
|
946
949
|
): Promise<string[]> {
|
947
950
|
try {
|
948
|
-
const userPrivileges =
|
949
|
-
|
950
|
-
UserId: this.UserId,
|
951
|
-
Status: 'Active',
|
952
|
-
},
|
953
|
-
include: {
|
954
|
-
model: SystemPrivilege,
|
951
|
+
const userPrivileges =
|
952
|
+
(await User._UserPrivilegeRepo.findAll({
|
955
953
|
where: {
|
956
|
-
|
954
|
+
UserId: this.UserId,
|
957
955
|
Status: 'Active',
|
958
956
|
},
|
959
|
-
|
960
|
-
|
961
|
-
|
957
|
+
include: {
|
958
|
+
model: SystemPrivilege,
|
959
|
+
where: {
|
960
|
+
SystemCode: systemCode,
|
961
|
+
Status: 'Active',
|
962
|
+
},
|
963
|
+
},
|
964
|
+
transaction: dbTransaction,
|
965
|
+
})) || [];
|
962
966
|
|
963
967
|
const privileges: string[] = userPrivileges.map(
|
964
968
|
(u) => u.Privilege.PrivilegeCode,
|
@@ -974,19 +978,20 @@ export class User extends UserBase {
|
|
974
978
|
dbTransaction?: any,
|
975
979
|
): Promise<string[]> {
|
976
980
|
try {
|
977
|
-
const userObjectPrivileges =
|
978
|
-
|
979
|
-
UserId: this.UserId,
|
980
|
-
},
|
981
|
-
include: {
|
982
|
-
model: SystemPrivilege,
|
981
|
+
const userObjectPrivileges =
|
982
|
+
(await User._UserObjectPrivilegeRepo.findAll({
|
983
983
|
where: {
|
984
|
-
|
985
|
-
Status: 'Active',
|
984
|
+
UserId: this.UserId,
|
986
985
|
},
|
987
|
-
|
988
|
-
|
989
|
-
|
986
|
+
include: {
|
987
|
+
model: SystemPrivilege,
|
988
|
+
where: {
|
989
|
+
SystemCode: systemCode,
|
990
|
+
Status: 'Active',
|
991
|
+
},
|
992
|
+
},
|
993
|
+
transaction: dbTransaction,
|
994
|
+
})) || [];
|
990
995
|
|
991
996
|
const privilegesCodes: string[] = userObjectPrivileges.map(
|
992
997
|
(u) => u.Privilege.PrivilegeCode,
|