Commit 75c791e2 authored by EL HAJJIOUI Nabil's avatar EL HAJJIOUI Nabil
Browse files

[VAS] Supervision des APIs

parent 75e244bf
......@@ -227,6 +227,14 @@ deployment/playbooks/templates/vitamui/conf/*/*.jks
# Imported vitamui app vitam truststore
deployment/playbooks/templates/vitamui/conf/*/*.p12
# Vitam development configuration
###################################
# Vitam development configuration #
###################################
api/api-referential/referential-internal/src/main/config/dev-vitam/*
api/api-iam/iam-internal/src/main/config/dev-vitam/*
##########################################
# Mongo workspace entry-point #
##########################################
......
......@@ -3,9 +3,9 @@ serverPort: 8444
secure: true
sslConfiguration :
keystore :
- keyPath: src/main/config/dev-vitam/keystore_ihm-demo.p12
- keyPath: keystore_ihm-demo.p12
keyPassword: azerty4
truststore :
- keyPath: src/main/config/dev-vitam/truststore_ihm-demo.jks
- keyPath: truststore_ihm-demo.jks
keyPassword: azerty10
hostnameVerification: true
......@@ -3,9 +3,9 @@ serverPort: 8443
secure: true
sslConfiguration :
keystore :
- keyPath: src/main/config/dev-vitam/keystore_ihm-demo.p12
- keyPath: keystore_ihm-demo.p12
keyPassword: azerty4
truststore :
- keyPath: src/main/config/dev-vitam/truststore_ihm-demo.jks
- keyPath: truststore_ihm-demo.jks
keyPassword: azerty10
hostnameVerification: true
......@@ -3,9 +3,9 @@ serverPort: 8444
secure: true
sslConfiguration :
keystore :
- keyPath: src/main/config/dev-vitam/keystore_ihm-demo.p12
keyPassword: FaKzJrnQFxFe3D2d
- keyPath: keystore_ihm-demo.p12
keyPassword: azerty4
truststore :
- keyPath: src/main/config/dev-vitam/truststore_ihm-demo.jks
keyPassword: K8GeuGNjfbFB66JG
- keyPath: truststore_ihm-demo.jks
keyPassword: azerty10
hostnameVerification: true
......@@ -3,9 +3,9 @@ serverPort: 8443
secure: true
sslConfiguration :
keystore :
- keyPath: src/main/config/dev-vitam/keystore_ihm-demo.p12
- keyPath: keystore_ihm-demo.p12
keyPassword: azerty4
truststore :
- keyPath: src/main/config/dev-vitam/truststore_ihm-demo.jks
- keyPath: truststore_ihm-demo.jks
keyPassword: azerty10
hostnameVerification: true
......@@ -310,8 +310,8 @@ public class ServicesData {
public static final String ROLE_RUN_AUDITS = ROLE_PREFIX + "RUN_" + SERVICE_AUDITS;
//------------------------------------- PROBATIVE_VALUE --------------------------------------------
//------------------------------------- PROBATIVE_VALUE --------------------------------------------
public static final String SERVICE_PROBATIVE_VALUE = "PROBATIVE_VALUE";
public static final String ROLE_RUN_PROBATIVE_VALUE = "ROLE_RUN_" + SERVICE_PROBATIVE_VALUE;
......@@ -326,6 +326,14 @@ public class ServicesData {
public static final String ROLE_GET_ARCHIVE_PROFILES = ROLE_PREFIX + "GET_ARCHIVE_PROFILES";
//------------------------------------ API SUPERVISION -----------------------------------------
public static final String SERVICE_API_SUPERVISION_ROLE = "SUPERVISION_API";
public static final String ROLE_CREATE_SUPERVISION_ROLE = CREATE_ROLE_PREFIX + SERVICE_API_SUPERVISION_ROLE;
public static final String ROLE_GET_SUPERVISION_ROLE = GET_ROLE_PREFIX + SERVICE_API_SUPERVISION_ROLE;
public static final String ROLE_GET_ALL_SUPERVISION_ROLE = GET_ROLE_PREFIX + "ALL_" + SERVICE_API_SUPERVISION_ROLE;
//@formatter:off
/**
......@@ -404,7 +412,11 @@ public class ServicesData {
ROLE_RUN_AUDITS,
ROLE_GET_OPERATIONS,
ROLE_RUN_PROBATIVE_VALUE
ROLE_RUN_PROBATIVE_VALUE,
ROLE_CREATE_SUPERVISION_ROLE,
ROLE_GET_SUPERVISION_ROLE,
ROLE_GET_ALL_SUPERVISION_ROLE
);
......@@ -507,7 +519,11 @@ public class ServicesData {
ROLE_DELETE_ONTOLOGIES,
ROLE_RUN_AUDITS,
ROLE_RUN_PROBATIVE_VALUE
ROLE_RUN_PROBATIVE_VALUE,
ROLE_CREATE_SUPERVISION_ROLE,
ROLE_GET_SUPERVISION_ROLE,
ROLE_GET_ALL_SUPERVISION_ROLE
);
//@formatter:on
......
......@@ -199,7 +199,8 @@ db.groups.insert({
"system_audit",
"system_secure",
"system_dsl",
"system_probative_value"
"system_probative_value",
"system_supervision_api_profile"
],
"readonly": false,
"level": "",
......
......@@ -407,6 +407,33 @@ db.profiles.insert({
]
});
db.profiles.insert({
"_id": "system_supervision_api_profile",
"identifier" : NumberInt(maxIdProfile++),
"name": "Supervision API Profile",
"description": "Supervision Profile api",
"tenantIdentifier": NumberInt({{ vitamui_platform_informations.proof_tenant }}),
"applicationName": "SUPERVISION_API_APP",
"level": "",
"enabled": true,
"readonly": false,
"customerId": "system_customer",
"roles": [
{
"name": "ROLE_CREATE_SUPERVISION_API"
},
{
"name": "ROLE_GET_SUPERVISION_API"
},
{
"name": "ROLE_GET_ALL_SUPERVISION_API"
},
{
"name": "ROLE_LOGBOOKS"
}
]
});
db.sequences.updateOne({
"_id": "profile_identifier"
}, {
......@@ -436,10 +463,11 @@ db.groups.updateOne( {
"system_audit",
"system_secure",
"system_dsl",
"system_probative_value"
"system_probative_value",
"system_supervision_api_profile"
]
}
}
});
print("END 207_iam_ref.js");
\ No newline at end of file
print("END 207_iam_ref.js");
......@@ -202,4 +202,22 @@ db.applications.insert({
"target" : "_self"
});
print("END 208_application_ref.js");
\ No newline at end of file
db.applications.insert({
"identifier" : "SUPERVISION_API_APP",
{% if vitamui.referential.base_url is defined %}
"url": "{{ vitamui.referential.base_url }}/supervision-api",
{% else %}
"url": "{{ url_prefix }}/referential/supervision-api",
{% endif %}
"icon": "vitamui-icon vitamui-icon-api-supervision",
"name": "Supervision des APIs",
"category": "referential",
"position": NumberInt(16),
"hasCustomerList": false,
"hasTenantList": false,
"hasHighlight": false,
"tooltip": "Consultation des journaux des opérations d'entrées, de bases, d'éliminations",
"target": "_self"
});
print("END 208_application_ref.js");
......@@ -24,8 +24,10 @@ db.contexts.insert({
"ROLE_GET_FILE_FORMATS", "ROLE_UPDATE_FILE_FORMATS", "ROLE_CREATE_FILE_FORMATS", "ROLE_DELETE_FILE_FORMATS",
"ROLE_GET_CONTEXTS", "ROLE_UPDATE_CONTEXTS", "ROLE_CREATE_CONTEXTS",
"ROLE_GET_SECURITY_PROFILES", "ROLE_UPDATE_SECURITY_PROFILES", "ROLE_CREATE_SECURITY_PROFILES", "ROLE_DELETE_SECURITY_PROFILES",
"ROLE_GET_OPERATIONS", "ROLE_RUN_AUDITS", "ROLE_RUN_PROBATIVE_VALUE"
"ROLE_GET_OPERATIONS", "ROLE_RUN_AUDITS", "ROLE_RUN_PROBATIVE_VALUE",
"ROLE_CREATE_SUPERVISION_API", "ROLE_GET_SUPERVISION_API", "ROLE_GET_ALL_SUPERVISION_API", "ROLE_LOGBOOKS"
]
});
print("END 210_security_ref.js");
\ No newline at end of file
print("END 210_security_ref.js");
{
"lockfileVersion": 1
}
......@@ -5431,9 +5431,43 @@
"integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=",
"dev": true
},
"extend-shallow": {
"version": "2.0.1",
"resolved": "https://nexus.teamdlab.com/repository/npm/extend-shallow/-/extend-shallow-2.0.1.tgz",
"integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
"requires": {
"is-extendable": "^0.1.0"
}
},
"is-accessor-descriptor": {
"version": "1.0.0",
"resolved": "https://nexus.teamdlab.com/repository/npm/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz",
"integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==",
"requires": {
"kind-of": "^6.0.0"
}
},
"is-data-descriptor": {
"version": "1.0.0",
"resolved": "https://nexus.teamdlab.com/repository/npm/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz",
"integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==",
"requires": {
"kind-of": "^6.0.0"
}
},
"is-descriptor": {
"version": "1.0.2",
"resolved": "https://nexus.teamdlab.com/repository/npm/is-descriptor/-/is-descriptor-1.0.2.tgz",
"integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==",
"requires": {
"is-accessor-descriptor": "^1.0.0",
"is-data-descriptor": "^1.0.0",
"kind-of": "^6.0.2"
}
},
"qs": {
"version": "6.7.0",
"resolved": "https://nexus.teamdlab.com/repository/npm/qs/-/qs-6.7.0.tgz",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
"integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==",
"dev": true
}
......@@ -5501,56 +5535,10 @@
"requires": {
"is-descriptor": "^1.0.0"
}
}
}
},
"express": {
"version": "4.17.1",
"resolved": "https://nexus.teamdlab.com/repository/npm/express/-/express-4.17.1.tgz",
"integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==",
"dev": true,
"requires": {
"accepts": "~1.3.7",
"array-flatten": "1.1.1",
"body-parser": "1.19.0",
"content-disposition": "0.5.3",
"content-type": "~1.0.4",
"cookie": "0.4.0",
"cookie-signature": "1.0.6",
"debug": "2.6.9",
"depd": "~1.1.2",
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"etag": "~1.8.1",
"finalhandler": "~1.1.2",
"fresh": "0.5.2",
"merge-descriptors": "1.0.1",
"methods": "~1.1.2",
"on-finished": "~2.3.0",
"parseurl": "~1.3.3",
"path-to-regexp": "0.1.7",
"proxy-addr": "~2.0.5",
"qs": "6.7.0",
"range-parser": "~1.2.1",
"safe-buffer": "5.1.2",
"send": "0.17.1",
"serve-static": "1.14.1",
"setprototypeof": "1.1.1",
"statuses": "~1.5.0",
"type-is": "~1.6.18",
"utils-merge": "1.0.1",
"vary": "~1.1.2"
},
"dependencies": {
"array-flatten": {
"version": "1.1.1",
"resolved": "https://nexus.teamdlab.com/repository/npm/array-flatten/-/array-flatten-1.1.1.tgz",
"integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=",
"dev": true
},
"extend-shallow": {
"version": "2.0.1",
"resolved": "https://nexus.teamdlab.com/repository/npm/extend-shallow/-/extend-shallow-2.0.1.tgz",
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
"integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
"dev": true,
"requires": {
......@@ -5559,7 +5547,7 @@
},
"is-accessor-descriptor": {
"version": "1.0.0",
"resolved": "https://nexus.teamdlab.com/repository/npm/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz",
"resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz",
"integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==",
"dev": true,
"requires": {
......@@ -5568,7 +5556,7 @@
},
"is-data-descriptor": {
"version": "1.0.0",
"resolved": "https://nexus.teamdlab.com/repository/npm/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz",
"resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz",
"integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==",
"dev": true,
"requires": {
......@@ -5577,7 +5565,7 @@
},
"is-descriptor": {
"version": "1.0.2",
"resolved": "https://nexus.teamdlab.com/repository/npm/is-descriptor/-/is-descriptor-1.0.2.tgz",
"resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz",
"integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==",
"dev": true,
"requires": {
......@@ -7105,8 +7093,7 @@
"is-extendable": {
"version": "0.1.1",
"resolved": "https://nexus.teamdlab.com/repository/npm/is-extendable/-/is-extendable-0.1.1.tgz",
"integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=",
"dev": true
"integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik="
},
"is-extglob": {
"version": "2.1.1",
......@@ -8064,8 +8051,7 @@
"kind-of": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
"integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==",
"dev": true
"integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw=="
},
"latest-version": {
"version": "5.1.0",
......@@ -8960,15 +8946,6 @@
"universalify": "^0.1.0"
}
},
"rimraf": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
"integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
"dev": true,
"requires": {
"glob": "^7.1.3"
}
},
"rimraf": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
......
......@@ -37,6 +37,7 @@
import { Inject, Injectable } from '@angular/core';
import { BehaviorSubject } from 'rxjs';
import { ApplicationId } from './application-id.enum';
import { WINDOW_LOCATION } from './injection-tokens';
import { AuthUser, Tenant } from './models';
......@@ -111,4 +112,25 @@ export class AuthService {
return tenant;
}
getTenantByAppAndIdentifier(appId: ApplicationId, tenantIdentifier: number): Tenant {
if (!this._user) {
console.error(`AuthService Error: user is null`);
return null;
}
const app = this._user.tenantsByApp.find((appTenants) => appTenants.name === appId);
if (!app) {
console.error(`AuthService Error: can\'t find application with id "${appId}"`);
return null;
}
const tenant = app.tenants.find((t) => t.identifier === tenantIdentifier);
if (!tenant) {
console.error(`AuthService Error: can\'t find tenant with id "${tenantIdentifier}"`);
return null;
}
return tenant;
}
}
......@@ -36,8 +36,8 @@
*/
import { HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { forkJoin, Observable, of } from 'rxjs';
import { catchError, map } from 'rxjs/operators';
import { forkJoin, Observable, of, throwError } from 'rxjs';
import { catchError, map, switchMap } from 'rxjs/operators';
import { LogbookApiService } from '../api/logbook-api.service';
import { Logger } from '../logger/logger';
......@@ -131,6 +131,25 @@ export class LogbookService {
);
}
getOperationById(id: string, tenantIdentifier: number, accessContractId: string): Observable<Event> {
const headers = new HttpHeaders({
'X-Tenant-Id': tenantIdentifier.toString(),
'X-Access-Contract-Id': accessContractId
});
return this.logbookApi.findOperationById(id, headers).pipe(
switchMap((response) => {
if (!response || !response.$results || response.$results.length === 0) {
return throwError(`getOperationById error: no result for operation with id ${id}`);
}
return of(response);
}),
map((response) => response.$results.length === 1 ? LogbookApiService.toEvent(response.$results[0]) : null)
);
}
}
function flattenChildEvents(acc: Event[], current: Event): Event[] {
......
......@@ -643,7 +643,6 @@
"dev": true,
"optional": true,
"requires": {
"bindings": "^1.5.0",
"nan": "^2.12.1"
}
},
......@@ -844,7 +843,7 @@
},
"@angular/material-moment-adapter": {
"version": "8.2.3",
"resolved": "https://nexus.dev.programmevitam.fr/repository/npm-group/@angular/material-moment-adapter/-/material-moment-adapter-8.2.3.tgz",
"resolved": "https://registry.npmjs.org/@angular/material-moment-adapter/-/material-moment-adapter-8.2.3.tgz",
"integrity": "sha512-x0WE9MyQajqzGPYKm8eHcDmWWlwiobOX9rZ+V5uqY80fsvm2czk6TYnc1drFYcPAHIaIcx7je7NYOULPF1rTpw==",
"requires": {
"tslib": "^1.7.1"
......@@ -2958,16 +2957,6 @@
"integrity": "sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow==",
"dev": true
},
"bindings": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
"integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
"dev": true,
"optional": true,
"requires": {
"file-uri-to-path": "1.0.0"
}
},
"blob": {
"version": "0.0.5",
"resolved": "https://nexus.dev.programmevitam.fr/repository/npm-group/blob/-/blob-0.0.5.tgz",
......@@ -5719,13 +5708,6 @@
}
}
},
"file-uri-to-path": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
"integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==",
"dev": true,
"optional": true
},
"fileset": {
"version": "2.0.3",
"resolved": "https://nexus.dev.programmevitam.fr/repository/npm-group/fileset/-/fileset-2.0.3.tgz",
......@@ -12982,6 +12964,7 @@
},
"ui-frontend-common": {
"version": "file:../ui-frontend-common/ui-frontend-common-0.1.0.tgz",
"integrity": "sha512-RluantRkfYcd+qFzfD/DYQ9huDtpU+mCjAi3ugR9csL+q30ssKDjeR1yK7c11n85Sbd9hVMg1R9m0oarN/P0RA==",
"requires": {
"@angular/animations": "8.2.14",
"@angular/cdk": "^8.2.3",
......@@ -13511,7 +13494,6 @@
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
"integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
"dev": true,
"optional": true,
"requires": {
"is-extendable": "^0.1.0"
}
......@@ -13536,7 +13518,6 @@
"dev": true,
"optional": true,
"requires": {
"bindings": "^1.5.0",
"nan": "^2.12.1"
}
},
......@@ -13555,7 +13536,6 @@
"resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz",
"integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=",
"dev": true,
"optional": true,
"requires": {
"kind-of": "^3.0.2"
}
......@@ -13565,7 +13545,6 @@
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
"integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
"dev": true,
"optional": true,
"requires": {
"is-buffer": "^1.1.5"
}
......@@ -13924,7 +13903,6 @@
"dev": true,
"optional": true,
"requires": {
"bindings": "^1.5.0",
"nan": "^2.12.1"
}
},
......
......@@ -111,6 +111,15 @@ const routes: Routes = [
data: {appId: 'PROBATIVE_VALUE_APP'}
},
// =====================================================
// SUPERVISION API
// =====================================================
{
path: 'supervision-api',
loadChildren: () => import('./supervision-api/api-supervision.module').then(m => m.ApiSupervisionModule),
canActivate: [AuthGuard, AppGuard],
data: { appId: 'SUPERVISION_API_APP' }
},
// =====================================================
// DSL
// =====================================================
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment