dts-backoffice-util 14.3.0 → 14.4.1
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/README.md +34 -4
- package/esm2020/lib/services/menu-datasul.service.mjs +59 -4
- package/fesm2015/dts-backoffice-util.mjs +56 -4
- package/fesm2015/dts-backoffice-util.mjs.map +1 -1
- package/fesm2020/dts-backoffice-util.mjs +56 -4
- package/fesm2020/dts-backoffice-util.mjs.map +1 -1
- package/lib/services/menu-datasul.service.d.ts +6 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { Injectable, EventEmitter, Component, ViewChild, Input, Output, Pipe, NgModule } from '@angular/core';
|
|
3
|
-
import { of } from 'rxjs';
|
|
3
|
+
import { of, forkJoin, map as map$1 } from 'rxjs';
|
|
4
4
|
import { map } from 'rxjs/operators';
|
|
5
5
|
import * as i1 from '@angular/common/http';
|
|
6
6
|
import { HttpErrorResponse, HttpClientModule } from '@angular/common/http';
|
|
@@ -244,7 +244,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
244
244
|
}], ctorParameters: function () { return []; } });
|
|
245
245
|
|
|
246
246
|
class MenuDatasulService {
|
|
247
|
-
constructor() {
|
|
247
|
+
constructor(http) {
|
|
248
|
+
this.http = http;
|
|
249
|
+
this.urlMenuPrograms = '/dts/datasul-rest/resources/prg/fwk/v1/menuPrograms/list';
|
|
250
|
+
}
|
|
248
251
|
/**
|
|
249
252
|
* var program = {};
|
|
250
253
|
* program['prg'] = "cd0210";
|
|
@@ -275,12 +278,61 @@ class MenuDatasulService {
|
|
|
275
278
|
window.open(baseUrl);
|
|
276
279
|
}
|
|
277
280
|
}
|
|
281
|
+
programSecurity(programName) {
|
|
282
|
+
let programList = [];
|
|
283
|
+
if (Array.isArray(programName)) {
|
|
284
|
+
programList = programName;
|
|
285
|
+
}
|
|
286
|
+
else {
|
|
287
|
+
if (programName && programName !== '') {
|
|
288
|
+
programList.push(programName);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
if (!programList || programList.length === 0) {
|
|
292
|
+
return of({
|
|
293
|
+
code: 400,
|
|
294
|
+
message: 'Não foi possível validar a Segurança dos Programas, lista vazia !',
|
|
295
|
+
detailedMessage: 'A lista de programas indicados para validação de segurança é inválida ou está vazia.'
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
const aRequest = [];
|
|
299
|
+
programList.forEach(programSearch => {
|
|
300
|
+
aRequest.push(this.http.post(this.urlMenuPrograms, { search: programSearch }));
|
|
301
|
+
});
|
|
302
|
+
return forkJoin(aRequest).pipe(map$1((response) => {
|
|
303
|
+
if (!response) {
|
|
304
|
+
return response;
|
|
305
|
+
}
|
|
306
|
+
if (!Array.isArray(response)) {
|
|
307
|
+
return response;
|
|
308
|
+
}
|
|
309
|
+
const responseReturn = new Array();
|
|
310
|
+
for (let idx = 0; idx < programList.length; idx++) {
|
|
311
|
+
const responseProg = response[idx];
|
|
312
|
+
let hasAcess = false;
|
|
313
|
+
if (responseProg && responseProg.programs &&
|
|
314
|
+
Array.isArray(responseProg.programs) &&
|
|
315
|
+
responseProg.programs.length > 0) {
|
|
316
|
+
responseProg.programs.forEach(prog => {
|
|
317
|
+
if (prog.prg === programList[idx]) {
|
|
318
|
+
hasAcess = true;
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
responseReturn.push({
|
|
323
|
+
programName: programList[idx],
|
|
324
|
+
hasAccess: hasAcess
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
return responseReturn;
|
|
328
|
+
}));
|
|
329
|
+
}
|
|
278
330
|
}
|
|
279
|
-
/** @nocollapse */ MenuDatasulService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: MenuDatasulService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
331
|
+
/** @nocollapse */ MenuDatasulService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: MenuDatasulService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
280
332
|
/** @nocollapse */ MenuDatasulService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: MenuDatasulService });
|
|
281
333
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: MenuDatasulService, decorators: [{
|
|
282
334
|
type: Injectable
|
|
283
|
-
}], ctorParameters: function () { return []; } });
|
|
335
|
+
}], ctorParameters: function () { return [{ type: i1.HttpClient }]; } });
|
|
284
336
|
|
|
285
337
|
class CacheParamsService {
|
|
286
338
|
constructor() {
|