@tomei/sso 0.39.1 → 0.39.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/src/components/api-key/api-key.d.ts +1 -1
- package/dist/src/components/api-key/api-key.js +3 -3
- package/dist/src/components/login-user/user.js +9 -7
- package/dist/src/components/login-user/user.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/interfaces/api-key-attr.interface.d.ts +1 -1
- package/dist/src/models/api-key-entity.d.ts +1 -1
- package/dist/src/models/api-key-entity.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/api-key/api-key.ts +4 -4
- package/src/components/login-user/user.ts +30 -25
- package/src/index.ts +1 -0
- package/src/interfaces/api-key-attr.interface.ts +1 -1
- package/src/models/api-key-entity.ts +1 -1
package/package.json
CHANGED
@@ -17,7 +17,7 @@ export class APIKey extends ObjectBase {
|
|
17
17
|
Name: string;
|
18
18
|
Description: string;
|
19
19
|
Status: APIKeyStatusEnum;
|
20
|
-
|
20
|
+
ExpirationDate: Date;
|
21
21
|
_InvokedById: number;
|
22
22
|
_InvokedAt: Date;
|
23
23
|
_CreatedAt: Date;
|
@@ -57,7 +57,7 @@ export class APIKey extends ObjectBase {
|
|
57
57
|
this.Name = apiKeyAttr.Name;
|
58
58
|
this.Description = apiKeyAttr.Description;
|
59
59
|
this.Status = apiKeyAttr.Status;
|
60
|
-
this.
|
60
|
+
this.ExpirationDate = apiKeyAttr.ExpirationDate;
|
61
61
|
this._InvokedById = apiKeyAttr.InvokedById;
|
62
62
|
this._InvokedAt = apiKeyAttr.InvokedAt;
|
63
63
|
this._CreatedAt = apiKeyAttr.CreatedAt;
|
@@ -132,7 +132,7 @@ export class APIKey extends ObjectBase {
|
|
132
132
|
ApiKey: this.ApiKey,
|
133
133
|
Name: this.Name,
|
134
134
|
Status: this.Status,
|
135
|
-
ExpirationDate: this.
|
135
|
+
ExpirationDate: this.ExpirationDate,
|
136
136
|
CreatedAt: this.CreatedAt,
|
137
137
|
CreatedById: this.CreatedById,
|
138
138
|
InvokedAt: this.InvokedAt,
|
@@ -183,7 +183,7 @@ export class APIKey extends ObjectBase {
|
|
183
183
|
ApiKey: this.ApiKey,
|
184
184
|
Name: this.Name,
|
185
185
|
Status: this.Status,
|
186
|
-
ExpirationDate: this.
|
186
|
+
ExpirationDate: this.ExpirationDate,
|
187
187
|
CreatedAt: this.CreatedAt,
|
188
188
|
CreatedById: this.CreatedById,
|
189
189
|
InvokedAt: this.InvokedAt,
|
@@ -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,
|
package/src/index.ts
CHANGED