@tomei/sso 0.47.0 → 0.48.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/src/components/user-group/user-group.d.ts +5 -0
- package/dist/src/components/user-group/user-group.js +73 -0
- package/dist/src/components/user-group/user-group.js.map +1 -1
- package/dist/src/components/user-privilege/user-privilege.d.ts +42 -0
- package/dist/src/components/user-privilege/user-privilege.js +336 -0
- package/dist/src/components/user-privilege/user-privilege.js.map +1 -1
- package/dist/src/components/user-privilege/user-privilege.repository.d.ts +1 -0
- package/dist/src/components/user-privilege/user-privilege.repository.js +25 -0
- package/dist/src/components/user-privilege/user-privilege.repository.js.map +1 -1
- package/dist/src/components/user-system-access/user-system-access.d.ts +12 -0
- package/dist/src/components/user-system-access/user-system-access.js +148 -0
- package/dist/src/components/user-system-access/user-system-access.js.map +1 -1
- package/dist/src/components/user-system-access/user-system-access.repository.d.ts +1 -0
- package/dist/src/components/user-system-access/user-system-access.repository.js +25 -0
- package/dist/src/components/user-system-access/user-system-access.repository.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/user-group/user-group.ts +134 -0
- package/src/components/user-privilege/user-privilege.repository.ts +14 -0
- package/src/components/user-privilege/user-privilege.ts +585 -0
- package/src/components/user-system-access/user-system-access.repository.ts +14 -0
- package/src/components/user-system-access/user-system-access.ts +298 -0
@@ -2,6 +2,7 @@ import { ObjectBase } from '@tomei/general';
|
|
2
2
|
import { UserGroupRepository } from './user-group.repository';
|
3
3
|
import { LoginUser, User } from '../../components/login-user';
|
4
4
|
import { Group } from '../../components/group';
|
5
|
+
import { Transaction } from 'sequelize';
|
5
6
|
export declare class UserGroup extends ObjectBase {
|
6
7
|
ObjectType: string;
|
7
8
|
TableName: string;
|
@@ -40,4 +41,8 @@ export declare class UserGroup extends ObjectBase {
|
|
40
41
|
UpdatedAt: Date;
|
41
42
|
}[];
|
42
43
|
}[]>;
|
44
|
+
update(loginUser: LoginUser, dbTransaction: Transaction, UpdatedProperties: {
|
45
|
+
InheritGroupPrivilegeYN?: string;
|
46
|
+
InheritGroupSystemAccessYN?: string;
|
47
|
+
}): Promise<UserGroup>;
|
43
48
|
}
|
@@ -244,6 +244,79 @@ class UserGroup extends general_1.ObjectBase {
|
|
244
244
|
}
|
245
245
|
});
|
246
246
|
}
|
247
|
+
update(loginUser, dbTransaction, UpdatedProperties) {
|
248
|
+
return __awaiter(this, void 0, void 0, function* () {
|
249
|
+
try {
|
250
|
+
const systemCode = config_1.ApplicationConfig.getComponentConfigValue('system-code');
|
251
|
+
const isPrivileged = yield loginUser.checkPrivileges(systemCode, 'USER_GROUP_UPDATE');
|
252
|
+
if (!isPrivileged) {
|
253
|
+
throw new general_1.ClassError('UserGroup', 'UserGroupErrMsg0X', 'User does not have privilege to update user group.', 'update', 403);
|
254
|
+
}
|
255
|
+
if (!UpdatedProperties.InheritGroupPrivilegeYN &&
|
256
|
+
!UpdatedProperties.InheritGroupSystemAccessYN) {
|
257
|
+
throw new general_1.ClassError('UserGroup', 'UserGroupErrMsg04', 'At least one of the properties to update is required.', 'update', 400);
|
258
|
+
}
|
259
|
+
const entityValueBefore = {
|
260
|
+
UserGroupId: this.UserGroupId,
|
261
|
+
UserId: this.UserId,
|
262
|
+
GroupCode: this.GroupCode,
|
263
|
+
Status: this.Status,
|
264
|
+
CreatedById: this._CreatedById,
|
265
|
+
CreatedAt: this._CreatedAt,
|
266
|
+
UpdatedById: this._UpdatedById,
|
267
|
+
UpdatedAt: this._UpdatedAt,
|
268
|
+
InheritGroupPrivilegeYN: this.InheritGroupPrivilegeYN,
|
269
|
+
InheritGroupSystemAccessYN: this.InheritGroupSystemAccessYN,
|
270
|
+
};
|
271
|
+
this._UpdatedById = loginUser.UserId;
|
272
|
+
this._UpdatedAt = new Date();
|
273
|
+
if (UpdatedProperties.InheritGroupPrivilegeYN) {
|
274
|
+
this.InheritGroupPrivilegeYN =
|
275
|
+
UpdatedProperties.InheritGroupPrivilegeYN;
|
276
|
+
}
|
277
|
+
if (UpdatedProperties.InheritGroupSystemAccessYN) {
|
278
|
+
this.InheritGroupSystemAccessYN =
|
279
|
+
UpdatedProperties.InheritGroupSystemAccessYN;
|
280
|
+
}
|
281
|
+
yield UserGroup._Repository.update({
|
282
|
+
InheritGroupPrivilegeYN: this.InheritGroupPrivilegeYN,
|
283
|
+
InheritGroupSystemAccessYN: this.InheritGroupSystemAccessYN,
|
284
|
+
UpdatedById: this._UpdatedById,
|
285
|
+
UpdatedAt: this._UpdatedAt,
|
286
|
+
}, {
|
287
|
+
where: {
|
288
|
+
UserGroupId: this.UserGroupId,
|
289
|
+
},
|
290
|
+
transaction: dbTransaction,
|
291
|
+
});
|
292
|
+
const entityValueAfter = {
|
293
|
+
UserGroupId: this.UserGroupId,
|
294
|
+
UserId: this.UserId,
|
295
|
+
GroupCode: this.GroupCode,
|
296
|
+
Status: this.Status,
|
297
|
+
CreatedById: this._CreatedById,
|
298
|
+
CreatedAt: this._CreatedAt,
|
299
|
+
UpdatedById: this._UpdatedById,
|
300
|
+
UpdatedAt: this._UpdatedAt,
|
301
|
+
InheritGroupPrivilegeYN: this.InheritGroupPrivilegeYN,
|
302
|
+
InheritGroupSystemAccessYN: this.InheritGroupSystemAccessYN,
|
303
|
+
};
|
304
|
+
const activity = new activity_history_1.Activity();
|
305
|
+
activity.ActivityId = activity.createId();
|
306
|
+
activity.Action = activity_history_1.ActionEnum.UPDATE;
|
307
|
+
activity.Description = 'Update User Group';
|
308
|
+
activity.EntityType = 'UserGroup';
|
309
|
+
activity.EntityId = this.UserGroupId.toString();
|
310
|
+
activity.EntityValueBefore = JSON.stringify(entityValueBefore);
|
311
|
+
activity.EntityValueAfter = JSON.stringify(entityValueAfter);
|
312
|
+
yield activity.create(loginUser.ObjectId, dbTransaction);
|
313
|
+
return this;
|
314
|
+
}
|
315
|
+
catch (error) {
|
316
|
+
throw error;
|
317
|
+
}
|
318
|
+
});
|
319
|
+
}
|
247
320
|
}
|
248
321
|
exports.UserGroup = UserGroup;
|
249
322
|
UserGroup._Repository = new user_group_repository_1.UserGroupRepository();
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"user-group.js","sourceRoot":"","sources":["../../../../src/components/user-group/user-group.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAwD;AACxD,mEAA8D;AAI9D,0CAAkD;AAClD,8DAA+D;AAC/D,wFAA6E;AAC7E,4DAAmD;AACnD,8DAAqD;
|
1
|
+
{"version":3,"file":"user-group.js","sourceRoot":"","sources":["../../../../src/components/user-group/user-group.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAwD;AACxD,mEAA8D;AAI9D,0CAAkD;AAClD,8DAA+D;AAC/D,wFAA6E;AAC7E,4DAAmD;AACnD,8DAAqD;AAGrD,MAAa,SAAU,SAAQ,oBAAU;IAkBvC,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,YAAoB,aAA8B;QAChD,KAAK,EAAE,CAAC;QAlCV,eAAU,GAAG,WAAW,CAAC;QACzB,cAAS,GAAG,eAAe,CAAC;QAM5B,4BAAuB,GAAG,GAAG,CAAC;QAC9B,+BAA0B,GAAG,GAAG,CAAC;QA2B/B,IAAI,aAAa,EAAE;YACjB,IAAI,CAAC,WAAW,GAAG,aAAa,CAAC,WAAW,CAAC;YAC7C,IAAI,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC;YACnC,IAAI,CAAC,SAAS,GAAG,aAAa,CAAC,SAAS,CAAC;YACzC,IAAI,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC;YACnC,IAAI,CAAC,uBAAuB,GAAG,aAAa,CAAC,uBAAuB,CAAC;YACrE,IAAI,C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AM;oBACnB,WAAW,EAAE,IAAI,CAAC,YAAY;oBAC9B,SAAS,EAAE,IAAI,CAAC,UAAU;oBAC1B,WAAW,EAAE,IAAI,CAAC,YAAY;oBAC9B,SAAS,EAAE,IAAI,CAAC,UAAU;oBAC1B,uBAAuB,EAAE,IAAI,CAAC,uBAAuB;oBACrD,0BAA0B,EAAE,IAAI,CAAC,0BAA0B;iBAC5D,CAAC;gBASF,MAAM,QAAQ,GAAG,IAAI,2BAAQ,EAAE,CAAC;gBAChC,QAAQ,CAAC,UAAU,GAAG,QAAQ,CAAC,QAAQ,EAAE,CAAC;gBAC1C,QAAQ,CAAC,MAAM,GAAG,6BAAU,CAAC,MAAM,CAAC;gBACpC,QAAQ,CAAC,WAAW,GAAG,mBAAmB,CAAC;gBAC3C,QAAQ,CAAC,UAAU,GAAG,WAAW,CAAC;gBAClC,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;gBAChD,QAAQ,CAAC,iBAAiB,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;gBAC/D,QAAQ,CAAC,gBAAgB,GAAG,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;gBAO7D,MAAM,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;gBAEzD,OAAO,IAAI,CAAC;aACb;YAAC,OAAO,KAAK,EAAE;gBACd,MAAM,KAAK,CAAC;aACb;QACH,CAAC;KAAA;;AAnkBH,8BAokBC;AApjBkB,qBAAW,GAAG,IAAI,2CAAmB,EAAE,CAAC"}
|
@@ -1,4 +1,6 @@
|
|
1
1
|
import { ObjectBase } from '@tomei/general';
|
2
|
+
import { User as UserClass } from '../login-user/user';
|
3
|
+
import { User as UserLogin } from '../login-user/user';
|
2
4
|
export declare class UserPrivilege extends ObjectBase {
|
3
5
|
TableName: string;
|
4
6
|
ObjectType: string;
|
@@ -17,6 +19,46 @@ export declare class UserPrivilege extends ObjectBase {
|
|
17
19
|
get CreatedAt(): Date;
|
18
20
|
get UpdatedAt(): Date;
|
19
21
|
private static _Repository;
|
22
|
+
private static _UserGroupRepository;
|
23
|
+
private static _GroupPrivilegeRepository;
|
24
|
+
private static _SystemPrivilegeRepository;
|
20
25
|
private constructor();
|
21
26
|
static init(dbTransaction?: any, UserPrivilegeId?: number): Promise<UserPrivilege>;
|
27
|
+
static findAll(loginUser: UserClass, dbTransaction: any, whereOption: {
|
28
|
+
UserId: number;
|
29
|
+
SystemCode?: string;
|
30
|
+
}, pagination: {
|
31
|
+
page: number;
|
32
|
+
limit: number;
|
33
|
+
}): Promise<{
|
34
|
+
records: {
|
35
|
+
UserPrivilegeId: number;
|
36
|
+
SystemPrivilegeId: string;
|
37
|
+
PrivilegeCode: string;
|
38
|
+
SystemName: string;
|
39
|
+
Status: string;
|
40
|
+
CreatedBy: string;
|
41
|
+
CreatedAt: Date;
|
42
|
+
UpdatedBy: string;
|
43
|
+
UpdatedAt: Date;
|
44
|
+
}[];
|
45
|
+
pagination: {
|
46
|
+
currentPage: number;
|
47
|
+
pageSize: number;
|
48
|
+
totalRecords: number;
|
49
|
+
};
|
50
|
+
}>;
|
51
|
+
static findAllInheritedPrivileges(UserId: number, loginUser: UserClass, dbTransaction: any): Promise<any[]>;
|
52
|
+
static assignPrivileges(loginUser: UserLogin, dbTransaction: any, UserId: string, SystemPrivilegeId: string, Status: string): Promise<UserPrivilege>;
|
53
|
+
update(loginUser: UserLogin, dbTransaction: any, Status: string): Promise<{
|
54
|
+
UserPrivilegeId: number;
|
55
|
+
UserId: number;
|
56
|
+
SystemPrivilegeId: string;
|
57
|
+
Status: string;
|
58
|
+
CreatedById: number;
|
59
|
+
CreatedAt: Date;
|
60
|
+
UpdatedById: number;
|
61
|
+
UpdatedAt: Date;
|
62
|
+
}>;
|
63
|
+
static remove(loginUser: UserLogin, dbTransaction: any, UserPrivilegeId: number): Promise<void>;
|
22
64
|
}
|
@@ -12,6 +12,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.UserPrivilege = void 0;
|
13
13
|
const general_1 = require("@tomei/general");
|
14
14
|
const user_privilege_repository_1 = require("./user-privilege.repository");
|
15
|
+
const config_1 = require("@tomei/config");
|
16
|
+
const system_privilege_entity_1 = require("../../models/system-privilege.entity");
|
17
|
+
const system_entity_1 = require("../../models/system.entity");
|
18
|
+
const user_group_repository_1 = require("../user-group/user-group.repository");
|
19
|
+
const group_entity_1 = require("../../models/group.entity");
|
20
|
+
const user_entity_1 = require("../../models/user.entity");
|
21
|
+
const group_privilege_repository_1 = require("../group-privilege/group-privilege.repository");
|
22
|
+
const system_privilege_repository_1 = require("../system-privilege/system-privilege.repository");
|
23
|
+
const sequelize_1 = require("sequelize");
|
24
|
+
const activity_history_1 = require("@tomei/activity-history");
|
15
25
|
class UserPrivilege extends general_1.ObjectBase {
|
16
26
|
get CreatedById() {
|
17
27
|
return this._CreatedById;
|
@@ -63,7 +73,333 @@ class UserPrivilege extends general_1.ObjectBase {
|
|
63
73
|
}
|
64
74
|
});
|
65
75
|
}
|
76
|
+
static findAll(loginUser, dbTransaction, whereOption, pagination) {
|
77
|
+
return __awaiter(this, void 0, void 0, function* () {
|
78
|
+
try {
|
79
|
+
const systemCode = config_1.ApplicationConfig.getComponentConfigValue('system-code');
|
80
|
+
const privilegeCode = 'USER_PRIVILEGE_LIST';
|
81
|
+
const isPrivileged = yield loginUser.checkPrivileges(systemCode, privilegeCode);
|
82
|
+
if (!isPrivileged) {
|
83
|
+
throw new general_1.ClassError('UserPrivilege', 'UserPrivilegeErrMsg01', 'You do not have permission to access this resource.');
|
84
|
+
}
|
85
|
+
const options = {
|
86
|
+
where: {
|
87
|
+
UserId: whereOption.UserId,
|
88
|
+
},
|
89
|
+
offset: (pagination.page - 1) * pagination.limit,
|
90
|
+
limit: pagination.limit,
|
91
|
+
transaction: dbTransaction,
|
92
|
+
include: [
|
93
|
+
{
|
94
|
+
model: system_privilege_entity_1.default,
|
95
|
+
attributes: ['PrivilegeCode'],
|
96
|
+
include: [
|
97
|
+
{
|
98
|
+
model: system_entity_1.default,
|
99
|
+
attributes: ['Name'],
|
100
|
+
},
|
101
|
+
],
|
102
|
+
},
|
103
|
+
{
|
104
|
+
model: user_entity_1.default,
|
105
|
+
as: 'CreatedByUser',
|
106
|
+
attributes: ['FullName'],
|
107
|
+
},
|
108
|
+
{
|
109
|
+
model: user_entity_1.default,
|
110
|
+
as: 'UpdatedByUser',
|
111
|
+
attributes: ['FullName'],
|
112
|
+
},
|
113
|
+
],
|
114
|
+
};
|
115
|
+
const { count, rows } = yield this._Repository.findAllWithPagination(options);
|
116
|
+
return {
|
117
|
+
records: rows.map((record) => {
|
118
|
+
return {
|
119
|
+
UserPrivilegeId: record.UserPrivilegeId,
|
120
|
+
SystemPrivilegeId: record.SystemPrivilegeId,
|
121
|
+
PrivilegeCode: record.Privilege.PrivilegeCode,
|
122
|
+
SystemName: record.Privilege.System.Name,
|
123
|
+
Status: record.Status,
|
124
|
+
CreatedBy: record.CreatedByUser.FullName,
|
125
|
+
CreatedAt: record.CreatedAt,
|
126
|
+
UpdatedBy: record.UpdatedByUser.FullName,
|
127
|
+
UpdatedAt: record.UpdatedAt,
|
128
|
+
};
|
129
|
+
}),
|
130
|
+
pagination: {
|
131
|
+
currentPage: pagination.page,
|
132
|
+
pageSize: pagination.limit,
|
133
|
+
totalRecords: count,
|
134
|
+
},
|
135
|
+
};
|
136
|
+
}
|
137
|
+
catch (error) {
|
138
|
+
throw error;
|
139
|
+
}
|
140
|
+
});
|
141
|
+
}
|
142
|
+
static findAllInheritedPrivileges(UserId, loginUser, dbTransaction) {
|
143
|
+
return __awaiter(this, void 0, void 0, function* () {
|
144
|
+
try {
|
145
|
+
const systemCode = config_1.ApplicationConfig.getComponentConfigValue('system-code');
|
146
|
+
const privilegeCode = 'USER_PRIVILEGE_LIST';
|
147
|
+
const isPrivileged = yield loginUser.checkPrivileges(systemCode, privilegeCode);
|
148
|
+
if (!isPrivileged) {
|
149
|
+
throw new general_1.ClassError('UserPrivilege', 'UserPrivilegeErrMsg01', 'You do not have permission to access this resource.');
|
150
|
+
}
|
151
|
+
const userGroups = yield UserPrivilege._UserGroupRepository.findAll({
|
152
|
+
where: {
|
153
|
+
UserId,
|
154
|
+
},
|
155
|
+
include: [
|
156
|
+
{
|
157
|
+
model: group_entity_1.default,
|
158
|
+
attributes: ['GroupCode', 'Name', 'InheritParentPrivilegeYN'],
|
159
|
+
},
|
160
|
+
],
|
161
|
+
transaction: dbTransaction,
|
162
|
+
});
|
163
|
+
const listOfGroups = userGroups.map((groups) => {
|
164
|
+
let inheritPrivilegeYN = groups.InheritGroupPrivilegeYN;
|
165
|
+
if (inheritPrivilegeYN !== 'Y') {
|
166
|
+
inheritPrivilegeYN = 'N';
|
167
|
+
}
|
168
|
+
return {
|
169
|
+
GroupCode: groups.GroupCode,
|
170
|
+
GroupName: groups.Group.Name,
|
171
|
+
InheritPrivilegeYN: inheritPrivilegeYN,
|
172
|
+
Status: groups.Status,
|
173
|
+
};
|
174
|
+
});
|
175
|
+
const userGroupPrivilege = [];
|
176
|
+
for (let i = 0; i < listOfGroups.length; i++) {
|
177
|
+
const group = yield listOfGroups[i];
|
178
|
+
const data = {
|
179
|
+
GroupCode: group.GroupCode,
|
180
|
+
GroupName: group.GroupName,
|
181
|
+
InheritPrivilegeYN: group.InheritPrivilegeYN,
|
182
|
+
systems: [],
|
183
|
+
};
|
184
|
+
if (group.InheritPrivilegeYN === 'Y') {
|
185
|
+
if (group.Status === 'Active') {
|
186
|
+
const options = {
|
187
|
+
where: {
|
188
|
+
GroupCode: group.GroupCode,
|
189
|
+
Status: 'Active',
|
190
|
+
},
|
191
|
+
transaction: dbTransaction,
|
192
|
+
include: [
|
193
|
+
{
|
194
|
+
model: system_privilege_entity_1.default,
|
195
|
+
attributes: ['PrivilegeCode'],
|
196
|
+
include: [
|
197
|
+
{
|
198
|
+
model: system_entity_1.default,
|
199
|
+
attributes: ['Name'],
|
200
|
+
},
|
201
|
+
],
|
202
|
+
},
|
203
|
+
{
|
204
|
+
model: user_entity_1.default,
|
205
|
+
as: 'CreatedByUser',
|
206
|
+
attributes: ['FullName'],
|
207
|
+
},
|
208
|
+
{
|
209
|
+
model: user_entity_1.default,
|
210
|
+
as: 'UpdatedByUser',
|
211
|
+
attributes: ['FullName'],
|
212
|
+
},
|
213
|
+
],
|
214
|
+
};
|
215
|
+
const systemPrivilege = yield this._GroupPrivilegeRepository.findAll(options);
|
216
|
+
const privilegeDetails = systemPrivilege.map((record) => {
|
217
|
+
return {
|
218
|
+
GroupPrivilegeId: record.GroupPrivilegeId,
|
219
|
+
SystemPrivilegeId: record.SystemPrivilegeId,
|
220
|
+
PrivilegeCode: record.Privilege.PrivilegeCode,
|
221
|
+
Status: record.Status,
|
222
|
+
CreatedBy: record.CreatedByUser.FullName,
|
223
|
+
CreatedAt: record.CreatedAt,
|
224
|
+
UpdatedBy: record.UpdatedByUser.FullName,
|
225
|
+
UpdatedAt: record.UpdatedAt,
|
226
|
+
};
|
227
|
+
});
|
228
|
+
data.systems = privilegeDetails;
|
229
|
+
}
|
230
|
+
}
|
231
|
+
userGroupPrivilege.push(data);
|
232
|
+
}
|
233
|
+
return userGroupPrivilege;
|
234
|
+
}
|
235
|
+
catch (error) {
|
236
|
+
throw error;
|
237
|
+
}
|
238
|
+
});
|
239
|
+
}
|
240
|
+
static assignPrivileges(loginUser, dbTransaction, UserId, SystemPrivilegeId, Status) {
|
241
|
+
var _a;
|
242
|
+
return __awaiter(this, void 0, void 0, function* () {
|
243
|
+
try {
|
244
|
+
const systemCode = config_1.ApplicationConfig.getComponentConfigValue('system-code');
|
245
|
+
const privilegeCode = 'USER_PRIVILEGE_CREATE';
|
246
|
+
const isPrivileged = yield loginUser.checkPrivileges(systemCode, privilegeCode);
|
247
|
+
if (!isPrivileged) {
|
248
|
+
throw new general_1.ClassError('UserSystemPrivilege', 'UserSystemPrivilegeErrMsg01', 'You do not have permission to access this resource.');
|
249
|
+
}
|
250
|
+
const isExist = yield UserPrivilege._SystemPrivilegeRepository.findAll({
|
251
|
+
where: { SystemPrivilegeId: SystemPrivilegeId },
|
252
|
+
transaction: dbTransaction,
|
253
|
+
});
|
254
|
+
if ((isExist === null || isExist === void 0 ? void 0 : isExist.length) < 1) {
|
255
|
+
throw new general_1.ClassError('UserSystemPrivilege', 'UserSystemPrivilegeErrMsg02', "system privileges don't exist");
|
256
|
+
}
|
257
|
+
const isUserAlreadyAssign = yield UserPrivilege._Repository.findAll({
|
258
|
+
where: {
|
259
|
+
[sequelize_1.Op.and]: [
|
260
|
+
{ UserId: UserId },
|
261
|
+
{ SystemPrivilegeId: SystemPrivilegeId },
|
262
|
+
],
|
263
|
+
},
|
264
|
+
transaction: dbTransaction,
|
265
|
+
});
|
266
|
+
if ((isUserAlreadyAssign === null || isUserAlreadyAssign === void 0 ? void 0 : isUserAlreadyAssign.length) > 0) {
|
267
|
+
throw new general_1.ClassError('UserSystemPrivilege', 'UserSystemPrivilegeErrMsg03', 'User already have access to this privilege');
|
268
|
+
}
|
269
|
+
const newUserPrivilege = new UserPrivilege();
|
270
|
+
newUserPrivilege.UserId = parseInt(UserId);
|
271
|
+
newUserPrivilege.SystemPrivilegeId = SystemPrivilegeId;
|
272
|
+
newUserPrivilege.Status = Status;
|
273
|
+
newUserPrivilege._CreatedById = loginUser.UserId;
|
274
|
+
newUserPrivilege._CreatedAt = new Date();
|
275
|
+
newUserPrivilege._UpdatedById = loginUser.UserId;
|
276
|
+
newUserPrivilege._UpdatedAt = new Date();
|
277
|
+
const payload = {
|
278
|
+
UserId: newUserPrivilege.UserId,
|
279
|
+
SystemPrivilegeId: newUserPrivilege.SystemPrivilegeId,
|
280
|
+
Status: newUserPrivilege.Status,
|
281
|
+
CreatedById: newUserPrivilege.CreatedById,
|
282
|
+
CreatedAt: newUserPrivilege.CreatedAt,
|
283
|
+
UpdatedById: newUserPrivilege.UpdatedById,
|
284
|
+
UpdatedAt: newUserPrivilege.UpdatedAt,
|
285
|
+
};
|
286
|
+
const userPrivilege = yield UserPrivilege._Repository.create(payload, {
|
287
|
+
transaction: dbTransaction,
|
288
|
+
});
|
289
|
+
const entityValueBefore = {};
|
290
|
+
const activity = new activity_history_1.Activity();
|
291
|
+
activity.ActivityId = activity.createId();
|
292
|
+
activity.Action = activity_history_1.ActionEnum.CREATE;
|
293
|
+
activity.Description = 'Create User Privilege';
|
294
|
+
activity.EntityType = 'UserPrivilege';
|
295
|
+
activity.EntityId = (_a = userPrivilege.UserPrivilegeId) === null || _a === void 0 ? void 0 : _a.toString();
|
296
|
+
activity.EntityValueBefore = JSON.stringify(entityValueBefore);
|
297
|
+
activity.EntityValueAfter = JSON.stringify(payload);
|
298
|
+
yield activity.create(loginUser.ObjectId, dbTransaction);
|
299
|
+
newUserPrivilege.UserPrivilegeId = userPrivilege.UserPrivilegeId;
|
300
|
+
return newUserPrivilege;
|
301
|
+
}
|
302
|
+
catch (error) {
|
303
|
+
throw error;
|
304
|
+
}
|
305
|
+
});
|
306
|
+
}
|
307
|
+
update(loginUser, dbTransaction, Status) {
|
308
|
+
return __awaiter(this, void 0, void 0, function* () {
|
309
|
+
try {
|
310
|
+
const entityValueBefore = {
|
311
|
+
UserPrivilegeId: this.UserPrivilegeId,
|
312
|
+
UserId: this.UserId,
|
313
|
+
SystemPrivilegeId: this.SystemPrivilegeId,
|
314
|
+
Status: this.Status,
|
315
|
+
CreatedById: this.CreatedById,
|
316
|
+
CreatedAt: this.CreatedAt,
|
317
|
+
UpdatedById: this.UpdatedById,
|
318
|
+
UpdatedAt: this.UpdatedAt,
|
319
|
+
};
|
320
|
+
yield UserPrivilege._Repository.update({
|
321
|
+
Status: Status,
|
322
|
+
UpdatedById: loginUser.UserId,
|
323
|
+
UpdatedAt: new Date(),
|
324
|
+
}, {
|
325
|
+
where: {
|
326
|
+
UserPrivilegeId: this.UserPrivilegeId,
|
327
|
+
},
|
328
|
+
transaction: dbTransaction,
|
329
|
+
});
|
330
|
+
const entityValueAfter = {
|
331
|
+
UserPrivilegeId: this.UserPrivilegeId,
|
332
|
+
UserId: this.UserId,
|
333
|
+
SystemPrivilegeId: this.SystemPrivilegeId,
|
334
|
+
Status: Status,
|
335
|
+
CreatedById: this.CreatedById,
|
336
|
+
CreatedAt: this.CreatedAt,
|
337
|
+
UpdatedById: loginUser.UserId,
|
338
|
+
UpdatedAt: new Date(),
|
339
|
+
};
|
340
|
+
const activity = new activity_history_1.Activity();
|
341
|
+
activity.ActivityId = activity.createId();
|
342
|
+
activity.Action = activity_history_1.ActionEnum.UPDATE;
|
343
|
+
activity.Description = 'Update User Privilege';
|
344
|
+
activity.EntityType = 'UserPrivilege';
|
345
|
+
activity.EntityId = this.SystemPrivilegeId + '';
|
346
|
+
activity.EntityValueBefore = JSON.stringify(entityValueBefore);
|
347
|
+
activity.EntityValueAfter = JSON.stringify(entityValueAfter);
|
348
|
+
yield activity.create(loginUser.ObjectId, dbTransaction);
|
349
|
+
return entityValueAfter;
|
350
|
+
}
|
351
|
+
catch (error) {
|
352
|
+
throw error;
|
353
|
+
}
|
354
|
+
});
|
355
|
+
}
|
356
|
+
static remove(loginUser, dbTransaction, UserPrivilegeId) {
|
357
|
+
return __awaiter(this, void 0, void 0, function* () {
|
358
|
+
try {
|
359
|
+
const systemCode = config_1.ApplicationConfig.getComponentConfigValue('system-code');
|
360
|
+
const privilegeCode = 'USER_PRIVILEGE_REMOVE';
|
361
|
+
const isPrivileged = yield loginUser.checkPrivileges(systemCode, privilegeCode);
|
362
|
+
if (!isPrivileged) {
|
363
|
+
throw new general_1.ClassError('UserSystemPrivilege', 'UserSystemPrivilegeErrMsg01', 'You do not have permission to access this resource.');
|
364
|
+
}
|
365
|
+
const userPrivilege = yield UserPrivilege._Repository.findOne({
|
366
|
+
where: {
|
367
|
+
UserPrivilegeId: UserPrivilegeId,
|
368
|
+
},
|
369
|
+
transaction: dbTransaction,
|
370
|
+
});
|
371
|
+
if (!userPrivilege) {
|
372
|
+
throw new general_1.ClassError('UserSystemPrivilege', 'UserSystemPrivilegeErrMsg01', 'User Privilege not Found');
|
373
|
+
}
|
374
|
+
yield UserPrivilege._Repository.delete(UserPrivilegeId, dbTransaction);
|
375
|
+
const entityValueBefore = {
|
376
|
+
UserId: userPrivilege.UserId,
|
377
|
+
SystemPrivilegeId: userPrivilege.SystemPrivilegeId,
|
378
|
+
Status: userPrivilege.Status,
|
379
|
+
CreatedById: userPrivilege.CreatedById,
|
380
|
+
CreatedAt: userPrivilege.CreatedAt,
|
381
|
+
UpdatedById: userPrivilege.UpdatedById,
|
382
|
+
UpdatedAt: userPrivilege.UpdatedAt,
|
383
|
+
};
|
384
|
+
const activity = new activity_history_1.Activity();
|
385
|
+
activity.ActivityId = activity.createId();
|
386
|
+
activity.Action = activity_history_1.ActionEnum.DELETE;
|
387
|
+
activity.Description = 'Delete User Privilege';
|
388
|
+
activity.EntityType = 'UserPrivilege';
|
389
|
+
activity.EntityId = UserPrivilegeId === null || UserPrivilegeId === void 0 ? void 0 : UserPrivilegeId.toString();
|
390
|
+
activity.EntityValueBefore = JSON.stringify(entityValueBefore);
|
391
|
+
activity.EntityValueAfter = JSON.stringify({});
|
392
|
+
yield activity.create(loginUser.ObjectId, dbTransaction);
|
393
|
+
}
|
394
|
+
catch (error) {
|
395
|
+
throw error;
|
396
|
+
}
|
397
|
+
});
|
398
|
+
}
|
66
399
|
}
|
67
400
|
exports.UserPrivilege = UserPrivilege;
|
68
401
|
UserPrivilege._Repository = new user_privilege_repository_1.UserPrivilegeRepository();
|
402
|
+
UserPrivilege._UserGroupRepository = new user_group_repository_1.UserGroupRepository();
|
403
|
+
UserPrivilege._GroupPrivilegeRepository = new group_privilege_repository_1.GroupPrivilegeRepository();
|
404
|
+
UserPrivilege._SystemPrivilegeRepository = new system_privilege_repository_1.SystemPrivilegeRepository();
|
69
405
|
//# sourceMappingURL=user-privilege.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"user-privilege.js","source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AAE,eAAe,EAAE;wBAC1B,WAAW,EAAE,aAAa;qBAC3B,CAAC,CAAC;oBACH,IAAI,iBAAiB,EAAE;wBACrB,aAAa,GAAG,IAAI,aAAa,CAAC,iBAAiB,CAAC,CAAC;qBACtD;yBAAM;wBACL,MAAM,IAAI,oBAAU,CAClB,eAAe,EACf,uBAAuB,EACvB,yBAAyB,CAC1B,CAAC;qBACH;iBACF;gBACD,OAAO,aAAa,CAAC;aACtB;YAAC,OAAO,KAAK,EAAE;gBACd,MAAM,KAAK,CAAC;aACb;QACH,CAAC;KAAA;;AApEH,sCAqEC;AAvCgB,yBAAW,GAAG,IAAI,mDAAuB,EAAE,CAAC"}
|
1
|
+
{"version":3,"file":"user-privilege.js","sourceRoot":"","sources":["../../../../src/components/user-privilege/user-privilege.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAwD;AAExD,2EAAsE;AAEtE,0CAAkD;AAClD,kFAAwE;AACxE,8DAAqD;AACrD,+EAA0E;AAC1E,4DAAmD;AACnD,0DAA4C;AAC5C,8FAAyF;AAEzF,iGAA4F;AAC5F,yCAA+B;AAC/B,8DAA+D;AAE/D,MAAa,aAAc,SAAQ,oBAAU;IAc3C,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAOD,YAAoB,iBAAsC;QACxD,KAAK,EAAE,CAAC;QAnCV,cAAS,GAAG,mBAAmB,CAAC;QAChC,eAAU,GAAG,eAAe,CAAC;QAmC3B,IAAI,iBAAiB,EAAE;YACrB,IAAI,CAAC,eAAe,GAAG,iBAAiB,CAAC,eAAe,CAAC;YACzD,IAAI,CAAC,MAAM,GAAG,iBAAiB,CAA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AE,CAAC"}
|
@@ -2,4 +2,5 @@ import UserPrivilegeModel from '../../models/user-privilege.entity';
|
|
2
2
|
import { RepositoryBase, IRepositoryBase } from '@tomei/general';
|
3
3
|
export declare class UserPrivilegeRepository extends RepositoryBase<UserPrivilegeModel> implements IRepositoryBase<UserPrivilegeModel> {
|
4
4
|
constructor();
|
5
|
+
delete(UserPrivilegeId: number, dbTransaction?: any): Promise<void>;
|
5
6
|
}
|
@@ -1,4 +1,13 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
12
|
exports.UserPrivilegeRepository = void 0;
|
4
13
|
const user_privilege_entity_1 = require("../../models/user-privilege.entity");
|
@@ -7,6 +16,22 @@ class UserPrivilegeRepository extends general_1.RepositoryBase {
|
|
7
16
|
constructor() {
|
8
17
|
super(user_privilege_entity_1.default);
|
9
18
|
}
|
19
|
+
delete(UserPrivilegeId, dbTransaction) {
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
21
|
+
try {
|
22
|
+
const options = {
|
23
|
+
where: {
|
24
|
+
UserPrivilegeId: UserPrivilegeId,
|
25
|
+
},
|
26
|
+
transaction: dbTransaction,
|
27
|
+
};
|
28
|
+
yield user_privilege_entity_1.default.destroy(options);
|
29
|
+
}
|
30
|
+
catch (error) {
|
31
|
+
throw new Error(`An Error occured when delete : ${error.message}`);
|
32
|
+
}
|
33
|
+
});
|
34
|
+
}
|
10
35
|
}
|
11
36
|
exports.UserPrivilegeRepository = UserPrivilegeRepository;
|
12
37
|
//# sourceMappingURL=user-privilege.repository.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"user-privilege.repository.js","sourceRoot":"","sources":["../../../../src/components/user-privilege/user-privilege.repository.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"user-privilege.repository.js","sourceRoot":"","sources":["../../../../src/components/user-privilege/user-privilege.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8EAAoE;AACpE,4CAAiE;AAEjE,MAAa,uBACX,SAAQ,wBAAkC;IAG1C;QACE,KAAK,CAAC,+BAAkB,CAAC,CAAC;IAC5B,CAAC;IAEK,MAAM,CAAC,eAAuB,EAAE,aAAmB;;YACvD,IAAI;gBACF,MAAM,OAAO,GAAG;oBACd,KAAK,EAAE;wBACL,eAAe,EAAE,eAAe;qBACjC;oBACD,WAAW,EAAE,aAAa;iBAC3B,CAAC;gBACF,MAAM,+BAAkB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;aAC3C;YAAC,OAAO,KAAK,EAAE;gBACd,MAAM,IAAI,KAAK,CAAC,kCAAkC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;aACpE;QACH,CAAC;KAAA;CACF;AArBD,0DAqBC"}
|
@@ -22,6 +22,7 @@ export declare class UserSystemAccess extends ObjectBase {
|
|
22
22
|
static init(dbTransaction: any, UserSystemAccessId?: number): Promise<UserSystemAccess>;
|
23
23
|
static findAll(loginUser: User, dbTransaction: any, whereOption: {
|
24
24
|
UserId: number;
|
25
|
+
SystemCode?: string;
|
25
26
|
}, pagination: {
|
26
27
|
page: number;
|
27
28
|
limit: number;
|
@@ -41,4 +42,15 @@ export declare class UserSystemAccess extends ObjectBase {
|
|
41
42
|
totalRecords: number;
|
42
43
|
};
|
43
44
|
}>;
|
45
|
+
static createAccess(loginUser: User, dbTransaction: any, UserId: string, SystemCode: string, Status: string): Promise<UserSystemAccess>;
|
46
|
+
update(loginUser: User, dbTransaction: any, Status: string): Promise<{
|
47
|
+
UserId: number;
|
48
|
+
SystemCode: string;
|
49
|
+
Status: string;
|
50
|
+
CreatedById: number;
|
51
|
+
CreatedAt: Date;
|
52
|
+
UpdatedById: number;
|
53
|
+
UpdatedAt: Date;
|
54
|
+
}>;
|
55
|
+
static remove(loginUser: User, dbTransaction: any, UserSystemAccessId: number): Promise<void>;
|
44
56
|
}
|