Unverified Commit aca573fd authored by Le Roy Loïc's avatar Le Roy Loïc Committed by GitHub
Browse files

Merge pull request #57 from ProgrammeVitam/vas_api_supervision_pr

[VAS] Journal des Opérations
parents 75e244bf 09a6f084
......@@ -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 #
##########################################
......
......@@ -105,6 +105,13 @@ customer-init:
- ROLE_GET_AUDITS
- ROLE_RUN_AUDITS
- name: Profil Journal des Opérations
description: Gestion des applications des Journaux des Opérations
app-name: LOGBOOK_OPERATION_APP
level:
roles:
- ROLE_LOGBOOKS
#- name: profileName
# description: desc
# level: 1
......
serverHost: access-external.service.consul
serverPort: 8444
secure: true
sslConfiguration :
keystore :
- keyPath: src/main/config/dev-vitam/keystore_ihm-demo.p12
keyPassword: azerty4
truststore :
- keyPath: src/main/config/dev-vitam/truststore_ihm-demo.jks
keyPassword: azerty10
hostnameVerification: true
serverHost: ingest-external.service.consul
serverPort: 8443
secure: true
sslConfiguration :
keystore :
- keyPath: src/main/config/dev-vitam/keystore_ihm-demo.p12
keyPassword: azerty4
truststore :
- keyPath: src/main/config/dev-vitam/truststore_ihm-demo.jks
keyPassword: azerty10
hostnameVerification: true
serverHost: access-external.service.consul
serverPort: 8444
secure: true
sslConfiguration :
keystore :
- keyPath: src/main/config/dev-vitam/keystore_ihm-demo.p12
keyPassword: FaKzJrnQFxFe3D2d
truststore :
- keyPath: src/main/config/dev-vitam/truststore_ihm-demo.jks
keyPassword: K8GeuGNjfbFB66JG
hostnameVerification: true
serverHost: ingest-external.service.consul
serverPort: 8443
secure: true
sslConfiguration :
keystore :
- keyPath: src/main/config/dev-vitam/keystore_ihm-demo.p12
keyPassword: azerty4
truststore :
- keyPath: src/main/config/dev-vitam/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;
......@@ -325,7 +325,6 @@ public class ServicesData {
//------------------------------ PROFILES (ARCHIVE PROFILES) --------------------------------------
public static final String ROLE_GET_ARCHIVE_PROFILES = ROLE_PREFIX + "GET_ARCHIVE_PROFILES";
//@formatter:off
/**
......
......@@ -105,6 +105,13 @@ customer-init:
- ROLE_GET_AUDITS
- ROLE_RUN_AUDITS
- name: Profil Journal des Opérations
description: Gestion des applications des Journaux des Opérations
app-name: LOGBOOK_OPERATION_APP
level:
roles:
- ROLE_LOGBOOKS
#- name: profileName
# description: desc
# level: 1
......
......@@ -199,7 +199,8 @@ db.groups.insert({
"system_audit",
"system_secure",
"system_dsl",
"system_probative_value"
"system_probative_value",
"system_logbook_operation_profile"
],
"readonly": false,
"level": "",
......
......@@ -407,6 +407,24 @@ db.profiles.insert({
]
});
db.profiles.insert({
"_id": "system_logbook_operation_profile",
"identifier" : NumberInt(maxIdProfile++),
"name": "Journal des Opérations",
"description": "Logbook Operation Profile api",
"tenantIdentifier": NumberInt({{ vitamui_platform_informations.proof_tenant }}),
"applicationName": "LOGBOOK_OPERATION_APP",
"level": "",
"enabled": true,
"readonly": false,
"customerId": "system_customer",
"roles": [
{
"name": "ROLE_LOGBOOKS"
}
]
});
db.sequences.updateOne({
"_id": "profile_identifier"
}, {
......@@ -436,10 +454,11 @@ db.groups.updateOne( {
"system_audit",
"system_secure",
"system_dsl",
"system_probative_value"
"system_probative_value",
"system_logbook_operation_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" : "LOGBOOK_OPERATION_APP",
{% if vitamui.referential.base_url is defined %}
"url": "{{ vitamui.referential.base_url }}/logbook-operation",
{% else %}
"url": "{{ url_prefix }}/referential/logbook-operation",
{% endif %}
"icon": "vitamui-icon vitamui-icon-api-supervision",
"name": "Journal des Opérations",
"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_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[] {
......
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