@tomei/sso 0.46.7 → 0.46.9
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/src/components/user-privilege/user-privilege.d.ts +28 -0
- package/dist/src/components/user-privilege/user-privilege.js +173 -0
- package/dist/src/components/user-privilege/user-privilege.js.map +1 -1
- package/dist/src/components/user-system-access/user-system-access.d.ts +10 -0
- package/dist/src/components/user-system-access/user-system-access.js +91 -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-privilege/user-privilege.ts +265 -0
- package/src/components/user-system-access/user-system-access.repository.ts +14 -0
- package/src/components/user-system-access/user-system-access.ts +175 -0
@@ -1,4 +1,5 @@
|
|
1
1
|
import { ObjectBase } from '@tomei/general';
|
2
|
+
import { User as UserClass } from '../login-user/user';
|
2
3
|
export declare class UserPrivilege extends ObjectBase {
|
3
4
|
TableName: string;
|
4
5
|
ObjectType: string;
|
@@ -17,6 +18,33 @@ export declare class UserPrivilege extends ObjectBase {
|
|
17
18
|
get CreatedAt(): Date;
|
18
19
|
get UpdatedAt(): Date;
|
19
20
|
private static _Repository;
|
21
|
+
private static _UserGroupRepository;
|
22
|
+
private static _GroupPrivilegeRepository;
|
20
23
|
private constructor();
|
21
24
|
static init(dbTransaction?: any, UserPrivilegeId?: number): Promise<UserPrivilege>;
|
25
|
+
static findAll(loginUser: UserClass, dbTransaction: any, whereOption: {
|
26
|
+
UserId: number;
|
27
|
+
SystemCode?: string;
|
28
|
+
}, pagination: {
|
29
|
+
page: number;
|
30
|
+
limit: number;
|
31
|
+
}): Promise<{
|
32
|
+
records: {
|
33
|
+
UserPrivilegeId: number;
|
34
|
+
SystemPrivilegeId: string;
|
35
|
+
PrivilegeCode: string;
|
36
|
+
SystemName: string;
|
37
|
+
Status: string;
|
38
|
+
CreatedBy: string;
|
39
|
+
CreatedAt: Date;
|
40
|
+
UpdatedBy: string;
|
41
|
+
UpdatedAt: Date;
|
42
|
+
}[];
|
43
|
+
pagination: {
|
44
|
+
currentPage: number;
|
45
|
+
pageSize: number;
|
46
|
+
totalRecords: number;
|
47
|
+
};
|
48
|
+
}>;
|
49
|
+
static findAllInheritedPrivileges(UserId: number, loginUser: UserClass, dbTransaction: any): Promise<any[]>;
|
22
50
|
}
|
@@ -12,6 +12,13 @@ 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");
|
15
22
|
class UserPrivilege extends general_1.ObjectBase {
|
16
23
|
get CreatedById() {
|
17
24
|
return this._CreatedById;
|
@@ -63,7 +70,173 @@ class UserPrivilege extends general_1.ObjectBase {
|
|
63
70
|
}
|
64
71
|
});
|
65
72
|
}
|
73
|
+
static findAll(loginUser, dbTransaction, whereOption, pagination) {
|
74
|
+
return __awaiter(this, void 0, void 0, function* () {
|
75
|
+
try {
|
76
|
+
const systemCode = config_1.ApplicationConfig.getComponentConfigValue('system-code');
|
77
|
+
const privilegeCode = 'USER_PRIVILEGE_LIST';
|
78
|
+
const isPrivileged = yield loginUser.checkPrivileges(systemCode, privilegeCode);
|
79
|
+
if (!isPrivileged) {
|
80
|
+
throw new general_1.ClassError('UserPrivilege', 'UserPrivilegeErrMsg01', 'You do not have permission to access this resource.');
|
81
|
+
}
|
82
|
+
const options = {
|
83
|
+
where: {
|
84
|
+
UserId: whereOption.UserId,
|
85
|
+
},
|
86
|
+
offset: (pagination.page - 1) * pagination.limit,
|
87
|
+
limit: pagination.limit,
|
88
|
+
transaction: dbTransaction,
|
89
|
+
include: [
|
90
|
+
{
|
91
|
+
model: system_privilege_entity_1.default,
|
92
|
+
attributes: ['PrivilegeCode'],
|
93
|
+
include: [
|
94
|
+
{
|
95
|
+
model: system_entity_1.default,
|
96
|
+
attributes: ['Name'],
|
97
|
+
},
|
98
|
+
],
|
99
|
+
},
|
100
|
+
{
|
101
|
+
model: user_entity_1.default,
|
102
|
+
as: 'CreatedByUser',
|
103
|
+
attributes: ['FullName'],
|
104
|
+
},
|
105
|
+
{
|
106
|
+
model: user_entity_1.default,
|
107
|
+
as: 'UpdatedByUser',
|
108
|
+
attributes: ['FullName'],
|
109
|
+
},
|
110
|
+
],
|
111
|
+
};
|
112
|
+
const { count, rows } = yield this._Repository.findAllWithPagination(options);
|
113
|
+
return {
|
114
|
+
records: rows.map((record) => {
|
115
|
+
return {
|
116
|
+
UserPrivilegeId: record.UserPrivilegeId,
|
117
|
+
SystemPrivilegeId: record.SystemPrivilegeId,
|
118
|
+
PrivilegeCode: record.Privilege.PrivilegeCode,
|
119
|
+
SystemName: record.Privilege.System.Name,
|
120
|
+
Status: record.Status,
|
121
|
+
CreatedBy: record.CreatedByUser.FullName,
|
122
|
+
CreatedAt: record.CreatedAt,
|
123
|
+
UpdatedBy: record.UpdatedByUser.FullName,
|
124
|
+
UpdatedAt: record.UpdatedAt,
|
125
|
+
};
|
126
|
+
}),
|
127
|
+
pagination: {
|
128
|
+
currentPage: pagination.page,
|
129
|
+
pageSize: pagination.limit,
|
130
|
+
totalRecords: count,
|
131
|
+
},
|
132
|
+
};
|
133
|
+
}
|
134
|
+
catch (error) {
|
135
|
+
throw error;
|
136
|
+
}
|
137
|
+
});
|
138
|
+
}
|
139
|
+
static findAllInheritedPrivileges(UserId, loginUser, dbTransaction) {
|
140
|
+
return __awaiter(this, void 0, void 0, function* () {
|
141
|
+
try {
|
142
|
+
const systemCode = config_1.ApplicationConfig.getComponentConfigValue('system-code');
|
143
|
+
const privilegeCode = 'USER_PRIVILEGE_LIST';
|
144
|
+
const isPrivileged = yield loginUser.checkPrivileges(systemCode, privilegeCode);
|
145
|
+
if (!isPrivileged) {
|
146
|
+
throw new general_1.ClassError('UserPrivilege', 'UserPrivilegeErrMsg01', 'You do not have permission to access this resource.');
|
147
|
+
}
|
148
|
+
const userGroups = yield UserPrivilege._UserGroupRepository.findAll({
|
149
|
+
where: {
|
150
|
+
UserId,
|
151
|
+
},
|
152
|
+
include: [
|
153
|
+
{
|
154
|
+
model: group_entity_1.default,
|
155
|
+
attributes: ['GroupCode', 'Name', 'InheritParentPrivilegeYN'],
|
156
|
+
},
|
157
|
+
],
|
158
|
+
transaction: dbTransaction,
|
159
|
+
});
|
160
|
+
const listOfGroups = userGroups.map((groups) => {
|
161
|
+
let inheritPrivilegeYN = groups.InheritGroupPrivilegeYN;
|
162
|
+
if (inheritPrivilegeYN !== 'Y') {
|
163
|
+
inheritPrivilegeYN = 'N';
|
164
|
+
}
|
165
|
+
return {
|
166
|
+
GroupCode: groups.GroupCode,
|
167
|
+
GroupName: groups.Group.Name,
|
168
|
+
InheritPrivilegeYN: inheritPrivilegeYN,
|
169
|
+
Status: groups.Status,
|
170
|
+
};
|
171
|
+
});
|
172
|
+
const userGroupPrivilege = [];
|
173
|
+
for (let i = 0; i < listOfGroups.length; i++) {
|
174
|
+
const group = yield listOfGroups[i];
|
175
|
+
const data = {
|
176
|
+
GroupCode: group.GroupCode,
|
177
|
+
GroupName: group.GroupName,
|
178
|
+
InheritPrivilegeYN: group.InheritPrivilegeYN,
|
179
|
+
systems: [],
|
180
|
+
};
|
181
|
+
if (group.InheritPrivilegeYN === 'Y') {
|
182
|
+
if (group.Status === 'Active') {
|
183
|
+
const options = {
|
184
|
+
where: {
|
185
|
+
GroupCode: group.GroupCode,
|
186
|
+
Status: 'Active',
|
187
|
+
},
|
188
|
+
transaction: dbTransaction,
|
189
|
+
include: [
|
190
|
+
{
|
191
|
+
model: system_privilege_entity_1.default,
|
192
|
+
attributes: ['PrivilegeCode'],
|
193
|
+
include: [
|
194
|
+
{
|
195
|
+
model: system_entity_1.default,
|
196
|
+
attributes: ['Name'],
|
197
|
+
},
|
198
|
+
],
|
199
|
+
},
|
200
|
+
{
|
201
|
+
model: user_entity_1.default,
|
202
|
+
as: 'CreatedByUser',
|
203
|
+
attributes: ['FullName'],
|
204
|
+
},
|
205
|
+
{
|
206
|
+
model: user_entity_1.default,
|
207
|
+
as: 'UpdatedByUser',
|
208
|
+
attributes: ['FullName'],
|
209
|
+
},
|
210
|
+
],
|
211
|
+
};
|
212
|
+
const systemPrivilege = yield this._GroupPrivilegeRepository.findAll(options);
|
213
|
+
const privilegeDetails = systemPrivilege.map((record) => {
|
214
|
+
return {
|
215
|
+
GroupPrivilegeId: record.GroupPrivilegeId,
|
216
|
+
SystemPrivilegeId: record.SystemPrivilegeId,
|
217
|
+
PrivilegeCode: record.Privilege.PrivilegeCode,
|
218
|
+
Status: record.Status,
|
219
|
+
CreatedBy: record.CreatedByUser.FullName,
|
220
|
+
CreatedAt: record.CreatedAt,
|
221
|
+
UpdatedBy: record.UpdatedByUser.FullName,
|
222
|
+
UpdatedAt: record.UpdatedAt,
|
223
|
+
};
|
224
|
+
});
|
225
|
+
data.systems = privilegeDetails;
|
226
|
+
}
|
227
|
+
}
|
228
|
+
userGroupPrivilege.push(data);
|
229
|
+
}
|
230
|
+
return userGroupPrivilege;
|
231
|
+
}
|
232
|
+
catch (error) {
|
233
|
+
throw error;
|
234
|
+
}
|
235
|
+
});
|
236
|
+
}
|
66
237
|
}
|
67
238
|
exports.UserPrivilege = UserPrivilege;
|
68
239
|
UserPrivilege._Repository = new user_privilege_repository_1.UserPrivilegeRepository();
|
240
|
+
UserPrivilege._UserGroupRepository = new user_group_repository_1.UserGroupRepository();
|
241
|
+
UserPrivilege._GroupPrivilegeRepository = new group_privilege_repository_1.GroupPrivilegeRepository();
|
69
242
|
//# sourceMappingURL=user-privilege.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"user-privilege.js","sourceRoot":"","sources":["../../../../src/components/user-privilege/user-privilege.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAwD;AAExD,2EAAsE;AAEtE,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;
|
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,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;IAMD,YAAoB,iBAAsC;QACxD,KAAK,EAAE,CAAC;QAlCV,cAAS,GAAG,mBAAmB,CAAC;QAChC,eAAU,GAAG,eAAe,CAAC;QAkC3B,IAAI,iBAAiB,EAAE;YACrB,IAAI,CAAC,eAAe,GAAG,iBAAiB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AAC;qCACzB;oCACD;wCACE,KAAK,EAAE,qBAAI;wCACX,EAAE,EAAE,eAAe;wCACnB,UAAU,EAAE,CAAC,UAAU,CAAC;qCACzB;iCACF;6BACF,CAAC;4BACF,MAAM,eAAe,GACnB,MAAM,IAAI,CAAC,yBAAyB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;4BAExD,MAAM,gBAAgB,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;gCACtD,OAAO;oCACL,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;oCACzC,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;oCAC3C,aAAa,EAAE,MAAM,CAAC,SAAS,CAAC,aAAa;oCAC7C,MAAM,EAAE,MAAM,CAAC,MAAM;oCACrB,SAAS,EAAE,MAAM,CAAC,aAAa,CAAC,QAAQ;oCACxC,SAAS,EAAE,MAAM,CAAC,SAAS;oCAC3B,SAAS,EAAE,MAAM,CAAC,aAAa,CAAC,QAAQ;oCACxC,SAAS,EAAE,MAAM,CAAC,SAAS;iCAC5B,CAAC;4BACJ,CAAC,CAAC,CAAC;4BAEH,IAAI,CAAC,OAAO,GAAG,gBAAgB,CAAC;yBACjC;qBACF;oBACD,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;iBAC/B;gBACD,OAAO,kBAAkB,CAAC;aAC3B;YAAC,OAAO,KAAK,EAAE;gBACd,MAAM,KAAK,CAAC;aACb;QACH,CAAC;KAAA;;AArUH,sCAsUC;AAxSgB,yBAAW,GAAG,IAAI,mDAAuB,EAAE,CAAC;AAC5C,kCAAoB,GAAG,IAAI,2CAAmB,EAAE,CAAC;AACjD,uCAAyB,GAAG,IAAI,qDAAwB,EAAE,CAAC"}
|
@@ -43,4 +43,14 @@ export declare class UserSystemAccess extends ObjectBase {
|
|
43
43
|
};
|
44
44
|
}>;
|
45
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>;
|
46
56
|
}
|
@@ -105,6 +105,7 @@ class UserSystemAccess extends general_1.ObjectBase {
|
|
105
105
|
return {
|
106
106
|
records: userSystemAccesses.rows.map((userSystemAccess) => {
|
107
107
|
return {
|
108
|
+
UserSystemAccessId: userSystemAccess.UserSystemAccessId,
|
108
109
|
SystemName: userSystemAccess.System.Name,
|
109
110
|
SystemCode: userSystemAccess.System.SystemCode,
|
110
111
|
Status: userSystemAccess.Status,
|
@@ -181,6 +182,96 @@ class UserSystemAccess extends general_1.ObjectBase {
|
|
181
182
|
}
|
182
183
|
});
|
183
184
|
}
|
185
|
+
update(loginUser, dbTransaction, Status) {
|
186
|
+
return __awaiter(this, void 0, void 0, function* () {
|
187
|
+
try {
|
188
|
+
const entityValueBefore = {
|
189
|
+
UserId: this.UserId,
|
190
|
+
SystemCode: this.SystemCode,
|
191
|
+
Status: this.Status,
|
192
|
+
CreatedById: this.CreatedById,
|
193
|
+
CreatedAt: this.CreatedAt,
|
194
|
+
UpdatedById: this.UpdatedById,
|
195
|
+
UpdatedAt: this.UpdatedAt,
|
196
|
+
};
|
197
|
+
yield UserSystemAccess._Repository.update({
|
198
|
+
Status: Status,
|
199
|
+
UpdatedById: loginUser.UserId,
|
200
|
+
UpdatedAt: new Date(),
|
201
|
+
}, {
|
202
|
+
where: {
|
203
|
+
UserSystemAccessId: this.UserSystemAccessId,
|
204
|
+
},
|
205
|
+
transaction: dbTransaction,
|
206
|
+
});
|
207
|
+
const entityValueAfter = {
|
208
|
+
UserId: this.UserId,
|
209
|
+
SystemCode: this.SystemCode,
|
210
|
+
Status: Status,
|
211
|
+
CreatedById: this.CreatedById,
|
212
|
+
CreatedAt: this.CreatedAt,
|
213
|
+
UpdatedById: loginUser.UserId,
|
214
|
+
UpdatedAt: new Date(),
|
215
|
+
};
|
216
|
+
const activity = new activity_history_1.Activity();
|
217
|
+
activity.ActivityId = activity.createId();
|
218
|
+
activity.Action = activity_history_1.ActionEnum.UPDATE;
|
219
|
+
activity.Description = 'Update User System Access';
|
220
|
+
activity.EntityType = 'UserSystemAccess';
|
221
|
+
activity.EntityId = this.UserSystemAccessId + '';
|
222
|
+
activity.EntityValueBefore = JSON.stringify(entityValueBefore);
|
223
|
+
activity.EntityValueAfter = JSON.stringify(entityValueAfter);
|
224
|
+
yield activity.create(loginUser.ObjectId, dbTransaction);
|
225
|
+
return entityValueAfter;
|
226
|
+
}
|
227
|
+
catch (error) {
|
228
|
+
throw error;
|
229
|
+
}
|
230
|
+
});
|
231
|
+
}
|
232
|
+
static remove(loginUser, dbTransaction, UserSystemAccessId) {
|
233
|
+
return __awaiter(this, void 0, void 0, function* () {
|
234
|
+
try {
|
235
|
+
const systemCode = config_1.ApplicationConfig.getComponentConfigValue('system-code');
|
236
|
+
const privilegeCode = 'USER_SYSTEM_ACCESS_REMOVE';
|
237
|
+
const isPrivileged = yield loginUser.checkPrivileges(systemCode, privilegeCode);
|
238
|
+
if (!isPrivileged) {
|
239
|
+
throw new general_1.ClassError('UserSystemAccess', 'UserSystemAccessErrMsg01', 'You do not have permission to access this resource.');
|
240
|
+
}
|
241
|
+
const userSystemAccess = yield UserSystemAccess._Repository.findOne({
|
242
|
+
where: {
|
243
|
+
UserSystemAccessId: UserSystemAccessId,
|
244
|
+
},
|
245
|
+
transaction: dbTransaction,
|
246
|
+
});
|
247
|
+
if (!userSystemAccess) {
|
248
|
+
throw new general_1.ClassError('UserSystemAccess', 'UserSystemAccessErrMsg02', 'User System Access not Found');
|
249
|
+
}
|
250
|
+
yield UserSystemAccess._Repository.delete(UserSystemAccessId, dbTransaction);
|
251
|
+
const entityValueBefore = {
|
252
|
+
UserId: userSystemAccess.UserId,
|
253
|
+
SystemCode: userSystemAccess.SystemCode,
|
254
|
+
Status: userSystemAccess.Status,
|
255
|
+
CreatedById: userSystemAccess.CreatedById,
|
256
|
+
CreatedAt: userSystemAccess.CreatedAt,
|
257
|
+
UpdatedById: userSystemAccess.UpdatedById,
|
258
|
+
UpdatedAt: userSystemAccess.UpdatedAt,
|
259
|
+
};
|
260
|
+
const activity = new activity_history_1.Activity();
|
261
|
+
activity.ActivityId = activity.createId();
|
262
|
+
activity.Action = activity_history_1.ActionEnum.DELETE;
|
263
|
+
activity.Description = 'Delete User System Access';
|
264
|
+
activity.EntityType = 'UserSystemAccess';
|
265
|
+
activity.EntityId = UserSystemAccessId === null || UserSystemAccessId === void 0 ? void 0 : UserSystemAccessId.toString();
|
266
|
+
activity.EntityValueBefore = JSON.stringify(entityValueBefore);
|
267
|
+
activity.EntityValueAfter = JSON.stringify({});
|
268
|
+
yield activity.create(loginUser.ObjectId, dbTransaction);
|
269
|
+
}
|
270
|
+
catch (error) {
|
271
|
+
throw error;
|
272
|
+
}
|
273
|
+
});
|
274
|
+
}
|
184
275
|
}
|
185
276
|
exports.UserSystemAccess = UserSystemAccess;
|
186
277
|
UserSystemAccess._Repository = new user_system_access_repository_1.UserSystemAccessRepository();
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"user-system-access.js","sourceRoot":"","sources":["../../../../src/components/user-system-access/user-system-access.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAwD;AACxD,mFAA6E;AAI7E,0CAAkD;AAClD,8DAAqD;AACrD,0DAAiD;AACjD,8DAA+D;AAC/D,yCAA+B;AAE/B,MAAa,gBAAiB,SAAQ,oBAAU;IAc9C,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,O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G,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,2BAA2B,CAAC;gBACnD,QAAQ,CAAC,UAAU,GAAG,kBAAkB,CAAC;gBACzC,QAAQ,CAAC,QAAQ,GAAG,MAAA,YAAY,CAAC,kBAAkB,0CAAE,QAAQ,EAAE,CAAC;gBAChE,QAAQ,CAAC,iBAAiB,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;gBAC/D,QAAQ,CAAC,gBAAgB,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;gBAGpD,MAAM,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;gBAIzD,mBAAmB,CAAC,kBAAkB,GAAG,YAAY,CAAC,kBAAkB,CAAC;gBACzE,OAAO,mBAAmB,CAAC;aAC5B;YAAC,OAAO,KAAK,EAAE;gBACd,MAAM,KAAK,CAAC;aACb;;KACF;;
|
1
|
+
{"version":3,"file":"user-system-access.js","sourceRoot":"","sources":["../../../../src/components/user-system-access/user-system-access.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAwD;AACxD,mFAA6E;AAI7E,0CAAkD;AAClD,8DAAqD;AACrD,0DAAiD;AACjD,8DAA+D;AAC/D,yCAA+B;AAE/B,MAAa,gBAAiB,SAAQ,oBAAU;IAc9C,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,CA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AkB,aAAlB,kBAAkB,uBAAlB,kBAAkB,CAAE,QAAQ,EAAE,CAAC;gBACnD,QAAQ,CAAC,iBAAiB,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;gBAC/D,QAAQ,CAAC,gBAAgB,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;gBAG/C,MAAM,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;aAC1D;YAAC,OAAO,KAAK,EAAE;gBACd,MAAM,KAAK,CAAC;aACb;QACH,CAAC;KAAA;;AAldH,4CAmdC;AArbgB,4BAAW,GAAG,IAAI,0DAA0B,EAAE,CAAC"}
|
@@ -2,4 +2,5 @@ import UserSystemAccessModel from '../../models/user-system-access.entity';
|
|
2
2
|
import { RepositoryBase, IRepositoryBase } from '@tomei/general';
|
3
3
|
export declare class UserSystemAccessRepository extends RepositoryBase<UserSystemAccessModel> implements IRepositoryBase<UserSystemAccessModel> {
|
4
4
|
constructor();
|
5
|
+
delete(UserSystemAccessId: 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.UserSystemAccessRepository = void 0;
|
4
13
|
const user_system_access_entity_1 = require("../../models/user-system-access.entity");
|
@@ -7,6 +16,22 @@ class UserSystemAccessRepository extends general_1.RepositoryBase {
|
|
7
16
|
constructor() {
|
8
17
|
super(user_system_access_entity_1.default);
|
9
18
|
}
|
19
|
+
delete(UserSystemAccessId, dbTransaction) {
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
21
|
+
try {
|
22
|
+
const options = {
|
23
|
+
where: {
|
24
|
+
UserSystemAccessId: UserSystemAccessId,
|
25
|
+
},
|
26
|
+
transaction: dbTransaction,
|
27
|
+
};
|
28
|
+
yield user_system_access_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.UserSystemAccessRepository = UserSystemAccessRepository;
|
12
37
|
//# sourceMappingURL=user-system-access.repository.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"user-system-access.repository.js","sourceRoot":"","sources":["../../../../src/components/user-system-access/user-system-access.repository.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"user-system-access.repository.js","sourceRoot":"","sources":["../../../../src/components/user-system-access/user-system-access.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sFAA2E;AAC3E,4CAAiE;AAEjE,MAAa,0BACX,SAAQ,wBAAqC;IAG7C;QACE,KAAK,CAAC,mCAAqB,CAAC,CAAC;IAC/B,CAAC;IAEK,MAAM,CAAC,kBAA0B,EAAE,aAAmB;;YAC1D,IAAI;gBACF,MAAM,OAAO,GAAG;oBACd,KAAK,EAAE;wBACL,kBAAkB,EAAE,kBAAkB;qBACvC;oBACD,WAAW,EAAE,aAAa;iBAC3B,CAAC;gBACF,MAAM,mCAAqB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;aAC9C;YAAC,OAAO,KAAK,EAAE;gBACd,MAAM,IAAI,KAAK,CAAC,kCAAkC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;aACpE;QACH,CAAC;KAAA;CACF;AArBD,gEAqBC"}
|