emilsoftware-utilities 2.0.0-dev.42 → 2.0.0-dev.44
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/dist/accessi-module/AccessiModule.d.ts +2 -1
- package/dist/accessi-module/AccessiModule.js +2 -0
- package/dist/accessi-module/AccessiModule.js.map +1 -1
- package/dist/accessi-module/Console/console.js +171 -42
- package/dist/accessi-module/Console/console.js.map +1 -1
- package/dist/accessi-module/Console/generated/accessiApi.d.ts +33 -3
- package/dist/accessi-module/Console/generated/accessiApi.js +27 -3
- package/dist/accessi-module/Console/generated/accessiApi.js.map +1 -1
- package/dist/accessi-module/Console/generated/model/adminBootstrapStatusResponse.d.ts +14 -0
- package/dist/accessi-module/Console/generated/model/adminBootstrapStatusResponse.js +3 -0
- package/dist/accessi-module/Console/generated/model/adminBootstrapStatusResponse.js.map +1 -0
- package/dist/accessi-module/Console/generated/model/adminBootstrapStatusResult.d.ts +10 -0
- package/dist/accessi-module/Console/generated/model/adminBootstrapStatusResult.js +9 -0
- package/dist/accessi-module/Console/generated/model/adminBootstrapStatusResult.js.map +1 -0
- package/dist/accessi-module/Console/generated/model/consoleEntryExchangeRequest.d.ts +10 -0
- package/dist/accessi-module/Console/generated/model/consoleEntryExchangeRequest.js +9 -0
- package/dist/accessi-module/Console/generated/model/consoleEntryExchangeRequest.js.map +1 -0
- package/dist/accessi-module/Console/generated/model/consoleEntrySessionResponse.d.ts +14 -0
- package/dist/accessi-module/Console/generated/model/consoleEntrySessionResponse.js +3 -0
- package/dist/accessi-module/Console/generated/model/consoleEntrySessionResponse.js.map +1 -0
- package/dist/accessi-module/Console/generated/model/consoleEntrySessionResult.d.ts +10 -0
- package/dist/accessi-module/Console/generated/model/consoleEntrySessionResult.js +3 -0
- package/dist/accessi-module/Console/generated/model/consoleEntrySessionResult.js.map +1 -0
- package/dist/accessi-module/Console/generated/model/consoleEntryTicketResponse.d.ts +14 -0
- package/dist/accessi-module/Console/generated/model/consoleEntryTicketResponse.js +3 -0
- package/dist/accessi-module/Console/generated/model/consoleEntryTicketResponse.js.map +1 -0
- package/dist/accessi-module/Console/generated/model/consoleEntryTicketResult.d.ts +12 -0
- package/dist/accessi-module/Console/generated/model/consoleEntryTicketResult.js +9 -0
- package/dist/accessi-module/Console/generated/model/consoleEntryTicketResult.js.map +1 -0
- package/dist/accessi-module/Console/generated/model/consoleEntryTokenResult.d.ts +12 -0
- package/dist/accessi-module/Console/generated/model/consoleEntryTokenResult.js +9 -0
- package/dist/accessi-module/Console/generated/model/consoleEntryTokenResult.js.map +1 -0
- package/dist/accessi-module/Console/generated/model/groupWithMenusEntity.d.ts +1 -1
- package/dist/accessi-module/Console/generated/model/groupWithMenusEntity.js.map +1 -1
- package/dist/accessi-module/Console/generated/model/index.d.ts +8 -0
- package/dist/accessi-module/Console/generated/model/index.js +8 -0
- package/dist/accessi-module/Console/generated/model/index.js.map +1 -1
- package/dist/accessi-module/Console/generated/model/registerRequest.d.ts +1 -1
- package/dist/accessi-module/Console/generated/model/registerRequest.js.map +1 -1
- package/dist/accessi-module/Console/generated/model/userDto.d.ts +2 -2
- package/dist/accessi-module/Console/generated/model/userDto.js.map +1 -1
- package/dist/accessi-module/Console/help.js +3 -2
- package/dist/accessi-module/Console/help.js.map +1 -1
- package/dist/accessi-module/Console/index.html +1 -1
- package/dist/accessi-module/Console/wiki.js +9 -4
- package/dist/accessi-module/Console/wiki.js.map +1 -1
- package/dist/accessi-module/Controllers/AuthController.d.ts +1 -0
- package/dist/accessi-module/Controllers/AuthController.js +18 -0
- package/dist/accessi-module/Controllers/AuthController.js.map +1 -1
- package/dist/accessi-module/Controllers/ConsoleEntryController.d.ts +14 -0
- package/dist/accessi-module/Controllers/ConsoleEntryController.js +128 -0
- package/dist/accessi-module/Controllers/ConsoleEntryController.js.map +1 -0
- package/dist/accessi-module/Controllers/FiltriController.d.ts +8 -1
- package/dist/accessi-module/Controllers/FiltriController.js +21 -2
- package/dist/accessi-module/Controllers/FiltriController.js.map +1 -1
- package/dist/accessi-module/Controllers/PermissionController.d.ts +8 -1
- package/dist/accessi-module/Controllers/PermissionController.js +24 -4
- package/dist/accessi-module/Controllers/PermissionController.js.map +1 -1
- package/dist/accessi-module/Controllers/UserController.d.ts +6 -0
- package/dist/accessi-module/Controllers/UserController.js +89 -11
- package/dist/accessi-module/Controllers/UserController.js.map +1 -1
- package/dist/accessi-module/Dtos/AdminBootstrapDtos.d.ts +7 -0
- package/dist/accessi-module/Dtos/AdminBootstrapDtos.js +18 -1
- package/dist/accessi-module/Dtos/AdminBootstrapDtos.js.map +1 -1
- package/dist/accessi-module/Dtos/ConsoleEntryDtos.d.ts +24 -0
- package/dist/accessi-module/Dtos/ConsoleEntryDtos.js +77 -0
- package/dist/accessi-module/Dtos/ConsoleEntryDtos.js.map +1 -0
- package/dist/accessi-module/Dtos/GetGroupsWithMenusResponse.js +1 -1
- package/dist/accessi-module/Dtos/GetGroupsWithMenusResponse.js.map +1 -1
- package/dist/accessi-module/Dtos/RegisterRequest.js +1 -1
- package/dist/accessi-module/Dtos/RegisterRequest.js.map +1 -1
- package/dist/accessi-module/Dtos/UserDto.js +2 -2
- package/dist/accessi-module/Dtos/UserDto.js.map +1 -1
- package/dist/accessi-module/Services/UserService/UserService.d.ts +10 -0
- package/dist/accessi-module/Services/UserService/UserService.js +70 -15
- package/dist/accessi-module/Services/UserService/UserService.js.map +1 -1
- package/dist/accessi-module/federated-auth/FederatedAuthController.d.ts +10 -1
- package/dist/accessi-module/federated-auth/FederatedAuthController.js +54 -14
- package/dist/accessi-module/federated-auth/FederatedAuthController.js.map +1 -1
- package/dist/accessi-module/federated-auth/FederatedAuthService.d.ts +2 -0
- package/dist/accessi-module/federated-auth/FederatedAuthService.js +10 -0
- package/dist/accessi-module/federated-auth/FederatedAuthService.js.map +1 -1
- package/dist/accessi-module/security/accessControl.d.ts +17 -0
- package/dist/accessi-module/security/accessControl.js +23 -0
- package/dist/accessi-module/security/accessControl.js.map +1 -1
- package/dist/accessi-module/security/consoleEntry.d.ts +16 -0
- package/dist/accessi-module/security/consoleEntry.js +50 -0
- package/dist/accessi-module/security/consoleEntry.js.map +1 -0
- package/dist/accessi-module/security/publicAuthRateLimit.d.ts +1 -1
- package/dist/accessi-module/security/publicAuthRateLimit.js +1 -0
- package/dist/accessi-module/security/publicAuthRateLimit.js.map +1 -1
- package/dist/emilsoftware-utilities-2.0.0-dev.44.tgz +0 -0
- package/package.json +1 -1
- package/dist/emilsoftware-utilities-2.0.0-dev.42.tgz +0 -0
|
@@ -16,6 +16,12 @@ export declare class UserController {
|
|
|
16
16
|
private readonly logger;
|
|
17
17
|
constructor(accessiOptions: AccessiOptions, userService: UserService, emailService: EmailService, authService: AuthService);
|
|
18
18
|
private sendControllerError;
|
|
19
|
+
/**
|
|
20
|
+
* Verifica che il target esista e che l'attore possa gestirlo (rango attore >=
|
|
21
|
+
* rango target: ADMIN > SUPER > utente). Restituisce lo snapshot corrente del
|
|
22
|
+
* target, così i chiamanti possono controllare se e' admin.
|
|
23
|
+
*/
|
|
24
|
+
private ensureManageableTarget;
|
|
19
25
|
serveResetPasswordPage(res: Response, _token: string): Promise<void>;
|
|
20
26
|
getUsers(request: Request, res: Response, email?: string, codiceUtente?: number, includeExtensionFields?: boolean, includeGrants?: boolean, limit?: number, offset?: number): Promise<Response<any, Record<string, any>>>;
|
|
21
27
|
deleteUser(request: Request, codiceUtente: number, res: Response): Promise<Response<any, Record<string, any>>>;
|
|
@@ -42,6 +42,8 @@ const UserService_1 = require("../Services/UserService/UserService");
|
|
|
42
42
|
const jwt_strategy_1 = require("../jwt/jwt.strategy");
|
|
43
43
|
const publicAuthRateLimit_1 = require("../security/publicAuthRateLimit");
|
|
44
44
|
const accessControl_1 = require("../security/accessControl");
|
|
45
|
+
const emailConfiguration_1 = require("../security/emailConfiguration");
|
|
46
|
+
const StatoRegistrazione_1 = require("../Dtos/StatoRegistrazione");
|
|
45
47
|
let UserController = UserController_1 = class UserController {
|
|
46
48
|
constructor(accessiOptions, userService, emailService, authService) {
|
|
47
49
|
this.accessiOptions = accessiOptions;
|
|
@@ -54,6 +56,21 @@ let UserController = UserController_1 = class UserController {
|
|
|
54
56
|
// Lo status viene derivato centralmente da RestUtilities (HttpException o 500).
|
|
55
57
|
return Utilities_1.RestUtilities.sendErrorMessage(res, error, UserController_1.name);
|
|
56
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Verifica che il target esista e che l'attore possa gestirlo (rango attore >=
|
|
61
|
+
* rango target: ADMIN > SUPER > utente). Restituisce lo snapshot corrente del
|
|
62
|
+
* target, così i chiamanti possono controllare se e' admin.
|
|
63
|
+
*/
|
|
64
|
+
ensureManageableTarget(actor, codiceUtente) {
|
|
65
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
const target = yield this.userService.getAuthenticatedUserSnapshot(codiceUtente);
|
|
67
|
+
if (!target) {
|
|
68
|
+
throw new common_1.NotFoundException(`Nessun utente con codice ${codiceUtente}.`);
|
|
69
|
+
}
|
|
70
|
+
(0, accessControl_1.ensureCanManageTargetUser)(actor, target);
|
|
71
|
+
return target;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
57
74
|
serveResetPasswordPage(res, _token) {
|
|
58
75
|
return __awaiter(this, void 0, void 0, function* () {
|
|
59
76
|
return res.sendFile((0, path_1.join)(__dirname, '..', 'Views', 'reset-password.html'));
|
|
@@ -82,7 +99,12 @@ let UserController = UserController_1 = class UserController {
|
|
|
82
99
|
deleteUser(request, codiceUtente, res) {
|
|
83
100
|
return __awaiter(this, void 0, void 0, function* () {
|
|
84
101
|
try {
|
|
85
|
-
|
|
102
|
+
const authenticatedUser = (0, accessControl_1.getAuthenticatedAccessiUser)(request);
|
|
103
|
+
(0, accessControl_1.ensureUserManagement)(authenticatedUser, 'Solo gli amministratori possono eliminare utenti.');
|
|
104
|
+
const target = yield this.ensureManageableTarget(authenticatedUser, codiceUtente);
|
|
105
|
+
if (target.flagAdmin) {
|
|
106
|
+
yield this.userService.assertNotLastActiveAdmin(codiceUtente);
|
|
107
|
+
}
|
|
86
108
|
yield this.userService.deleteUser(codiceUtente);
|
|
87
109
|
return Utilities_1.RestUtilities.sendOKMessage(res, "L'utente e' stato eliminato con successo.");
|
|
88
110
|
}
|
|
@@ -99,6 +121,10 @@ let UserController = UserController_1 = class UserController {
|
|
|
99
121
|
if (authenticatedUser.codiceUtente === codiceUtente) {
|
|
100
122
|
throw new common_1.BadRequestException('Non puoi eliminare definitivamente il tuo stesso utente.');
|
|
101
123
|
}
|
|
124
|
+
const target = yield this.ensureManageableTarget(authenticatedUser, codiceUtente);
|
|
125
|
+
if (target.flagAdmin) {
|
|
126
|
+
yield this.userService.assertNotLastActiveAdmin(codiceUtente);
|
|
127
|
+
}
|
|
102
128
|
yield this.userService.deleteUserPermanently(codiceUtente);
|
|
103
129
|
return Utilities_1.RestUtilities.sendOKMessage(res, "L'utente e' stato eliminato definitivamente.");
|
|
104
130
|
}
|
|
@@ -110,7 +136,9 @@ let UserController = UserController_1 = class UserController {
|
|
|
110
136
|
forcePasswordReset(request, codiceUtente, res) {
|
|
111
137
|
return __awaiter(this, void 0, void 0, function* () {
|
|
112
138
|
try {
|
|
113
|
-
|
|
139
|
+
const authenticatedUser = (0, accessControl_1.getAuthenticatedAccessiUser)(request);
|
|
140
|
+
(0, accessControl_1.ensureUserManagement)(authenticatedUser, 'Solo gli amministratori possono forzare il reset password.');
|
|
141
|
+
yield this.ensureManageableTarget(authenticatedUser, codiceUtente);
|
|
114
142
|
yield this.userService.forcePasswordReset(codiceUtente);
|
|
115
143
|
return Utilities_1.RestUtilities.sendOKMessage(res, `Email di reset inviata all utente ${codiceUtente}.`);
|
|
116
144
|
}
|
|
@@ -134,11 +162,9 @@ let UserController = UserController_1 = class UserController {
|
|
|
134
162
|
setUserPassword(request, codiceUtente, body, res) {
|
|
135
163
|
return __awaiter(this, void 0, void 0, function* () {
|
|
136
164
|
try {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
throw new common_1.NotFoundException(`Nessun utente con codice ${codiceUtente}.`);
|
|
141
|
-
}
|
|
165
|
+
const authenticatedUser = (0, accessControl_1.getAuthenticatedAccessiUser)(request);
|
|
166
|
+
(0, accessControl_1.ensureUserManagement)(authenticatedUser, 'Solo gli amministratori possono impostare la password di un utente.');
|
|
167
|
+
yield this.ensureManageableTarget(authenticatedUser, codiceUtente);
|
|
142
168
|
yield this.authService.setPassword(codiceUtente, body.newPassword);
|
|
143
169
|
return Utilities_1.RestUtilities.sendOKMessage(res, `Password dell utente ${codiceUtente} aggiornata.`);
|
|
144
170
|
}
|
|
@@ -150,13 +176,20 @@ let UserController = UserController_1 = class UserController {
|
|
|
150
176
|
setStatoRegistrazione(request, body, res) {
|
|
151
177
|
return __awaiter(this, void 0, void 0, function* () {
|
|
152
178
|
try {
|
|
153
|
-
|
|
179
|
+
const authenticatedUser = (0, accessControl_1.getAuthenticatedAccessiUser)(request);
|
|
180
|
+
(0, accessControl_1.ensureUserManagement)(authenticatedUser, 'Solo gli amministratori possono modificare lo stato di registrazione.');
|
|
154
181
|
const { codiceUtente, statoRegistrazione } = body;
|
|
155
182
|
if (!codiceUtente)
|
|
156
183
|
throw new common_1.BadRequestException('Il codice utente e\' obbligatorio.');
|
|
157
184
|
if (statoRegistrazione === undefined) {
|
|
158
185
|
throw new common_1.BadRequestException('Lo stato registrazione e\' obbligatorio.');
|
|
159
186
|
}
|
|
187
|
+
const target = yield this.ensureManageableTarget(authenticatedUser, codiceUtente);
|
|
188
|
+
const disabling = statoRegistrazione === StatoRegistrazione_1.StatoRegistrazione.DELETE
|
|
189
|
+
|| statoRegistrazione === StatoRegistrazione_1.StatoRegistrazione.BLOCC;
|
|
190
|
+
if (target.flagAdmin && disabling) {
|
|
191
|
+
yield this.userService.assertNotLastActiveAdmin(codiceUtente);
|
|
192
|
+
}
|
|
160
193
|
yield this.userService.setStato(codiceUtente, statoRegistrazione);
|
|
161
194
|
return Utilities_1.RestUtilities.sendOKMessage(res, `Lo stato dell'utente ${codiceUtente} e' stato aggiornato a ${statoRegistrazione}.`);
|
|
162
195
|
}
|
|
@@ -176,10 +209,25 @@ let UserController = UserController_1 = class UserController {
|
|
|
176
209
|
if (!rateLimitDecision.allowed) {
|
|
177
210
|
return (0, publicAuthRateLimit_1.sendPublicAuthRateLimitExceeded)(res, rateLimitDecision.retryAfterSeconds);
|
|
178
211
|
}
|
|
212
|
+
(0, emailConfiguration_1.assertEmailConfigured)(this.accessiOptions);
|
|
179
213
|
const codiceUtente = yield this.userService.register(registrationData, {
|
|
180
214
|
allowPrivilegedFields: false,
|
|
181
215
|
});
|
|
182
|
-
|
|
216
|
+
try {
|
|
217
|
+
yield this.emailService.sendPasswordResetEmail(registrationData.email);
|
|
218
|
+
}
|
|
219
|
+
catch (emailError) {
|
|
220
|
+
try {
|
|
221
|
+
yield this.userService.deleteUserPermanently(codiceUtente);
|
|
222
|
+
}
|
|
223
|
+
catch (rollbackError) {
|
|
224
|
+
this.logger.error(`Rollback registrazione utente ${codiceUtente} non riuscita: ${rollbackError instanceof Error ? rollbackError.message : String(rollbackError)}`);
|
|
225
|
+
}
|
|
226
|
+
throw new common_1.BadRequestException({
|
|
227
|
+
code: 'ACCESSI_USER_INVITE_EMAIL_FAILED',
|
|
228
|
+
message: `Registrazione non completata: invio email non riuscito (${emailError instanceof Error ? emailError.message : String(emailError)}). Riprova piu tardi.`,
|
|
229
|
+
});
|
|
230
|
+
}
|
|
183
231
|
return Utilities_1.RestUtilities.sendBaseResponse(res, codiceUtente, common_1.HttpStatus.CREATED);
|
|
184
232
|
}
|
|
185
233
|
catch (error) {
|
|
@@ -194,8 +242,26 @@ let UserController = UserController_1 = class UserController {
|
|
|
194
242
|
const authenticatedUser = (0, accessControl_1.getAuthenticatedAccessiUser)(request);
|
|
195
243
|
(0, accessControl_1.ensureUserManagement)(authenticatedUser, 'Solo gli amministratori possono creare utenti.');
|
|
196
244
|
(0, accessControl_1.ensurePrivilegeFlagChanges)(authenticatedUser, registrationData);
|
|
245
|
+
// Fail-fast prima di scrivere: senza SMTP non si crea un utente orfano.
|
|
246
|
+
(0, emailConfiguration_1.assertEmailConfigured)(this.accessiOptions);
|
|
197
247
|
const codiceUtente = yield this.userService.register(registrationData, { allowPrivilegedFields: true });
|
|
198
|
-
|
|
248
|
+
try {
|
|
249
|
+
yield this.emailService.sendPasswordResetEmail(registrationData.email, registrationData.htmlMail);
|
|
250
|
+
}
|
|
251
|
+
catch (emailError) {
|
|
252
|
+
// L'invio e' esterno: se fallisce annulliamo la creazione per non lasciare un utente
|
|
253
|
+
// senza password e senza email di invito (rollback best-effort).
|
|
254
|
+
try {
|
|
255
|
+
yield this.userService.deleteUserPermanently(codiceUtente);
|
|
256
|
+
}
|
|
257
|
+
catch (rollbackError) {
|
|
258
|
+
this.logger.error(`Rollback creazione utente ${codiceUtente} non riuscita: ${rollbackError instanceof Error ? rollbackError.message : String(rollbackError)}`);
|
|
259
|
+
}
|
|
260
|
+
throw new common_1.BadRequestException({
|
|
261
|
+
code: 'ACCESSI_USER_INVITE_EMAIL_FAILED',
|
|
262
|
+
message: `Utente non creato: invio email di invito non riuscito (${emailError instanceof Error ? emailError.message : String(emailError)}). Riprova oppure crea l utente e imposta la password manualmente.`,
|
|
263
|
+
});
|
|
264
|
+
}
|
|
199
265
|
return Utilities_1.RestUtilities.sendBaseResponse(res, codiceUtente, common_1.HttpStatus.CREATED);
|
|
200
266
|
}
|
|
201
267
|
catch (error) {
|
|
@@ -208,9 +274,17 @@ let UserController = UserController_1 = class UserController {
|
|
|
208
274
|
try {
|
|
209
275
|
const authenticatedUser = (0, accessControl_1.getAuthenticatedAccessiUser)(request);
|
|
210
276
|
const isPrivilegedUpdate = (0, accessControl_1.hasPrivilegedUserChanges)(user);
|
|
277
|
+
const isSelf = authenticatedUser.codiceUtente === codiceUtente;
|
|
278
|
+
// ADMIN > SUPER: un superutente non puo' toccare un admin. Self sempre consentito.
|
|
279
|
+
if (!isSelf) {
|
|
280
|
+
yield this.ensureManageableTarget(authenticatedUser, codiceUtente);
|
|
281
|
+
}
|
|
211
282
|
if (isPrivilegedUpdate) {
|
|
212
283
|
(0, accessControl_1.ensureUserManagement)(authenticatedUser, 'Solo gli amministratori possono modificare ruoli, permessi o flag privilegiati.');
|
|
213
284
|
(0, accessControl_1.ensurePrivilegeFlagChanges)(authenticatedUser, user);
|
|
285
|
+
if (user.flagAdmin === false) {
|
|
286
|
+
yield this.userService.assertNotLastActiveAdmin(codiceUtente);
|
|
287
|
+
}
|
|
214
288
|
}
|
|
215
289
|
else {
|
|
216
290
|
(0, accessControl_1.ensureSelfOrSuperUser)(authenticatedUser, codiceUtente, 'Puoi modificare solo il tuo profilo.');
|
|
@@ -231,7 +305,11 @@ let UserController = UserController_1 = class UserController {
|
|
|
231
305
|
setGdpr(request, codiceUtente, res) {
|
|
232
306
|
return __awaiter(this, void 0, void 0, function* () {
|
|
233
307
|
try {
|
|
234
|
-
|
|
308
|
+
const authenticatedUser = (0, accessControl_1.getAuthenticatedAccessiUser)(request);
|
|
309
|
+
(0, accessControl_1.ensureSelfOrSuperUser)(authenticatedUser, codiceUtente, 'Puoi impostare il GDPR solo sul tuo utente.');
|
|
310
|
+
if (authenticatedUser.codiceUtente !== codiceUtente) {
|
|
311
|
+
yield this.ensureManageableTarget(authenticatedUser, codiceUtente);
|
|
312
|
+
}
|
|
235
313
|
yield this.userService.setGdpr(codiceUtente);
|
|
236
314
|
return Utilities_1.RestUtilities.sendOKMessage(res, `L'utente ${codiceUtente} ha accettato il GDPR.`);
|
|
237
315
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserController.js","sourceRoot":"","sources":["../../../src/accessi-module/Controllers/UserController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAoBwB;AAExB,6CASyB;AACzB,+BAA4B;AAC5B,yCAAsC;AACtC,+CAAgD;AAEhD,uDAAqE;AACrE,+DAA4D;AAC5D,yEAAsE;AACtE,+DA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AAE,qBAAY,CAAC,CAAA;IACnC,WAAA,IAAA,aAAI,GAAE,CAAA;IACN,WAAA,IAAA,YAAG,GAAE,CAAA;;qDADQ,iBAAO;;kDAoCtB;AAsBK;IApBL,IAAA,sBAAY,EAAC;QACZ,OAAO,EAAE,wCAAwC;QACjD,WAAW,EAAE,SAAS;KACvB,CAAC;IACD,IAAA,kBAAQ,EAAC;QACR,IAAI,EAAE,cAAc;QACpB,WAAW,EAAE,uDAAuD;QACpE,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,GAAG;KACb,CAAC;IACD,IAAA,qBAAW,EAAC;QACX,MAAM,EAAE,GAAG;QACX,WAAW,EAAE,sCAAsC;QACnD,IAAI,EAAE,6BAAc;KACrB,CAAC;IACD,IAAA,qBAAW,EAAC,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,wBAAwB,EAAE,IAAI,EAAE,4BAAa,EAAE,CAAC;IACxF,IAAA,qBAAW,EAAC,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,4BAA4B,EAAE,IAAI,EAAE,4BAAa,EAAE,CAAC;IAC5F,IAAA,uBAAa,GAAE;IACf,IAAA,kBAAS,EAAC,6BAAc,CAAC;IACzB,IAAA,cAAK,EAAC,wBAAwB,CAAC;IAE7B,WAAA,IAAA,YAAG,GAAE,CAAA;IACL,WAAA,IAAA,cAAK,EAAC,cAAc,EAAE,qBAAY,CAAC,CAAA;IACnC,WAAA,IAAA,YAAG,GAAE,CAAA;;;;6CAcP;yBAxgBU,cAAc;IAN1B,IAAA,iBAAO,EAAC,MAAM,CAAC;IACf,IAAA,mBAAU,EAAC,cAAc,CAAC;IAC3B;;;OAGG;;IAKE,WAAA,IAAA,eAAM,EAAC,iBAAiB,CAAC,CAAA;6CACI,yBAAW;QACV,2BAAY;QACb,yBAAW;GAPhC,cAAc,CAygB1B","sourcesContent":["import {\n BadRequestException,\n Body,\n Controller,\n Delete,\n Get,\n HttpException,\n HttpStatus,\n NotFoundException,\n Param,\n ParseBoolPipe,\n ParseIntPipe,\n Patch,\n Post,\n Put,\n Query,\n Inject,\n Req,\n Res,\n UseGuards,\n} from '@nestjs/common';\nimport { Request, Response } from 'express';\nimport {\n ApiBearerAuth,\n ApiBody,\n ApiCreatedResponse,\n ApiOperation,\n ApiParam,\n ApiQuery,\n ApiResponse,\n ApiTags,\n} from '@nestjs/swagger';\nimport { join } from 'path';\nimport { Logger } from '../../Logger';\nimport { RestUtilities } from '../../Utilities';\nimport type { AccessiOptions } from '../AccessiModule';\nimport { ActionResponse, ErrorResponse } from '../Dtos/BaseResponse';\nimport { GetUsersResponse } from '../Dtos/GetUsersResponse';\nimport { PublicRegisterRequest } from '../Dtos/PublicRegisterRequest';\nimport { RegisterResponse } from '../Dtos/RegisterResponse';\nimport { RegisterRequest } from '../Dtos/RegisterRequest';\nimport { SetStatoRegistrazioneDto } from '../Dtos/SetStatoRegistrazione';\nimport { SetUserPasswordRequest } from '../Dtos/SetUserPasswordRequest';\nimport { UserDto } from '../Dtos/UserDto';\nimport { AuthService } from '../Services/AuthService/AuthService';\nimport { EmailService } from '../Services/EmailService/EmailService';\nimport { UserService } from '../Services/UserService/UserService';\nimport { JwtSimpleGuard } from '../jwt/jwt.strategy';\nimport {\n checkPublicAuthRateLimit,\n sendPublicAuthRateLimitExceeded,\n} from '../security/publicAuthRateLimit';\nimport {\n ensureAdmin,\n ensurePrivilegeFlagChanges,\n ensureSelfOrSuperUser,\n ensureUserManagement,\n getAuthenticatedAccessiUser,\n hasPrivilegedUserChanges,\n} from '../security/accessControl';\n\n@ApiTags('User')\n@Controller('accessi/user')\n/**\n * Gestione utenti: la registrazione pubblica e opt-in, mentre creazione, stato e profili privilegiati\n * richiedono un superutente Accessi. Le API restituiscono sempre il wrapper `BaseResponse` storico.\n */\nexport class UserController {\n private readonly logger = new Logger(UserController.name);\n\n constructor(\n @Inject('ACCESSI_OPTIONS') private readonly accessiOptions: AccessiOptions,\n private readonly userService: UserService,\n private readonly emailService: EmailService,\n private readonly authService: AuthService,\n ) {}\n\n private sendControllerError(res: Response, error: unknown) {\n // Lo status viene derivato centralmente da RestUtilities (HttpException o 500).\n return RestUtilities.sendErrorMessage(res, error, UserController.name);\n }\n\n @ApiOperation({\n summary: 'Serve la pagina di reset password',\n operationId: 'serveResetPasswordPageUser',\n })\n @ApiParam({\n name: 'token',\n description: 'Token per il reset della password',\n required: true,\n })\n @Get('reset-password/:token')\n async serveResetPasswordPage(@Res() res: Response, @Param('token') _token: string) {\n return res.sendFile(join(__dirname, '..', 'Views', 'reset-password.html'));\n }\n\n @ApiOperation({\n summary: 'Recupera la lista degli utenti',\n operationId: 'getUsers',\n })\n @ApiResponse({\n status: 200,\n description: 'Lista utenti recuperata con successo',\n type: GetUsersResponse,\n })\n @ApiResponse({ status: 401, description: 'Credenziali non valide', type: ErrorResponse })\n @ApiResponse({ status: 403, description: 'Operazione non autorizzata', type: ErrorResponse })\n @ApiResponse({ status: 500, description: 'Errore interno del server', type: ErrorResponse })\n @ApiQuery({\n name: 'email',\n required: false,\n description: \"Email dell'utente da cercare\",\n type: String,\n })\n @ApiQuery({\n name: 'codiceUtente',\n required: false,\n description: \"Codice dell'utente da cercare\",\n type: Number,\n })\n @ApiQuery({\n name: 'includeExtensionFields',\n required: false,\n description: 'Includi extension fields',\n type: Boolean,\n })\n @ApiQuery({\n name: 'includeGrants',\n required: false,\n description: 'Includi permessi',\n type: Boolean,\n })\n @ApiQuery({\n name: 'limit',\n required: false,\n description: 'Numero massimo di utenti restituiti (1-1000). Omesso = tutti.',\n type: Number,\n })\n @ApiQuery({\n name: 'offset',\n required: false,\n description: 'Numero di utenti da saltare (paginazione).',\n type: Number,\n })\n @ApiBearerAuth()\n @UseGuards(JwtSimpleGuard)\n @Get('get-users')\n async getUsers(\n @Req() request: Request,\n @Res() res: Response,\n @Query('email') email?: string,\n @Query('codiceUtente', new ParseIntPipe({ optional: true })) codiceUtente?: number,\n @Query('includeExtensionFields', new ParseBoolPipe({ optional: true }))\n includeExtensionFields?: boolean,\n @Query('includeGrants', new ParseBoolPipe({ optional: true }))\n includeGrants?: boolean,\n @Query('limit', new ParseIntPipe({ optional: true })) limit?: number,\n @Query('offset', new ParseIntPipe({ optional: true })) offset?: number,\n ) {\n try {\n ensureUserManagement(\n getAuthenticatedAccessiUser(request),\n 'Solo gli amministratori possono consultare gli utenti.',\n );\n\n const filters = { email, codiceUtente, limit, offset };\n const options = {\n includeExtensionFields: includeExtensionFields ?? true,\n includeGrants: includeGrants ?? true,\n };\n\n const users = await this.userService.getUsers(filters, options);\n const total = await this.userService.countUsers({ email, codiceUtente });\n res.setHeader('X-Total-Count', String(total));\n return RestUtilities.sendBaseResponse(res, users);\n } catch (error) {\n this.logger.error('Errore durante il recupero degli utenti: ', error);\n return this.sendControllerError(res, error);\n }\n }\n\n @ApiOperation({\n summary: 'Elimina un utente',\n operationId: 'deleteUser',\n description: 'Imposta lo stato di un utente a eliminato senza rimuovere i record.',\n })\n @ApiParam({\n name: 'codiceUtente',\n description: \"Codice identificativo dell'utente da eliminare\",\n required: true,\n example: 123,\n })\n @ApiResponse({ status: 200, description: 'Utente eliminato con successo', type: ActionResponse })\n @ApiResponse({\n status: 400,\n description: 'Errore nei parametri della richiesta',\n type: ErrorResponse,\n })\n @ApiResponse({ status: 500, description: 'Errore interno del server', type: ErrorResponse })\n @ApiBearerAuth()\n @UseGuards(JwtSimpleGuard)\n @Delete('delete-user/:codiceUtente')\n async deleteUser(\n @Req() request: Request,\n @Param('codiceUtente', ParseIntPipe) codiceUtente: number,\n @Res() res: Response,\n ) {\n try {\n ensureUserManagement(\n getAuthenticatedAccessiUser(request),\n 'Solo gli amministratori possono eliminare utenti.',\n );\n\n await this.userService.deleteUser(codiceUtente);\n return RestUtilities.sendOKMessage(res, \"L'utente e' stato eliminato con successo.\");\n } catch (error) {\n return this.sendControllerError(res, error);\n }\n }\n\n @ApiOperation({\n summary: 'Elimina definitivamente un utente',\n operationId: 'deleteUserPermanently',\n description: 'Rimuove l utente e tutti i record collegati. Operazione distruttiva riservata agli admin.',\n })\n @ApiParam({\n name: 'codiceUtente',\n description: \"Codice identificativo dell'utente da eliminare definitivamente\",\n required: true,\n example: 123,\n })\n @ApiResponse({ status: 200, description: 'Utente eliminato definitivamente', type: ActionResponse })\n @ApiResponse({ status: 400, description: 'Errore nei parametri della richiesta', type: ErrorResponse })\n @ApiResponse({ status: 403, description: 'Operazione non autorizzata', type: ErrorResponse })\n @ApiResponse({ status: 404, description: 'Utente non trovato', type: ErrorResponse })\n @ApiResponse({ status: 500, description: 'Errore interno del server', type: ErrorResponse })\n @ApiBearerAuth()\n @UseGuards(JwtSimpleGuard)\n @Delete('delete-user-permanent/:codiceUtente')\n async deleteUserPermanently(\n @Req() request: Request,\n @Param('codiceUtente', ParseIntPipe) codiceUtente: number,\n @Res() res: Response,\n ) {\n try {\n const authenticatedUser = getAuthenticatedAccessiUser(request);\n ensureAdmin(\n authenticatedUser,\n 'Solo gli admin possono eliminare definitivamente un utente.',\n );\n\n if (authenticatedUser.codiceUtente === codiceUtente) {\n throw new BadRequestException('Non puoi eliminare definitivamente il tuo stesso utente.');\n }\n\n await this.userService.deleteUserPermanently(codiceUtente);\n return RestUtilities.sendOKMessage(res, \"L'utente e' stato eliminato definitivamente.\");\n } catch (error) {\n return this.sendControllerError(res, error);\n }\n }\n\n @ApiOperation({\n summary: 'Forza l invio dell email di reset password a un utente',\n operationId: 'forcePasswordReset',\n description: 'Riservato al superutente. Richiede un servizio email configurato; altrimenti risponde con ACCESSI_EMAIL_NOT_CONFIGURED.',\n })\n @ApiParam({ name: 'codiceUtente', description: 'Codice identificativo dell utente', required: true, example: 123, type: Number })\n @ApiResponse({ status: 200, description: 'Email di reset inviata', type: ActionResponse })\n @ApiResponse({ status: 400, description: 'Servizio email non configurato', type: ErrorResponse })\n @ApiResponse({ status: 404, description: 'Utente non trovato', type: ErrorResponse })\n @ApiBearerAuth()\n @UseGuards(JwtSimpleGuard)\n @Post('force-password-reset/:codiceUtente')\n async forcePasswordReset(\n @Req() request: Request,\n @Param('codiceUtente', ParseIntPipe) codiceUtente: number,\n @Res() res: Response,\n ) {\n try {\n ensureUserManagement(\n getAuthenticatedAccessiUser(request),\n 'Solo gli amministratori possono forzare il reset password.',\n );\n await this.userService.forcePasswordReset(codiceUtente);\n return RestUtilities.sendOKMessage(res, `Email di reset inviata all utente ${codiceUtente}.`);\n } catch (error) {\n return this.sendControllerError(res, error);\n }\n }\n\n @ApiOperation({\n summary: 'Forza il reset password per tutti gli utenti con password legacy',\n operationId: 'forcePasswordResetLegacy',\n description: 'Riservato al superutente. Invia l email di reset a tutti gli utenti la cui password non e ancora nel formato moderno. Richiede un servizio email configurato.',\n })\n @ApiResponse({ status: 200, description: 'Email di reset inviate', type: ActionResponse })\n @ApiResponse({ status: 400, description: 'Servizio email non configurato', type: ErrorResponse })\n @ApiBearerAuth()\n @UseGuards(JwtSimpleGuard)\n @Post('force-password-reset-legacy')\n async forcePasswordResetLegacy(@Req() request: Request, @Res() res: Response) {\n try {\n ensureUserManagement(\n getAuthenticatedAccessiUser(request),\n 'Solo gli amministratori possono forzare il reset password.',\n );\n const sent = await this.userService.forcePasswordResetForLegacyPasswords();\n return RestUtilities.sendOKMessage(res, `Email di reset inviata a ${sent} utenti con password legacy.`);\n } catch (error) {\n return this.sendControllerError(res, error);\n }\n }\n\n @ApiOperation({\n summary: 'Imposta direttamente la password di un utente',\n operationId: 'setUserPassword',\n description: 'Riservato agli amministratori. Hasha la password, aggiorna la scadenza secondo la policy e non invia email.',\n })\n @ApiParam({ name: 'codiceUtente', description: 'Codice identificativo dell utente', required: true, example: 123, type: Number })\n @ApiBody({ type: SetUserPasswordRequest })\n @ApiResponse({ status: 200, description: 'Password aggiornata', type: ActionResponse })\n @ApiResponse({ status: 400, description: 'Password non valida', type: ErrorResponse })\n @ApiResponse({ status: 403, description: 'Operazione non autorizzata', type: ErrorResponse })\n @ApiBearerAuth()\n @UseGuards(JwtSimpleGuard)\n @Post('set-password/:codiceUtente')\n async setUserPassword(\n @Req() request: Request,\n @Param('codiceUtente', ParseIntPipe) codiceUtente: number,\n @Body() body: SetUserPasswordRequest,\n @Res() res: Response,\n ) {\n try {\n ensureUserManagement(\n getAuthenticatedAccessiUser(request),\n 'Solo gli amministratori possono impostare la password di un utente.',\n );\n\n const existing = await this.userService.getUsers(\n { codiceUtente },\n { includeExtensionFields: false, includeGrants: false },\n );\n if (existing.length === 0) {\n throw new NotFoundException(`Nessun utente con codice ${codiceUtente}.`);\n }\n\n await this.authService.setPassword(codiceUtente, body.newPassword);\n return RestUtilities.sendOKMessage(res, `Password dell utente ${codiceUtente} aggiornata.`);\n } catch (error) {\n return this.sendControllerError(res, error);\n }\n }\n\n @ApiOperation({\n summary: 'Imposta lo stato di registrazione di un utente',\n operationId: 'setStatoRegistrazione',\n })\n @ApiResponse({\n status: 200,\n description: 'Stato registrazione aggiornato con successo',\n type: ActionResponse,\n })\n @ApiResponse({\n status: 400,\n description: 'Errore nei parametri della richiesta',\n type: ErrorResponse,\n })\n @ApiResponse({\n status: 500,\n description: 'Errore interno del server',\n type: ErrorResponse,\n })\n @ApiBody({ type: SetStatoRegistrazioneDto })\n @ApiBearerAuth()\n @UseGuards(JwtSimpleGuard)\n @Post('set-stato')\n async setStatoRegistrazione(\n @Req() request: Request,\n @Body() body: SetStatoRegistrazioneDto,\n @Res() res: Response,\n ) {\n try {\n ensureUserManagement(\n getAuthenticatedAccessiUser(request),\n 'Solo gli amministratori possono modificare lo stato di registrazione.',\n );\n\n const { codiceUtente, statoRegistrazione } = body;\n if (!codiceUtente) throw new BadRequestException('Il codice utente e\\' obbligatorio.');\n if (statoRegistrazione === undefined) {\n throw new BadRequestException('Lo stato registrazione e\\' obbligatorio.');\n }\n\n await this.userService.setStato(codiceUtente, statoRegistrazione);\n return RestUtilities.sendOKMessage(\n res,\n `Lo stato dell'utente ${codiceUtente} e' stato aggiornato a ${statoRegistrazione}.`,\n );\n } catch (error) {\n return this.sendControllerError(res, error);\n }\n }\n\n @ApiOperation({\n summary: 'Registra un nuovo utente',\n description: 'Disponibile soltanto quando publicRegistration.enabled e true. Per utenti SSO usare il provisioning master nel tag Federated authentication.',\n operationId: 'register',\n })\n @ApiBody({\n type: PublicRegisterRequest,\n description: \"Dati necessari per la registrazione dell'utente\",\n })\n @ApiCreatedResponse({\n description:\n 'Utente registrato con successo. Restituisce il codice utente e invia una mail di reset password.',\n type: RegisterResponse,\n })\n @ApiResponse({\n status: HttpStatus.BAD_REQUEST,\n description: 'Errore nella registrazione.',\n type: ErrorResponse,\n })\n @ApiResponse({\n status: HttpStatus.INTERNAL_SERVER_ERROR,\n description: 'Errore interno del server durante la registrazione o l\\'invio email.',\n type: ErrorResponse,\n })\n @Post('register')\n async register(\n @Req() request: Request,\n @Body() registrationData: PublicRegisterRequest,\n @Res() res: Response,\n ) {\n try {\n if (this.accessiOptions.publicRegistration?.enabled !== true) {\n throw new HttpException(\n 'La registrazione pubblica e disabilitata. Un amministratore deve creare l utente.',\n HttpStatus.FORBIDDEN,\n );\n }\n\n const rateLimitDecision = checkPublicAuthRateLimit(\n this.accessiOptions,\n 'register',\n request,\n [registrationData?.email],\n );\n if (!rateLimitDecision.allowed) {\n return sendPublicAuthRateLimitExceeded(res, rateLimitDecision.retryAfterSeconds);\n }\n\n const codiceUtente = await this.userService.register(registrationData, {\n allowPrivilegedFields: false,\n });\n\n await this.emailService.sendPasswordResetEmail(registrationData.email);\n return RestUtilities.sendBaseResponse(res, codiceUtente, HttpStatus.CREATED);\n } catch (error) {\n const status =\n error instanceof HttpException ? error.getStatus() : HttpStatus.BAD_REQUEST;\n return RestUtilities.sendErrorMessage(res, error, UserController.name, status);\n }\n }\n\n @ApiOperation({ summary: 'Crea un utente locale da amministrazione', operationId: 'createManagedUser', description: 'Riservato a superutente. Crea un utente in attesa di impostazione password e invia la mail di reset.' })\n @ApiBody({ type: RegisterRequest })\n @ApiCreatedResponse({ type: RegisterResponse })\n @ApiBearerAuth()\n @UseGuards(JwtSimpleGuard)\n @Post('create-managed-user')\n async createManagedUser(@Req() request: Request, @Body() registrationData: RegisterRequest, @Res() res: Response) {\n try {\n const authenticatedUser = getAuthenticatedAccessiUser(request);\n ensureUserManagement(authenticatedUser, 'Solo gli amministratori possono creare utenti.');\n ensurePrivilegeFlagChanges(authenticatedUser, registrationData);\n const codiceUtente = await this.userService.register(registrationData, { allowPrivilegedFields: true });\n await this.emailService.sendPasswordResetEmail(registrationData.email, registrationData.htmlMail);\n return RestUtilities.sendBaseResponse(res, codiceUtente, HttpStatus.CREATED);\n } catch (error) {\n return this.sendControllerError(res, error);\n }\n }\n\n @ApiOperation({\n summary: 'Aggiorna un utente esistente',\n operationId: 'updateUtente',\n })\n @ApiParam({\n name: 'codiceUtente',\n description: \"Codice identificativo dell'utente da aggiornare\",\n required: true,\n example: 123,\n })\n @ApiBody({\n type: UserDto,\n description: \"Dati aggiornati dell'utente\",\n })\n @ApiResponse({\n status: HttpStatus.OK,\n description: 'Utente aggiornato con successo',\n type: ActionResponse,\n })\n @ApiResponse({ status: 400, description: \"Errore nell'aggiornamento\", type: ErrorResponse })\n @ApiResponse({ status: 403, description: 'Operazione non autorizzata', type: ErrorResponse })\n @ApiResponse({ status: 500, description: 'Errore interno del server', type: ErrorResponse })\n @ApiBearerAuth()\n @UseGuards(JwtSimpleGuard)\n @Put('update-user/:codiceUtente')\n async updateUtente(\n @Req() request: Request,\n @Param('codiceUtente', ParseIntPipe) codiceUtente: number,\n @Body() user: UserDto,\n @Res() res: Response,\n ) {\n try {\n const authenticatedUser = getAuthenticatedAccessiUser(request);\n const isPrivilegedUpdate = hasPrivilegedUserChanges(user);\n\n if (isPrivilegedUpdate) {\n ensureUserManagement(\n authenticatedUser,\n 'Solo gli amministratori possono modificare ruoli, permessi o flag privilegiati.',\n );\n ensurePrivilegeFlagChanges(authenticatedUser, user);\n } else {\n ensureSelfOrSuperUser(\n authenticatedUser,\n codiceUtente,\n 'Puoi modificare solo il tuo profilo.',\n );\n }\n\n if (user.codiceUtente !== undefined && user.codiceUtente !== codiceUtente) {\n throw new BadRequestException('Il codice utente nel body non coincide con quello del path.');\n }\n\n await this.userService.updateUser(codiceUtente, user, {\n allowPrivilegedChanges: authenticatedUser.flagSuper || authenticatedUser.flagAdmin,\n });\n\n return RestUtilities.sendOKMessage(\n res,\n `L'utente ${codiceUtente} e' stato aggiornato con successo.`,\n );\n } catch (error) {\n return this.sendControllerError(res, error);\n }\n }\n\n @ApiOperation({\n summary: 'Imposta il consenso GDPR per un utente',\n operationId: 'setGdpr',\n })\n @ApiParam({\n name: 'codiceUtente',\n description: \"Codice identificativo dell'utente che accetta il GDPR\",\n required: true,\n example: 123,\n })\n @ApiResponse({\n status: 200,\n description: 'Consenso GDPR impostato con successo',\n type: ActionResponse,\n })\n @ApiResponse({ status: 400, description: 'Errore nella richiesta', type: ErrorResponse })\n @ApiResponse({ status: 403, description: 'Operazione non autorizzata', type: ErrorResponse })\n @ApiBearerAuth()\n @UseGuards(JwtSimpleGuard)\n @Patch('set-gdpr/:codiceUtente')\n async setGdpr(\n @Req() request: Request,\n @Param('codiceUtente', ParseIntPipe) codiceUtente: number,\n @Res() res: Response,\n ) {\n try {\n ensureSelfOrSuperUser(\n getAuthenticatedAccessiUser(request),\n codiceUtente,\n 'Puoi impostare il GDPR solo sul tuo utente.',\n );\n\n await this.userService.setGdpr(codiceUtente);\n return RestUtilities.sendOKMessage(res, `L'utente ${codiceUtente} ha accettato il GDPR.`);\n } catch (error) {\n return this.sendControllerError(res, error);\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"UserController.js","sourceRoot":"","sources":["../../../src/accessi-module/Controllers/UserController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAoBwB;AAExB,6CASyB;AACzB,+BAA4B;AAC5B,yCAAsC;AACtC,+CAAgD;AAEhD,uDAAqE;AACrE,+DAA4D;AAC5D,yEAAsE;AACtE,+DAA4D;AAC5D,6DAA0D;AAC1D,yEAAyE;AACzE,2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B,EAAE,IAAI,EAAE,4BAAa,EAAE,CAAC;IAC5F,IAAA,uBAAa,GAAE;IACf,IAAA,kBAAS,EAAC,6BAAc,CAAC;IACzB,IAAA,cAAK,EAAC,wBAAwB,CAAC;IAE7B,WAAA,IAAA,YAAG,GAAE,CAAA;IACL,WAAA,IAAA,cAAK,EAAC,cAAc,EAAE,qBAAY,CAAC,CAAA;IACnC,WAAA,IAAA,YAAG,GAAE,CAAA;;;;6CAkBP;yBArlBU,cAAc;IAN1B,IAAA,iBAAO,EAAC,MAAM,CAAC;IACf,IAAA,mBAAU,EAAC,cAAc,CAAC;IAC3B;;;OAGG;;IAKE,WAAA,IAAA,eAAM,EAAC,iBAAiB,CAAC,CAAA;6CACI,yBAAW;QACV,2BAAY;QACb,yBAAW;GAPhC,cAAc,CAslB1B","sourcesContent":["import {\n BadRequestException,\n Body,\n Controller,\n Delete,\n Get,\n HttpException,\n HttpStatus,\n NotFoundException,\n Param,\n ParseBoolPipe,\n ParseIntPipe,\n Patch,\n Post,\n Put,\n Query,\n Inject,\n Req,\n Res,\n UseGuards,\n} from '@nestjs/common';\nimport { Request, Response } from 'express';\nimport {\n ApiBearerAuth,\n ApiBody,\n ApiCreatedResponse,\n ApiOperation,\n ApiParam,\n ApiQuery,\n ApiResponse,\n ApiTags,\n} from '@nestjs/swagger';\nimport { join } from 'path';\nimport { Logger } from '../../Logger';\nimport { RestUtilities } from '../../Utilities';\nimport type { AccessiOptions } from '../AccessiModule';\nimport { ActionResponse, ErrorResponse } from '../Dtos/BaseResponse';\nimport { GetUsersResponse } from '../Dtos/GetUsersResponse';\nimport { PublicRegisterRequest } from '../Dtos/PublicRegisterRequest';\nimport { RegisterResponse } from '../Dtos/RegisterResponse';\nimport { RegisterRequest } from '../Dtos/RegisterRequest';\nimport { SetStatoRegistrazioneDto } from '../Dtos/SetStatoRegistrazione';\nimport { SetUserPasswordRequest } from '../Dtos/SetUserPasswordRequest';\nimport { UserDto } from '../Dtos/UserDto';\nimport { AuthService } from '../Services/AuthService/AuthService';\nimport { EmailService } from '../Services/EmailService/EmailService';\nimport { UserService } from '../Services/UserService/UserService';\nimport { JwtSimpleGuard } from '../jwt/jwt.strategy';\nimport {\n checkPublicAuthRateLimit,\n sendPublicAuthRateLimitExceeded,\n} from '../security/publicAuthRateLimit';\nimport {\n ensureAdmin,\n ensureCanManageTargetUser,\n ensurePrivilegeFlagChanges,\n ensureSelfOrSuperUser,\n ensureUserManagement,\n getAuthenticatedAccessiUser,\n hasPrivilegedUserChanges,\n} from '../security/accessControl';\nimport type { AuthenticatedAccessiUser } from '../security/accessControl';\nimport { assertEmailConfigured } from '../security/emailConfiguration';\nimport { StatoRegistrazione } from '../Dtos/StatoRegistrazione';\n\n@ApiTags('User')\n@Controller('accessi/user')\n/**\n * Gestione utenti: la registrazione pubblica e opt-in, mentre creazione, stato e profili privilegiati\n * richiedono un superutente Accessi. Le API restituiscono sempre il wrapper `BaseResponse` storico.\n */\nexport class UserController {\n private readonly logger = new Logger(UserController.name);\n\n constructor(\n @Inject('ACCESSI_OPTIONS') private readonly accessiOptions: AccessiOptions,\n private readonly userService: UserService,\n private readonly emailService: EmailService,\n private readonly authService: AuthService,\n ) {}\n\n private sendControllerError(res: Response, error: unknown) {\n // Lo status viene derivato centralmente da RestUtilities (HttpException o 500).\n return RestUtilities.sendErrorMessage(res, error, UserController.name);\n }\n\n /**\n * Verifica che il target esista e che l'attore possa gestirlo (rango attore >=\n * rango target: ADMIN > SUPER > utente). Restituisce lo snapshot corrente del\n * target, così i chiamanti possono controllare se e' admin.\n */\n private async ensureManageableTarget(\n actor: AuthenticatedAccessiUser,\n codiceUtente: number,\n ) {\n const target = await this.userService.getAuthenticatedUserSnapshot(codiceUtente);\n if (!target) {\n throw new NotFoundException(`Nessun utente con codice ${codiceUtente}.`);\n }\n ensureCanManageTargetUser(actor, target);\n return target;\n }\n\n @ApiOperation({\n summary: 'Serve la pagina di reset password',\n operationId: 'serveResetPasswordPageUser',\n })\n @ApiParam({\n name: 'token',\n description: 'Token per il reset della password',\n required: true,\n })\n @Get('reset-password/:token')\n async serveResetPasswordPage(@Res() res: Response, @Param('token') _token: string) {\n return res.sendFile(join(__dirname, '..', 'Views', 'reset-password.html'));\n }\n\n @ApiOperation({\n summary: 'Recupera la lista degli utenti',\n operationId: 'getUsers',\n })\n @ApiResponse({\n status: 200,\n description: 'Lista utenti recuperata con successo',\n type: GetUsersResponse,\n })\n @ApiResponse({ status: 401, description: 'Credenziali non valide', type: ErrorResponse })\n @ApiResponse({ status: 403, description: 'Operazione non autorizzata', type: ErrorResponse })\n @ApiResponse({ status: 500, description: 'Errore interno del server', type: ErrorResponse })\n @ApiQuery({\n name: 'email',\n required: false,\n description: \"Email dell'utente da cercare\",\n type: String,\n })\n @ApiQuery({\n name: 'codiceUtente',\n required: false,\n description: \"Codice dell'utente da cercare\",\n type: Number,\n })\n @ApiQuery({\n name: 'includeExtensionFields',\n required: false,\n description: 'Includi extension fields',\n type: Boolean,\n })\n @ApiQuery({\n name: 'includeGrants',\n required: false,\n description: 'Includi permessi',\n type: Boolean,\n })\n @ApiQuery({\n name: 'limit',\n required: false,\n description: 'Numero massimo di utenti restituiti (1-1000). Omesso = tutti.',\n type: Number,\n })\n @ApiQuery({\n name: 'offset',\n required: false,\n description: 'Numero di utenti da saltare (paginazione).',\n type: Number,\n })\n @ApiBearerAuth()\n @UseGuards(JwtSimpleGuard)\n @Get('get-users')\n async getUsers(\n @Req() request: Request,\n @Res() res: Response,\n @Query('email') email?: string,\n @Query('codiceUtente', new ParseIntPipe({ optional: true })) codiceUtente?: number,\n @Query('includeExtensionFields', new ParseBoolPipe({ optional: true }))\n includeExtensionFields?: boolean,\n @Query('includeGrants', new ParseBoolPipe({ optional: true }))\n includeGrants?: boolean,\n @Query('limit', new ParseIntPipe({ optional: true })) limit?: number,\n @Query('offset', new ParseIntPipe({ optional: true })) offset?: number,\n ) {\n try {\n ensureUserManagement(\n getAuthenticatedAccessiUser(request),\n 'Solo gli amministratori possono consultare gli utenti.',\n );\n\n const filters = { email, codiceUtente, limit, offset };\n const options = {\n includeExtensionFields: includeExtensionFields ?? true,\n includeGrants: includeGrants ?? true,\n };\n\n const users = await this.userService.getUsers(filters, options);\n const total = await this.userService.countUsers({ email, codiceUtente });\n res.setHeader('X-Total-Count', String(total));\n return RestUtilities.sendBaseResponse(res, users);\n } catch (error) {\n this.logger.error('Errore durante il recupero degli utenti: ', error);\n return this.sendControllerError(res, error);\n }\n }\n\n @ApiOperation({\n summary: 'Elimina un utente',\n operationId: 'deleteUser',\n description: 'Imposta lo stato di un utente a eliminato senza rimuovere i record.',\n })\n @ApiParam({\n name: 'codiceUtente',\n description: \"Codice identificativo dell'utente da eliminare\",\n required: true,\n example: 123,\n })\n @ApiResponse({ status: 200, description: 'Utente eliminato con successo', type: ActionResponse })\n @ApiResponse({\n status: 400,\n description: 'Errore nei parametri della richiesta',\n type: ErrorResponse,\n })\n @ApiResponse({ status: 500, description: 'Errore interno del server', type: ErrorResponse })\n @ApiBearerAuth()\n @UseGuards(JwtSimpleGuard)\n @Delete('delete-user/:codiceUtente')\n async deleteUser(\n @Req() request: Request,\n @Param('codiceUtente', ParseIntPipe) codiceUtente: number,\n @Res() res: Response,\n ) {\n try {\n const authenticatedUser = getAuthenticatedAccessiUser(request);\n ensureUserManagement(\n authenticatedUser,\n 'Solo gli amministratori possono eliminare utenti.',\n );\n\n const target = await this.ensureManageableTarget(authenticatedUser, codiceUtente);\n if (target.flagAdmin) {\n await this.userService.assertNotLastActiveAdmin(codiceUtente);\n }\n\n await this.userService.deleteUser(codiceUtente);\n return RestUtilities.sendOKMessage(res, \"L'utente e' stato eliminato con successo.\");\n } catch (error) {\n return this.sendControllerError(res, error);\n }\n }\n\n @ApiOperation({\n summary: 'Elimina definitivamente un utente',\n operationId: 'deleteUserPermanently',\n description: 'Rimuove l utente e tutti i record collegati. Operazione distruttiva riservata agli admin.',\n })\n @ApiParam({\n name: 'codiceUtente',\n description: \"Codice identificativo dell'utente da eliminare definitivamente\",\n required: true,\n example: 123,\n })\n @ApiResponse({ status: 200, description: 'Utente eliminato definitivamente', type: ActionResponse })\n @ApiResponse({ status: 400, description: 'Errore nei parametri della richiesta', type: ErrorResponse })\n @ApiResponse({ status: 403, description: 'Operazione non autorizzata', type: ErrorResponse })\n @ApiResponse({ status: 404, description: 'Utente non trovato', type: ErrorResponse })\n @ApiResponse({ status: 500, description: 'Errore interno del server', type: ErrorResponse })\n @ApiBearerAuth()\n @UseGuards(JwtSimpleGuard)\n @Delete('delete-user-permanent/:codiceUtente')\n async deleteUserPermanently(\n @Req() request: Request,\n @Param('codiceUtente', ParseIntPipe) codiceUtente: number,\n @Res() res: Response,\n ) {\n try {\n const authenticatedUser = getAuthenticatedAccessiUser(request);\n ensureAdmin(\n authenticatedUser,\n 'Solo gli admin possono eliminare definitivamente un utente.',\n );\n\n if (authenticatedUser.codiceUtente === codiceUtente) {\n throw new BadRequestException('Non puoi eliminare definitivamente il tuo stesso utente.');\n }\n\n const target = await this.ensureManageableTarget(authenticatedUser, codiceUtente);\n if (target.flagAdmin) {\n await this.userService.assertNotLastActiveAdmin(codiceUtente);\n }\n\n await this.userService.deleteUserPermanently(codiceUtente);\n return RestUtilities.sendOKMessage(res, \"L'utente e' stato eliminato definitivamente.\");\n } catch (error) {\n return this.sendControllerError(res, error);\n }\n }\n\n @ApiOperation({\n summary: 'Forza l invio dell email di reset password a un utente',\n operationId: 'forcePasswordReset',\n description: 'Riservato al superutente. Richiede un servizio email configurato; altrimenti risponde con ACCESSI_EMAIL_NOT_CONFIGURED.',\n })\n @ApiParam({ name: 'codiceUtente', description: 'Codice identificativo dell utente', required: true, example: 123, type: Number })\n @ApiResponse({ status: 200, description: 'Email di reset inviata', type: ActionResponse })\n @ApiResponse({ status: 400, description: 'Servizio email non configurato', type: ErrorResponse })\n @ApiResponse({ status: 404, description: 'Utente non trovato', type: ErrorResponse })\n @ApiBearerAuth()\n @UseGuards(JwtSimpleGuard)\n @Post('force-password-reset/:codiceUtente')\n async forcePasswordReset(\n @Req() request: Request,\n @Param('codiceUtente', ParseIntPipe) codiceUtente: number,\n @Res() res: Response,\n ) {\n try {\n const authenticatedUser = getAuthenticatedAccessiUser(request);\n ensureUserManagement(\n authenticatedUser,\n 'Solo gli amministratori possono forzare il reset password.',\n );\n await this.ensureManageableTarget(authenticatedUser, codiceUtente);\n await this.userService.forcePasswordReset(codiceUtente);\n return RestUtilities.sendOKMessage(res, `Email di reset inviata all utente ${codiceUtente}.`);\n } catch (error) {\n return this.sendControllerError(res, error);\n }\n }\n\n @ApiOperation({\n summary: 'Forza il reset password per tutti gli utenti con password legacy',\n operationId: 'forcePasswordResetLegacy',\n description: 'Riservato al superutente. Invia l email di reset a tutti gli utenti la cui password non e ancora nel formato moderno. Richiede un servizio email configurato.',\n })\n @ApiResponse({ status: 200, description: 'Email di reset inviate', type: ActionResponse })\n @ApiResponse({ status: 400, description: 'Servizio email non configurato', type: ErrorResponse })\n @ApiBearerAuth()\n @UseGuards(JwtSimpleGuard)\n @Post('force-password-reset-legacy')\n async forcePasswordResetLegacy(@Req() request: Request, @Res() res: Response) {\n try {\n ensureUserManagement(\n getAuthenticatedAccessiUser(request),\n 'Solo gli amministratori possono forzare il reset password.',\n );\n const sent = await this.userService.forcePasswordResetForLegacyPasswords();\n return RestUtilities.sendOKMessage(res, `Email di reset inviata a ${sent} utenti con password legacy.`);\n } catch (error) {\n return this.sendControllerError(res, error);\n }\n }\n\n @ApiOperation({\n summary: 'Imposta direttamente la password di un utente',\n operationId: 'setUserPassword',\n description: 'Riservato agli amministratori. Hasha la password, aggiorna la scadenza secondo la policy e non invia email.',\n })\n @ApiParam({ name: 'codiceUtente', description: 'Codice identificativo dell utente', required: true, example: 123, type: Number })\n @ApiBody({ type: SetUserPasswordRequest })\n @ApiResponse({ status: 200, description: 'Password aggiornata', type: ActionResponse })\n @ApiResponse({ status: 400, description: 'Password non valida', type: ErrorResponse })\n @ApiResponse({ status: 403, description: 'Operazione non autorizzata', type: ErrorResponse })\n @ApiBearerAuth()\n @UseGuards(JwtSimpleGuard)\n @Post('set-password/:codiceUtente')\n async setUserPassword(\n @Req() request: Request,\n @Param('codiceUtente', ParseIntPipe) codiceUtente: number,\n @Body() body: SetUserPasswordRequest,\n @Res() res: Response,\n ) {\n try {\n const authenticatedUser = getAuthenticatedAccessiUser(request);\n ensureUserManagement(\n authenticatedUser,\n 'Solo gli amministratori possono impostare la password di un utente.',\n );\n await this.ensureManageableTarget(authenticatedUser, codiceUtente);\n\n await this.authService.setPassword(codiceUtente, body.newPassword);\n return RestUtilities.sendOKMessage(res, `Password dell utente ${codiceUtente} aggiornata.`);\n } catch (error) {\n return this.sendControllerError(res, error);\n }\n }\n\n @ApiOperation({\n summary: 'Imposta lo stato di registrazione di un utente',\n operationId: 'setStatoRegistrazione',\n })\n @ApiResponse({\n status: 200,\n description: 'Stato registrazione aggiornato con successo',\n type: ActionResponse,\n })\n @ApiResponse({\n status: 400,\n description: 'Errore nei parametri della richiesta',\n type: ErrorResponse,\n })\n @ApiResponse({\n status: 500,\n description: 'Errore interno del server',\n type: ErrorResponse,\n })\n @ApiBody({ type: SetStatoRegistrazioneDto })\n @ApiBearerAuth()\n @UseGuards(JwtSimpleGuard)\n @Post('set-stato')\n async setStatoRegistrazione(\n @Req() request: Request,\n @Body() body: SetStatoRegistrazioneDto,\n @Res() res: Response,\n ) {\n try {\n const authenticatedUser = getAuthenticatedAccessiUser(request);\n ensureUserManagement(\n authenticatedUser,\n 'Solo gli amministratori possono modificare lo stato di registrazione.',\n );\n\n const { codiceUtente, statoRegistrazione } = body;\n if (!codiceUtente) throw new BadRequestException('Il codice utente e\\' obbligatorio.');\n if (statoRegistrazione === undefined) {\n throw new BadRequestException('Lo stato registrazione e\\' obbligatorio.');\n }\n\n const target = await this.ensureManageableTarget(authenticatedUser, codiceUtente);\n const disabling = statoRegistrazione === StatoRegistrazione.DELETE\n || statoRegistrazione === StatoRegistrazione.BLOCC;\n if (target.flagAdmin && disabling) {\n await this.userService.assertNotLastActiveAdmin(codiceUtente);\n }\n\n await this.userService.setStato(codiceUtente, statoRegistrazione);\n return RestUtilities.sendOKMessage(\n res,\n `Lo stato dell'utente ${codiceUtente} e' stato aggiornato a ${statoRegistrazione}.`,\n );\n } catch (error) {\n return this.sendControllerError(res, error);\n }\n }\n\n @ApiOperation({\n summary: 'Registra un nuovo utente',\n description: 'Disponibile soltanto quando publicRegistration.enabled e true. Per utenti SSO usare il provisioning master nel tag Federated authentication.',\n operationId: 'register',\n })\n @ApiBody({\n type: PublicRegisterRequest,\n description: \"Dati necessari per la registrazione dell'utente\",\n })\n @ApiCreatedResponse({\n description:\n 'Utente registrato con successo. Restituisce il codice utente e invia una mail di reset password.',\n type: RegisterResponse,\n })\n @ApiResponse({\n status: HttpStatus.BAD_REQUEST,\n description: 'Errore nella registrazione.',\n type: ErrorResponse,\n })\n @ApiResponse({\n status: HttpStatus.INTERNAL_SERVER_ERROR,\n description: 'Errore interno del server durante la registrazione o l\\'invio email.',\n type: ErrorResponse,\n })\n @Post('register')\n async register(\n @Req() request: Request,\n @Body() registrationData: PublicRegisterRequest,\n @Res() res: Response,\n ) {\n try {\n if (this.accessiOptions.publicRegistration?.enabled !== true) {\n throw new HttpException(\n 'La registrazione pubblica e disabilitata. Un amministratore deve creare l utente.',\n HttpStatus.FORBIDDEN,\n );\n }\n\n const rateLimitDecision = checkPublicAuthRateLimit(\n this.accessiOptions,\n 'register',\n request,\n [registrationData?.email],\n );\n if (!rateLimitDecision.allowed) {\n return sendPublicAuthRateLimitExceeded(res, rateLimitDecision.retryAfterSeconds);\n }\n\n assertEmailConfigured(this.accessiOptions);\n\n const codiceUtente = await this.userService.register(registrationData, {\n allowPrivilegedFields: false,\n });\n\n try {\n await this.emailService.sendPasswordResetEmail(registrationData.email);\n } catch (emailError) {\n try {\n await this.userService.deleteUserPermanently(codiceUtente);\n } catch (rollbackError) {\n this.logger.error(`Rollback registrazione utente ${codiceUtente} non riuscita: ${rollbackError instanceof Error ? rollbackError.message : String(rollbackError)}`);\n }\n throw new BadRequestException({\n code: 'ACCESSI_USER_INVITE_EMAIL_FAILED',\n message: `Registrazione non completata: invio email non riuscito (${emailError instanceof Error ? emailError.message : String(emailError)}). Riprova piu tardi.`,\n });\n }\n return RestUtilities.sendBaseResponse(res, codiceUtente, HttpStatus.CREATED);\n } catch (error) {\n const status =\n error instanceof HttpException ? error.getStatus() : HttpStatus.BAD_REQUEST;\n return RestUtilities.sendErrorMessage(res, error, UserController.name, status);\n }\n }\n\n @ApiOperation({ summary: 'Crea un utente locale da amministrazione', operationId: 'createManagedUser', description: 'Riservato a superutente. Crea un utente in attesa di impostazione password e invia la mail di reset.' })\n @ApiBody({ type: RegisterRequest })\n @ApiCreatedResponse({ type: RegisterResponse })\n @ApiBearerAuth()\n @UseGuards(JwtSimpleGuard)\n @Post('create-managed-user')\n async createManagedUser(@Req() request: Request, @Body() registrationData: RegisterRequest, @Res() res: Response) {\n try {\n const authenticatedUser = getAuthenticatedAccessiUser(request);\n ensureUserManagement(authenticatedUser, 'Solo gli amministratori possono creare utenti.');\n ensurePrivilegeFlagChanges(authenticatedUser, registrationData);\n\n // Fail-fast prima di scrivere: senza SMTP non si crea un utente orfano.\n assertEmailConfigured(this.accessiOptions);\n\n const codiceUtente = await this.userService.register(registrationData, { allowPrivilegedFields: true });\n try {\n await this.emailService.sendPasswordResetEmail(registrationData.email, registrationData.htmlMail);\n } catch (emailError) {\n // L'invio e' esterno: se fallisce annulliamo la creazione per non lasciare un utente\n // senza password e senza email di invito (rollback best-effort).\n try {\n await this.userService.deleteUserPermanently(codiceUtente);\n } catch (rollbackError) {\n this.logger.error(`Rollback creazione utente ${codiceUtente} non riuscita: ${rollbackError instanceof Error ? rollbackError.message : String(rollbackError)}`);\n }\n throw new BadRequestException({\n code: 'ACCESSI_USER_INVITE_EMAIL_FAILED',\n message: `Utente non creato: invio email di invito non riuscito (${emailError instanceof Error ? emailError.message : String(emailError)}). Riprova oppure crea l utente e imposta la password manualmente.`,\n });\n }\n return RestUtilities.sendBaseResponse(res, codiceUtente, HttpStatus.CREATED);\n } catch (error) {\n return this.sendControllerError(res, error);\n }\n }\n\n @ApiOperation({\n summary: 'Aggiorna un utente esistente',\n operationId: 'updateUtente',\n })\n @ApiParam({\n name: 'codiceUtente',\n description: \"Codice identificativo dell'utente da aggiornare\",\n required: true,\n example: 123,\n })\n @ApiBody({\n type: UserDto,\n description: \"Dati aggiornati dell'utente\",\n })\n @ApiResponse({\n status: HttpStatus.OK,\n description: 'Utente aggiornato con successo',\n type: ActionResponse,\n })\n @ApiResponse({ status: 400, description: \"Errore nell'aggiornamento\", type: ErrorResponse })\n @ApiResponse({ status: 403, description: 'Operazione non autorizzata', type: ErrorResponse })\n @ApiResponse({ status: 500, description: 'Errore interno del server', type: ErrorResponse })\n @ApiBearerAuth()\n @UseGuards(JwtSimpleGuard)\n @Put('update-user/:codiceUtente')\n async updateUtente(\n @Req() request: Request,\n @Param('codiceUtente', ParseIntPipe) codiceUtente: number,\n @Body() user: UserDto,\n @Res() res: Response,\n ) {\n try {\n const authenticatedUser = getAuthenticatedAccessiUser(request);\n const isPrivilegedUpdate = hasPrivilegedUserChanges(user);\n const isSelf = authenticatedUser.codiceUtente === codiceUtente;\n\n // ADMIN > SUPER: un superutente non puo' toccare un admin. Self sempre consentito.\n if (!isSelf) {\n await this.ensureManageableTarget(authenticatedUser, codiceUtente);\n }\n\n if (isPrivilegedUpdate) {\n ensureUserManagement(\n authenticatedUser,\n 'Solo gli amministratori possono modificare ruoli, permessi o flag privilegiati.',\n );\n ensurePrivilegeFlagChanges(authenticatedUser, user);\n if (user.flagAdmin === false) {\n await this.userService.assertNotLastActiveAdmin(codiceUtente);\n }\n } else {\n ensureSelfOrSuperUser(\n authenticatedUser,\n codiceUtente,\n 'Puoi modificare solo il tuo profilo.',\n );\n }\n\n if (user.codiceUtente !== undefined && user.codiceUtente !== codiceUtente) {\n throw new BadRequestException('Il codice utente nel body non coincide con quello del path.');\n }\n\n await this.userService.updateUser(codiceUtente, user, {\n allowPrivilegedChanges: authenticatedUser.flagSuper || authenticatedUser.flagAdmin,\n });\n\n return RestUtilities.sendOKMessage(\n res,\n `L'utente ${codiceUtente} e' stato aggiornato con successo.`,\n );\n } catch (error) {\n return this.sendControllerError(res, error);\n }\n }\n\n @ApiOperation({\n summary: 'Imposta il consenso GDPR per un utente',\n operationId: 'setGdpr',\n })\n @ApiParam({\n name: 'codiceUtente',\n description: \"Codice identificativo dell'utente che accetta il GDPR\",\n required: true,\n example: 123,\n })\n @ApiResponse({\n status: 200,\n description: 'Consenso GDPR impostato con successo',\n type: ActionResponse,\n })\n @ApiResponse({ status: 400, description: 'Errore nella richiesta', type: ErrorResponse })\n @ApiResponse({ status: 403, description: 'Operazione non autorizzata', type: ErrorResponse })\n @ApiBearerAuth()\n @UseGuards(JwtSimpleGuard)\n @Patch('set-gdpr/:codiceUtente')\n async setGdpr(\n @Req() request: Request,\n @Param('codiceUtente', ParseIntPipe) codiceUtente: number,\n @Res() res: Response,\n ) {\n try {\n const authenticatedUser = getAuthenticatedAccessiUser(request);\n ensureSelfOrSuperUser(\n authenticatedUser,\n codiceUtente,\n 'Puoi impostare il GDPR solo sul tuo utente.',\n );\n if (authenticatedUser.codiceUtente !== codiceUtente) {\n await this.ensureManageableTarget(authenticatedUser, codiceUtente);\n }\n\n await this.userService.setGdpr(codiceUtente);\n return RestUtilities.sendOKMessage(res, `L'utente ${codiceUtente} ha accettato il GDPR.`);\n } catch (error) {\n return this.sendControllerError(res, error);\n }\n }\n}\n"]}
|
|
@@ -17,3 +17,10 @@ export declare class BootstrapAdminResultDto {
|
|
|
17
17
|
export declare class BootstrapAdminResponse extends BaseResponse {
|
|
18
18
|
Result: BootstrapAdminResultDto;
|
|
19
19
|
}
|
|
20
|
+
/** Stato del bootstrap admin: la console mostra la sezione solo se abilitato. */
|
|
21
|
+
export declare class AdminBootstrapStatusResult {
|
|
22
|
+
enabled: boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare class AdminBootstrapStatusResponse extends BaseResponse {
|
|
25
|
+
Result: AdminBootstrapStatusResult;
|
|
26
|
+
}
|
|
@@ -9,7 +9,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.BootstrapAdminResponse = exports.BootstrapAdminResultDto = exports.BootstrapAdminRequest = void 0;
|
|
12
|
+
exports.AdminBootstrapStatusResponse = exports.AdminBootstrapStatusResult = exports.BootstrapAdminResponse = exports.BootstrapAdminResultDto = exports.BootstrapAdminRequest = void 0;
|
|
13
13
|
const swagger_1 = require("@nestjs/swagger");
|
|
14
14
|
const class_transformer_1 = require("class-transformer");
|
|
15
15
|
const class_validator_1 = require("class-validator");
|
|
@@ -80,4 +80,21 @@ __decorate([
|
|
|
80
80
|
(0, class_transformer_1.Type)(() => BootstrapAdminResultDto),
|
|
81
81
|
__metadata("design:type", BootstrapAdminResultDto)
|
|
82
82
|
], BootstrapAdminResponse.prototype, "Result", void 0);
|
|
83
|
+
/** Stato del bootstrap admin: la console mostra la sezione solo se abilitato. */
|
|
84
|
+
class AdminBootstrapStatusResult {
|
|
85
|
+
}
|
|
86
|
+
exports.AdminBootstrapStatusResult = AdminBootstrapStatusResult;
|
|
87
|
+
__decorate([
|
|
88
|
+
(0, swagger_1.ApiProperty)({ example: false, description: 'True se adminBootstrap e abilitato in questa istanza.' }),
|
|
89
|
+
__metadata("design:type", Boolean)
|
|
90
|
+
], AdminBootstrapStatusResult.prototype, "enabled", void 0);
|
|
91
|
+
class AdminBootstrapStatusResponse extends BaseResponse_1.BaseResponse {
|
|
92
|
+
}
|
|
93
|
+
exports.AdminBootstrapStatusResponse = AdminBootstrapStatusResponse;
|
|
94
|
+
__decorate([
|
|
95
|
+
(0, swagger_1.ApiProperty)({ type: AdminBootstrapStatusResult }),
|
|
96
|
+
(0, class_validator_1.ValidateNested)(),
|
|
97
|
+
(0, class_transformer_1.Type)(() => AdminBootstrapStatusResult),
|
|
98
|
+
__metadata("design:type", AdminBootstrapStatusResult)
|
|
99
|
+
], AdminBootstrapStatusResponse.prototype, "Result", void 0);
|
|
83
100
|
//# sourceMappingURL=AdminBootstrapDtos.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdminBootstrapDtos.js","sourceRoot":"","sources":["../../../src/accessi-module/Dtos/AdminBootstrapDtos.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAmE;AACnE,yDAAyC;AACzC,qDAAkF;AAClF,iDAA8C;AAE9C,2FAA2F;AAC3F,MAAa,qBAAqB;CA4BjC;AA5BD,sDA4BC;AAzBC;IAFC,IAAA,qBAAW,EAAC,EAAE,WAAW,EAAE,2DAA2D,EAAE,CAAC;IACzF,IAAA,0BAAQ,GAAE;;oDACI;AAIf;IAFC,IAAA,qBAAW,EAAC,EAAE,OAAO,EAAE,mBAAmB,EAAE,CAAC;IAC7C,IAAA,0BAAQ,GAAE;;oDACI;AAKf;IAHC,IAAA,6BAAmB,EAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;IACzC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;mDACG;AAKd;IAHC,IAAA,6BAAmB,EAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;IACzC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;sDACM;AAKjB;IAHC,IAAA,6BAAmB,EAAC,EAAE,WAAW,EAAE,+EAA+E,EAAE,CAAC;IACrH,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;uDACO;AAKlB;IAHC,IAAA,6BAAmB,EAAC,EAAE,WAAW,EAAE,kEAAkE,EAAE,CAAC;IACxG,IAAA,4BAAU,GAAE;IACZ,IAAA,2BAAS,GAAE;;wDACQ;AAGtB,MAAa,uBAAuB;CAYnC;AAZD,0DAYC;AAVC;IADC,IAAA,qBAAW,EAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;6DACN;AAGtB;IADC,IAAA,qBAAW,EAAC,EAAE,OAAO,EAAE,mBAAmB,EAAE,CAAC;;sDAC/B;AAGf;IADC,IAAA,6BAAmB,EAAC,EAAE,WAAW,EAAE,0EAA0E,EAAE,CAAC;;yDAC/F;AAGlB;IADC,IAAA,qBAAW,EAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;kEACH;AAG9B,MAAa,sBAAuB,SAAQ,2BAAY;CAKvD;AALD,wDAKC;AADC;IAHC,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,uBAAuB,EAAE,CAAC;IAC9C,IAAA,gCAAc,GAAE;IAChB,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,uBAAuB,CAAC;8BAC3B,uBAAuB;sDAAC","sourcesContent":["import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';\nimport { Type } from 'class-transformer';\nimport { IsBoolean, IsOptional, IsString, ValidateNested } from 'class-validator';\nimport { BaseResponse } from './BaseResponse';\n\n/** Richiesta di bootstrap del primo admin: il token e quello stampato nel log di avvio. */\nexport class BootstrapAdminRequest {\n @ApiProperty({ description: 'Token di bootstrap stampato nel log di avvio del backend.' })\n @IsString()\n token!: string;\n\n @ApiProperty({ example: 'admin@example.com' })\n @IsString()\n email!: string;\n\n @ApiPropertyOptional({ example: 'Mario' })\n @IsOptional()\n @IsString()\n nome?: string;\n\n @ApiPropertyOptional({ example: 'Rossi' })\n @IsOptional()\n @IsString()\n cognome?: string;\n\n @ApiPropertyOptional({ description: 'Password da impostare. Se assente viene generata e restituita una sola volta.' })\n @IsOptional()\n @IsString()\n password?: string;\n\n @ApiPropertyOptional({ description: 'Crea anche un superutente (tutte le abilitazioni). Default true.' })\n @IsOptional()\n @IsBoolean()\n superUser?: boolean;\n}\n\nexport class BootstrapAdminResultDto {\n @ApiProperty({ example: 1 })\n codiceUtente!: number;\n\n @ApiProperty({ example: 'admin@example.com' })\n email!: string;\n\n @ApiPropertyOptional({ description: 'Password generata: presente solo se non e stata fornita nella richiesta.' })\n password?: string;\n\n @ApiProperty({ example: true })\n passwordGenerated!: boolean;\n}\n\nexport class BootstrapAdminResponse extends BaseResponse {\n @ApiProperty({ type: BootstrapAdminResultDto })\n @ValidateNested()\n @Type(() => BootstrapAdminResultDto)\n Result!: BootstrapAdminResultDto;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"AdminBootstrapDtos.js","sourceRoot":"","sources":["../../../src/accessi-module/Dtos/AdminBootstrapDtos.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAmE;AACnE,yDAAyC;AACzC,qDAAkF;AAClF,iDAA8C;AAE9C,2FAA2F;AAC3F,MAAa,qBAAqB;CA4BjC;AA5BD,sDA4BC;AAzBC;IAFC,IAAA,qBAAW,EAAC,EAAE,WAAW,EAAE,2DAA2D,EAAE,CAAC;IACzF,IAAA,0BAAQ,GAAE;;oDACI;AAIf;IAFC,IAAA,qBAAW,EAAC,EAAE,OAAO,EAAE,mBAAmB,EAAE,CAAC;IAC7C,IAAA,0BAAQ,GAAE;;oDACI;AAKf;IAHC,IAAA,6BAAmB,EAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;IACzC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;mDACG;AAKd;IAHC,IAAA,6BAAmB,EAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;IACzC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;sDACM;AAKjB;IAHC,IAAA,6BAAmB,EAAC,EAAE,WAAW,EAAE,+EAA+E,EAAE,CAAC;IACrH,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;uDACO;AAKlB;IAHC,IAAA,6BAAmB,EAAC,EAAE,WAAW,EAAE,kEAAkE,EAAE,CAAC;IACxG,IAAA,4BAAU,GAAE;IACZ,IAAA,2BAAS,GAAE;;wDACQ;AAGtB,MAAa,uBAAuB;CAYnC;AAZD,0DAYC;AAVC;IADC,IAAA,qBAAW,EAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;6DACN;AAGtB;IADC,IAAA,qBAAW,EAAC,EAAE,OAAO,EAAE,mBAAmB,EAAE,CAAC;;sDAC/B;AAGf;IADC,IAAA,6BAAmB,EAAC,EAAE,WAAW,EAAE,0EAA0E,EAAE,CAAC;;yDAC/F;AAGlB;IADC,IAAA,qBAAW,EAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;kEACH;AAG9B,MAAa,sBAAuB,SAAQ,2BAAY;CAKvD;AALD,wDAKC;AADC;IAHC,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,uBAAuB,EAAE,CAAC;IAC9C,IAAA,gCAAc,GAAE;IAChB,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,uBAAuB,CAAC;8BAC3B,uBAAuB;sDAAC;AAGnC,iFAAiF;AACjF,MAAa,0BAA0B;CAGtC;AAHD,gEAGC;AADC;IADC,IAAA,qBAAW,EAAC,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,uDAAuD,EAAE,CAAC;;2DACpF;AAGpB,MAAa,4BAA6B,SAAQ,2BAAY;CAK7D;AALD,oEAKC;AADC;IAHC,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,0BAA0B,EAAE,CAAC;IACjD,IAAA,gCAAc,GAAE;IAChB,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,0BAA0B,CAAC;8BAC9B,0BAA0B;4DAAC","sourcesContent":["import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';\nimport { Type } from 'class-transformer';\nimport { IsBoolean, IsOptional, IsString, ValidateNested } from 'class-validator';\nimport { BaseResponse } from './BaseResponse';\n\n/** Richiesta di bootstrap del primo admin: il token e quello stampato nel log di avvio. */\nexport class BootstrapAdminRequest {\n @ApiProperty({ description: 'Token di bootstrap stampato nel log di avvio del backend.' })\n @IsString()\n token!: string;\n\n @ApiProperty({ example: 'admin@example.com' })\n @IsString()\n email!: string;\n\n @ApiPropertyOptional({ example: 'Mario' })\n @IsOptional()\n @IsString()\n nome?: string;\n\n @ApiPropertyOptional({ example: 'Rossi' })\n @IsOptional()\n @IsString()\n cognome?: string;\n\n @ApiPropertyOptional({ description: 'Password da impostare. Se assente viene generata e restituita una sola volta.' })\n @IsOptional()\n @IsString()\n password?: string;\n\n @ApiPropertyOptional({ description: 'Crea anche un superutente (tutte le abilitazioni). Default true.' })\n @IsOptional()\n @IsBoolean()\n superUser?: boolean;\n}\n\nexport class BootstrapAdminResultDto {\n @ApiProperty({ example: 1 })\n codiceUtente!: number;\n\n @ApiProperty({ example: 'admin@example.com' })\n email!: string;\n\n @ApiPropertyOptional({ description: 'Password generata: presente solo se non e stata fornita nella richiesta.' })\n password?: string;\n\n @ApiProperty({ example: true })\n passwordGenerated!: boolean;\n}\n\nexport class BootstrapAdminResponse extends BaseResponse {\n @ApiProperty({ type: BootstrapAdminResultDto })\n @ValidateNested()\n @Type(() => BootstrapAdminResultDto)\n Result!: BootstrapAdminResultDto;\n}\n\n/** Stato del bootstrap admin: la console mostra la sezione solo se abilitato. */\nexport class AdminBootstrapStatusResult {\n @ApiProperty({ example: false, description: 'True se adminBootstrap e abilitato in questa istanza.' })\n enabled!: boolean;\n}\n\nexport class AdminBootstrapStatusResponse extends BaseResponse {\n @ApiProperty({ type: AdminBootstrapStatusResult })\n @ValidateNested()\n @Type(() => AdminBootstrapStatusResult)\n Result!: AdminBootstrapStatusResult;\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BaseResponse } from './BaseResponse';
|
|
2
|
+
/** Esito dell'emissione di un ticket di ingresso alla console. */
|
|
3
|
+
export declare class ConsoleEntryTicketResult {
|
|
4
|
+
ticket: string;
|
|
5
|
+
expiresInSeconds: number;
|
|
6
|
+
}
|
|
7
|
+
export declare class ConsoleEntryTicketResponse extends BaseResponse {
|
|
8
|
+
Result: ConsoleEntryTicketResult;
|
|
9
|
+
}
|
|
10
|
+
/** Body dello scambio del ticket. */
|
|
11
|
+
export declare class ConsoleEntryExchangeRequest {
|
|
12
|
+
ticket: string;
|
|
13
|
+
}
|
|
14
|
+
/** Sessione Accessi restituita dallo scambio, da usare come Bearer nella console. */
|
|
15
|
+
export declare class ConsoleEntryTokenResult {
|
|
16
|
+
value: string;
|
|
17
|
+
type: string;
|
|
18
|
+
}
|
|
19
|
+
export declare class ConsoleEntrySessionResult {
|
|
20
|
+
token: ConsoleEntryTokenResult;
|
|
21
|
+
}
|
|
22
|
+
export declare class ConsoleEntrySessionResponse extends BaseResponse {
|
|
23
|
+
Result: ConsoleEntrySessionResult;
|
|
24
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ConsoleEntrySessionResponse = exports.ConsoleEntrySessionResult = exports.ConsoleEntryTokenResult = exports.ConsoleEntryExchangeRequest = exports.ConsoleEntryTicketResponse = exports.ConsoleEntryTicketResult = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const class_validator_1 = require("class-validator");
|
|
15
|
+
const BaseResponse_1 = require("./BaseResponse");
|
|
16
|
+
/** Esito dell'emissione di un ticket di ingresso alla console. */
|
|
17
|
+
class ConsoleEntryTicketResult {
|
|
18
|
+
}
|
|
19
|
+
exports.ConsoleEntryTicketResult = ConsoleEntryTicketResult;
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, swagger_1.ApiProperty)({
|
|
22
|
+
description: 'Ticket monouso da usare in /api/accessi/console#entry=<ticket>.',
|
|
23
|
+
example: 'f'.repeat(64),
|
|
24
|
+
}),
|
|
25
|
+
__metadata("design:type", String)
|
|
26
|
+
], ConsoleEntryTicketResult.prototype, "ticket", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, swagger_1.ApiProperty)({ description: 'Validita del ticket in secondi.', example: 60 }),
|
|
29
|
+
__metadata("design:type", Number)
|
|
30
|
+
], ConsoleEntryTicketResult.prototype, "expiresInSeconds", void 0);
|
|
31
|
+
class ConsoleEntryTicketResponse extends BaseResponse_1.BaseResponse {
|
|
32
|
+
}
|
|
33
|
+
exports.ConsoleEntryTicketResponse = ConsoleEntryTicketResponse;
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, swagger_1.ApiProperty)({ type: ConsoleEntryTicketResult }),
|
|
36
|
+
__metadata("design:type", ConsoleEntryTicketResult)
|
|
37
|
+
], ConsoleEntryTicketResponse.prototype, "Result", void 0);
|
|
38
|
+
/** Body dello scambio del ticket. */
|
|
39
|
+
class ConsoleEntryExchangeRequest {
|
|
40
|
+
}
|
|
41
|
+
exports.ConsoleEntryExchangeRequest = ConsoleEntryExchangeRequest;
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, swagger_1.ApiProperty)({
|
|
44
|
+
description: 'Ticket monouso restituito da POST /api/accessi/console/entry.',
|
|
45
|
+
example: 'f'.repeat(64),
|
|
46
|
+
}),
|
|
47
|
+
(0, class_validator_1.IsString)({ message: 'Il ticket deve essere una stringa.' }),
|
|
48
|
+
(0, class_validator_1.Length)(64, 64, { message: 'Il ticket deve essere lungo 64 caratteri.' }),
|
|
49
|
+
__metadata("design:type", String)
|
|
50
|
+
], ConsoleEntryExchangeRequest.prototype, "ticket", void 0);
|
|
51
|
+
/** Sessione Accessi restituita dallo scambio, da usare come Bearer nella console. */
|
|
52
|
+
class ConsoleEntryTokenResult {
|
|
53
|
+
}
|
|
54
|
+
exports.ConsoleEntryTokenResult = ConsoleEntryTokenResult;
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, swagger_1.ApiProperty)({ description: 'JWT Accessi.', example: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...' }),
|
|
57
|
+
__metadata("design:type", String)
|
|
58
|
+
], ConsoleEntryTokenResult.prototype, "value", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
(0, swagger_1.ApiProperty)({ description: 'Schema di autorizzazione.', example: 'Bearer' }),
|
|
61
|
+
__metadata("design:type", String)
|
|
62
|
+
], ConsoleEntryTokenResult.prototype, "type", void 0);
|
|
63
|
+
class ConsoleEntrySessionResult {
|
|
64
|
+
}
|
|
65
|
+
exports.ConsoleEntrySessionResult = ConsoleEntrySessionResult;
|
|
66
|
+
__decorate([
|
|
67
|
+
(0, swagger_1.ApiProperty)({ type: ConsoleEntryTokenResult }),
|
|
68
|
+
__metadata("design:type", ConsoleEntryTokenResult)
|
|
69
|
+
], ConsoleEntrySessionResult.prototype, "token", void 0);
|
|
70
|
+
class ConsoleEntrySessionResponse extends BaseResponse_1.BaseResponse {
|
|
71
|
+
}
|
|
72
|
+
exports.ConsoleEntrySessionResponse = ConsoleEntrySessionResponse;
|
|
73
|
+
__decorate([
|
|
74
|
+
(0, swagger_1.ApiProperty)({ type: ConsoleEntrySessionResult }),
|
|
75
|
+
__metadata("design:type", ConsoleEntrySessionResult)
|
|
76
|
+
], ConsoleEntrySessionResponse.prototype, "Result", void 0);
|
|
77
|
+
//# sourceMappingURL=ConsoleEntryDtos.js.map
|
|
@@ -0,0 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rC;AAHD,8DAGC;AADC;IADC,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,uBAAuB,EAAE,CAAC;8BACvC,uBAAuB;wDAAC;AAGlC,MAAa,2BAA4B,SAAQ,2BAAY;CAG5D;AAHD,kEAGC;AADC;IADC,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,yBAAyB,EAAE,CAAC;8BACxC,yBAAyB;2DAAC","sourcesContent":["import { ApiProperty } from '@nestjs/swagger';\nimport { IsString, Length } from 'class-validator';\nimport { BaseResponse } from './BaseResponse';\n\n/** Esito dell'emissione di un ticket di ingresso alla console. */\nexport class ConsoleEntryTicketResult {\n @ApiProperty({\n description: 'Ticket monouso da usare in /api/accessi/console#entry=<ticket>.',\n example: 'f'.repeat(64),\n })\n ticket!: string;\n\n @ApiProperty({ description: 'Validita del ticket in secondi.', example: 60 })\n expiresInSeconds!: number;\n}\n\nexport class ConsoleEntryTicketResponse extends BaseResponse {\n @ApiProperty({ type: ConsoleEntryTicketResult })\n Result!: ConsoleEntryTicketResult;\n}\n\n/** Body dello scambio del ticket. */\nexport class ConsoleEntryExchangeRequest {\n @ApiProperty({\n description: 'Ticket monouso restituito da POST /api/accessi/console/entry.',\n example: 'f'.repeat(64),\n })\n @IsString({ message: 'Il ticket deve essere una stringa.' })\n @Length(64, 64, { message: 'Il ticket deve essere lungo 64 caratteri.' })\n ticket!: string;\n}\n\n/** Sessione Accessi restituita dallo scambio, da usare come Bearer nella console. */\nexport class ConsoleEntryTokenResult {\n @ApiProperty({ description: 'JWT Accessi.', example: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...' })\n value!: string;\n\n @ApiProperty({ description: 'Schema di autorizzazione.', example: 'Bearer' })\n type!: string;\n}\n\nexport class ConsoleEntrySessionResult {\n @ApiProperty({ type: ConsoleEntryTokenResult })\n token!: ConsoleEntryTokenResult;\n}\n\nexport class ConsoleEntrySessionResponse extends BaseResponse {\n @ApiProperty({ type: ConsoleEntrySessionResult })\n Result!: ConsoleEntrySessionResult;\n}\n"]}
|
|
@@ -52,7 +52,7 @@ __decorate([
|
|
|
52
52
|
], GroupWithMenusEntity.prototype, "enabled", void 0);
|
|
53
53
|
__decorate([
|
|
54
54
|
(0, swagger_1.ApiProperty)({
|
|
55
|
-
description: "Lista dei
|
|
55
|
+
description: "Lista dei menù associati al gruppo.",
|
|
56
56
|
type: [GetMenusResponse_1.MenuEntity]
|
|
57
57
|
}),
|
|
58
58
|
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GetGroupsWithMenusResponse.js","sourceRoot":"","sources":["../../../src/accessi-module/Dtos/GetGroupsWithMenusResponse.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAmE;AACnE,iDAA8C;AAC9C,qDAA0D;AAC1D,yDAAyC;AACzC,yDAAgD;AAIhD,MAAa,oBAAoB;CAqChC;AArCD,oDAqCC;AA/BG;IALC,IAAA,qBAAW,EAAC;QACT,WAAW,EAAE,4BAA4B;QACzC,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,OAAO;KACnB,CAAC;;0DACoB;AAOtB;IALC,IAAA,qBAAW,EAAC;QACT,WAAW,EAAE,yBAAyB;QACtC,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,kBAAkB;KAC9B,CAAC;;+DACyB;AAO3B;IALC,IAAA,qBAAW,EAAC;QACT,WAAW,EAAE,oBAAoB;QACjC,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,CAAC;KACb,CAAC;;0DACoB;AAOtB;IALC,IAAA,6BAAmB,EAAC;QACjB,WAAW,EAAE,2CAA2C;QACxD,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,IAAI;KAChB,CAAC;;qDACgB;AASlB;IAPC,IAAA,qBAAW,EAAC;QACT,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"GetGroupsWithMenusResponse.js","sourceRoot":"","sources":["../../../src/accessi-module/Dtos/GetGroupsWithMenusRespon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{ BaseResponse } from \"./BaseResponse\";\nimport { IsArray, ValidateNested } from \"class-validator\";\nimport { Type } from \"class-transformer\";\nimport { MenuEntity } from \"./GetMenusResponse\";\n\n\n\nexport class GroupWithMenusEntity {\n @ApiProperty({\n description: \"Codice univoco del gruppo.\",\n type: String,\n example: \"GRP01\"\n })\n codiceGruppo!: string;\n\n @ApiProperty({\n description: \"Descrizione del gruppo.\",\n type: String,\n example: \"Gestione Accessi\"\n })\n descrizioneGruppo!: string;\n\n @ApiProperty({\n description: \"Ordine del gruppo.\",\n type: Number,\n example: 1\n })\n ordineGruppo!: number;\n\n @ApiPropertyOptional({\n description: \"Flag che indica se il gruppo e abilitato.\",\n type: Boolean,\n example: true\n })\n enabled?: boolean;\n\n @ApiProperty({\n description: \"Lista dei menù associati al gruppo.\",\n type: [MenuEntity]\n })\n @ValidateNested({ each: true })\n @Type(() => MenuEntity)\n @IsArray()\n menus!: MenuEntity[];\n}\n\nexport class GetGroupsWithMenusResponse extends BaseResponse {\n @ApiProperty({ type: [GroupWithMenusEntity] })\n @ValidateNested({ each: true })\n @Type(() => GroupWithMenusEntity)\n Result!: GroupWithMenusEntity[];\n}\n"]}
|