diff --git a/api/api-iam/iam-internal/src/main/java/fr/gouv/vitamui/iam/internal/server/customer/service/InitCustomerService.java b/api/api-iam/iam-internal/src/main/java/fr/gouv/vitamui/iam/internal/server/customer/service/InitCustomerService.java index 222304af08a8a87329729b3f9117ccaac1fda9fa..e393bfc206d3111b10a845f7e5ef00c44e087668 100644 --- a/api/api-iam/iam-internal/src/main/java/fr/gouv/vitamui/iam/internal/server/customer/service/InitCustomerService.java +++ b/api/api-iam/iam-internal/src/main/java/fr/gouv/vitamui/iam/internal/server/customer/service/InitCustomerService.java @@ -38,7 +38,6 @@ package fr.gouv.vitamui.iam.internal.server.customer.service; import fr.gouv.vitamui.commons.api.CommonConstants; import fr.gouv.vitamui.commons.api.domain.ExternalParametersDto; -import fr.gouv.vitamui.commons.api.domain.GroupDto; import fr.gouv.vitamui.commons.api.domain.LanguageDto; import fr.gouv.vitamui.commons.api.domain.OwnerDto; import fr.gouv.vitamui.commons.api.domain.ServicesData; @@ -191,34 +190,6 @@ public class InitCustomerService { createCustomGroups(customerDto, proofTenantDto, customProfiles); createCustomUsers(customerDto, customGroups); - Optional<Profile> accessProfile = - createdAdminProfiles.stream().filter(ac -> ac.getApplicationName().equals(CommonConstants.ACCESS_CONTRATCS_APPLICATIONS_NAME)).findFirst(); - Optional<Profile> ingestProfile = - createdAdminProfiles.stream().filter(ac -> ac.getApplicationName().equals(CommonConstants.INGEST_CONTRATCS_APPLICATIONS_NAME)).findFirst(); - - if(accessProfile.isPresent() && ingestProfile.isPresent()) { - addAccessAndIngestContractsToAdmin(accessProfile.get(), ingestProfile.get()); - } - - - } - - private void addAccessAndIngestContractsToAdmin(Profile accessProfile, Profile ingestProfile) { - UserDto adminUser = internalUserService.getOne(CommonConstants.ADMIN_USER); - final GroupDto adminGroupDto = internalGroupService.getOne(adminUser.getGroupId()); - - if(adminGroupDto != null) { - adminGroupDto.getProfileIds().add(accessProfile.getId()); - adminGroupDto.getProfileIds().add(ingestProfile.getId()); - - internalGroupService.updateProfilesById(adminGroupDto.getId(), adminGroupDto.getProfileIds()); - } else { - - LOGGER.warn("Le groupe d'administrateur n'existe pas, " + - "pour la gestion des permissions des contrats d'accès et d'entrées des contextes applicatifs vitam pour le tenant {}" + - "faudra associer les profils (les profils devront etre actifs) de ces applications [ contrat d'accès: {} et contrat d'entrée: {}].", - accessProfile.getTenantIdentifier(), accessProfile.getName(), ingestProfile.getName()); - } } private ExternalParametersDto initFullAccessContractExternalParameter(String customerIdentifier) { diff --git a/api/api-iam/iam-internal/src/main/java/fr/gouv/vitamui/iam/internal/server/tenant/service/TenantInternalService.java b/api/api-iam/iam-internal/src/main/java/fr/gouv/vitamui/iam/internal/server/tenant/service/TenantInternalService.java index 277c979f244db5afe668518cd0b472d9d8ab51cb..c9e24201c517a4070acf2cb53b6b463e96a2615b 100644 --- a/api/api-iam/iam-internal/src/main/java/fr/gouv/vitamui/iam/internal/server/tenant/service/TenantInternalService.java +++ b/api/api-iam/iam-internal/src/main/java/fr/gouv/vitamui/iam/internal/server/tenant/service/TenantInternalService.java @@ -95,9 +95,6 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Optional; -import java.util.stream.Collector; -import java.util.stream.Collectors; -import java.util.stream.Stream; /** * The service to read, create, update and delete the tenants. diff --git a/api/api-iam/iam-internal/src/test/java/fr/gouv/vitamui/iam/internal/server/tenant/service/TenantInternalServiceTest.java b/api/api-iam/iam-internal/src/test/java/fr/gouv/vitamui/iam/internal/server/tenant/service/TenantInternalServiceTest.java index ffe259de840e32944af2f9c13768259697ae3996..3b3a66a4f888693f6e34126f29f2a442c49f7828 100644 --- a/api/api-iam/iam-internal/src/test/java/fr/gouv/vitamui/iam/internal/server/tenant/service/TenantInternalServiceTest.java +++ b/api/api-iam/iam-internal/src/test/java/fr/gouv/vitamui/iam/internal/server/tenant/service/TenantInternalServiceTest.java @@ -165,7 +165,6 @@ public class TenantInternalServiceTest { prepareServices(); internalTenantService.create(tenantDto); - assertThat(profileRepository.findAll()).isNotNull(); } @Test diff --git a/commons/commons-api/src/main/java/fr/gouv/vitamui/commons/api/CommonConstants.java b/commons/commons-api/src/main/java/fr/gouv/vitamui/commons/api/CommonConstants.java index 78c1a8b1a3ff5281892204d763f62790da8ecdd9..800b8ef736781e95722dc35796fc29e3e55cda8e 100644 --- a/commons/commons-api/src/main/java/fr/gouv/vitamui/commons/api/CommonConstants.java +++ b/commons/commons-api/src/main/java/fr/gouv/vitamui/commons/api/CommonConstants.java @@ -325,8 +325,4 @@ public class CommonConstants { public static final String X_SIZE_TOTAL = "X-Size-Total"; public static final String X_CHUNK_OFFSET = "X-Chunk-Offset"; public static final String LOGO = "LOGO"; - - public static final String ACCESS_CONTRATCS_APPLICATIONS_NAME = "ACCESS_APP"; - public static final String INGEST_CONTRATCS_APPLICATIONS_NAME = "INGEST_APP"; - public static final String ADMIN_USER = "admin_user"; } diff --git a/ui/ui-frontend/projects/referential/src/app/context/context-create/context-create.component.html b/ui/ui-frontend/projects/referential/src/app/context/context-create/context-create.component.html index 975dfa49f612c88eaadb80cdb8737693c4cd32d2..b7f941a740e18d52586ab1bb4cc6dd9c09325db5 100644 --- a/ui/ui-frontend/projects/referential/src/app/context/context-create/context-create.component.html +++ b/ui/ui-frontend/projects/referential/src/app/context/context-create/context-create.component.html @@ -21,7 +21,7 @@ i18n-placeholder="Name@@contextCreateNamePlaceholder"> <ng-container *ngIf="form.get('name')?.touched"> <vitamui-common-input-error *ngIf="!!form.get('name')?.errors?.required" - >{{'COMMON.REQUIRED' | translate}}</vitamui-common-input-error> + i18n="Required field error hint@@formErrorRequiredField">Champ requis</vitamui-common-input-error> <vitamui-common-input-error *ngIf="!!form?.get('name')?.errors?.nameExists" i18n="Name exists error hint@@formErrorNameExists">Nom déjà utilisé</vitamui-common-input-error> </ng-container> @@ -69,15 +69,10 @@ </div> <div class="actions"> - <button *ngIf="form?.controls.enableControl?.value === true" - type="button" class="btn primary" cdkStepperNext - [disabled]="firstStepInvalid()" - i18n="Next step button label@@contextCreateNextButton">{{'COMMON.NEXT' | translate}}</button> - <button *ngIf="form?.controls.enableControl?.value === false" - type="submit" class="btn primary" - [disabled]="firstStepInvalid()" - i18n="Finish context creation button@@contextCreateFinishButton">Terminer</button> - <button type="button" class="btn cancel" (click)="onCancel()">{{'COMMON.UNDO' | translate}}</button> + <button type="button" class="btn primary" cdkStepperNext [disabled]="firstStepInvalid()" + i18n="Next step button label@@contextCreateNextButton">Suivant</button> + <button type="button" class="btn cancel" (click)="onCancel()" + i18n="Cancel context creation@@contextCreateCancelButton">Annuler</button> </div> </div> </cdk-step> @@ -102,14 +97,13 @@ </ng-container> </div> - <div class="actions"> - <button type="submit" class="btn primary" [disabled]="lastStepInvalid()" - i18n="Finish context creation button@@contextCreateFinishButton">{{'COMMON.SUBMIT' | translate}}</button> - <button type="button" class="btn cancel" (click)="onCancel()">{{'COMMON.UNDO' | translate}}</button> - </div> + <button type="submit" class="btn primary" [disabled]="lastStepInvalid()" + i18n="Finish context creation button@@contextCreateFinishButton">Terminer</button> + <button type="button" class="btn cancel" (click)="onCancel()" + i18n="Cancel context creation@@contextCreateCancelButton">Annuler</button> <button type="button" class="back" cdkStepperPrevious> <i class="material-icons">arrow_back</i> - <ng-container>{{'COMMON.BACK' | translate}}</ng-container> + <ng-container i18n="Previous step button label@@contextCreateBackButton">Retour</ng-container> </button> </div> </cdk-step> diff --git a/ui/ui-frontend/projects/referential/src/app/context/context-create/context-create.component.ts b/ui/ui-frontend/projects/referential/src/app/context/context-create/context-create.component.ts index f80fe198264b0e18a054a3a2ac5607bed4b9ffec..b398d21d492561e591c2f0f2c7daef0ad2147027 100644 --- a/ui/ui-frontend/projects/referential/src/app/context/context-create/context-create.component.ts +++ b/ui/ui-frontend/projects/referential/src/app/context/context-create/context-create.component.ts @@ -34,48 +34,48 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {Component,Inject,Input,OnDestroy,OnInit,ViewChild} from '@angular/core'; -import {FormBuilder,FormControl,FormGroup,Validators} from '@angular/forms'; -import {MatDialogRef,MAT_DIALOG_DATA} from '@angular/material/dialog'; -import {ContextPermission} from 'projects/vitamui-library/src/public-api'; import {Subscription} from 'rxjs'; -import {AuthService,ConfirmDialogService,Option} from 'ui-frontend-common'; -import {Context} from '../../../../../vitamui-library/src/lib/models/context'; +import {ConfirmDialogService, Option} from 'ui-frontend-common'; + +import {Component, Inject, Input, OnDestroy, OnInit, ViewChild} from '@angular/core'; +import {FormBuilder, FormControl, FormGroup, Validators} from '@angular/forms'; +import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; import {SecurityProfileService} from '../../security-profile/security-profile.service'; import {ContextService} from '../context.service'; import {ContextCreateValidators} from './context-create.validators'; +import { Context } from '../../../../../vitamui-library/src/lib/models/context'; - -const PROGRESS_BAR_MULTIPLICATOR=100; +const PROGRESS_BAR_MULTIPLICATOR = 100; @Component({ selector: 'app-context-create', templateUrl: './context-create.component.html', styleUrls: ['./context-create.component.scss'] }) -export class ContextCreateComponent implements OnInit,OnDestroy { +export class ContextCreateComponent implements OnInit, OnDestroy { @Input() isSlaveMode: boolean; form: FormGroup; - statusControl=new FormControl(false); - stepIndex=0; - accessContractInfo: {code: string,name: string,companyName: string}={code: '',name: '',companyName: ''}; - hasCustomGraphicIdentity=false; - hasError=true; + statusControl = new FormControl(false); + stepIndex = 0; + accessContractInfo: {code: string, name: string, companyName: string} = {code: '', name: '', companyName: ''}; + hasCustomGraphicIdentity = false; + hasError = true; message: string; - isPermissionsOnMultipleOrganisations=false; + isPermissionsOnMultipleOrganisations = false; // stepCount is the total number of steps and is used to calculate the advancement of the progress bar. // We could get the number of steps using ViewChildren(StepComponent) but this triggers a // "Expression has changed after it was checked" error so we instead manually define the value. // Make sure to update this value whenever you add or remove a step from the template. - private stepCount=2; + private stepCount = 2; private keyPressSubscription: Subscription; - @ViewChild('fileSearch',{static: false}) fileSearch: any; + @ViewChild('fileSearch', {static: false}) fileSearch: any; + + securityProfiles: Option[] = []; - securityProfiles: Option[]=[]; constructor( public dialogRef: MatDialogRef<ContextCreateComponent>, @Inject(MAT_DIALOG_DATA) public data: any, @@ -83,34 +83,33 @@ export class ContextCreateComponent implements OnInit,OnDestroy { private confirmDialogService: ConfirmDialogService, private contextService: ContextService, private contextCreateValidators: ContextCreateValidators, - private securityProfileService: SecurityProfileService, - private authService: AuthService + private securityProfileService: SecurityProfileService ) { } ngOnInit() { - this.form=this.formBuilder.group({ + this.form = this.formBuilder.group({ status: ['INACTIVE'], - name: [null,Validators.required,this.contextCreateValidators.uniqueName()], - identifier: [null,Validators.required,this.contextCreateValidators.uniqueIdentifier()], - securityProfile: [null,Validators.required], + name: [null, Validators.required, this.contextCreateValidators.uniqueName()], + identifier: [null, Validators.required, this.contextCreateValidators.uniqueIdentifier()], + securityProfile: [null, Validators.required], enableControl: [false], - permissions: [[{tenant: null,accessContracts: [],ingestContracts: []}],null,null] + permissions: [[{tenant: null, accessContracts: [], ingestContracts: []}], null, null] }); this.form.controls.name.valueChanges.subscribe((value) => { - if(!this.isSlaveMode) { + if (!this.isSlaveMode) { this.form.controls.identifier.setValue(value); } }); this.statusControl.valueChanges.subscribe((value) => { - this.form.controls.status.setValue(value=(value===false)? 'INACTIVE':'ACTIVE'); + this.form.controls.status.setValue(value = (value === false) ? 'INACTIVE' : 'ACTIVE'); }); // Add or remove controls on the permissions this.form.controls.enableControl.valueChanges.subscribe((value) => { - if(value) { + if (value) { this.form.controls.permissions.setAsyncValidators([this.contextCreateValidators.permissionInvalid()]); } else { this.form.controls.permissions.clearAsyncValidators(); @@ -120,10 +119,10 @@ export class ContextCreateComponent implements OnInit,OnDestroy { this.securityProfileService.getAll().subscribe( securityProfiles => { - this.securityProfiles=securityProfiles.map(x => ({label: x.name,key: x.identifier})); - }); + this.securityProfiles = securityProfiles.map(x => ({label: x.name, key: x.identifier})); + }); - this.keyPressSubscription=this.confirmDialogService.listenToEscapeKeyPress(this.dialogRef).subscribe(() => this.onCancel()); + this.keyPressSubscription = this.confirmDialogService.listenToEscapeKeyPress(this.dialogRef).subscribe(() => this.onCancel()); } ngOnDestroy() { @@ -131,7 +130,7 @@ export class ContextCreateComponent implements OnInit,OnDestroy { } onCancel() { - if(this.form.dirty) { + if (this.form.dirty) { this.confirmDialogService.confirmBeforeClosing(this.dialogRef); } else { this.dialogRef.close(); @@ -139,45 +138,27 @@ export class ContextCreateComponent implements OnInit,OnDestroy { } onSubmit() { - if(this.form.invalid) { + if (this.form.invalid) { return; } - let context=this.form.value as Context; - if(context.permissions.length==1) { - if(context.permissions[0].tenant==null) { - this.fillContextPermissions(context); - } - } - - context.status==='ACTIVE'? context.activationDate=new Date().toISOString():context.deactivationDate=new Date().toISOString(); + const context = this.form.value as Context; + context.status === 'ACTIVE' ? context.activationDate = new Date().toISOString() : context.deactivationDate = new Date().toISOString(); this.contextService.create(context).subscribe( () => { - this.dialogRef.close({success: true,action: 'none'}); + this.dialogRef.close({success: true, action: 'none'}); }, (error: any) => { - this.dialogRef.close({success: false,action: 'none'}); + this.dialogRef.close({success: false, action: 'none'}); console.error(error); }); } - fillContextPermissions(context: Context): Context { - const permission: ContextPermission={ - tenant: this.authService.user.proofTenantIdentifier, - accessContracts: [], - ingestContracts: [] - } - context.permissions.pop(); - context.permissions.push(permission); - - return context; - } - firstStepInvalid() { - return this.form.get('name').invalid||this.form.get('name').pending|| - this.form.get('status').invalid||this.form.get('status').pending|| - this.form.get('enableControl').invalid||this.form.get('enableControl').pending|| - this.form.get('securityProfile').invalid||this.form.get('securityProfile').pending; + return this.form.get('name').invalid || this.form.get('name').pending || + this.form.get('status').invalid || this.form.get('status').pending || + this.form.get('enableControl').invalid || this.form.get('enableControl').pending || + this.form.get('securityProfile').invalid || this.form.get('securityProfile').pending; } lastStepInvalid() { @@ -185,15 +166,15 @@ export class ContextCreateComponent implements OnInit,OnDestroy { } onChangeOrganisations(organisations: string[]) { - this.isPermissionsOnMultipleOrganisations=false; - if(organisations&&organisations.length>1) { - let idx=0; - let organisationId: string=null; - while(idx<organisations.length&&!this.isPermissionsOnMultipleOrganisations) { - if(idx===0) { - organisationId=organisations[0]; - } else if(organisations[idx]!=null&&organisations[idx]!==organisationId) { - this.isPermissionsOnMultipleOrganisations=true; + this.isPermissionsOnMultipleOrganisations = false; + if (organisations && organisations.length > 1) { + let idx = 0; + let organisationId: string = null; + while (idx < organisations.length && !this.isPermissionsOnMultipleOrganisations) { + if (idx === 0) { + organisationId = organisations[0]; + } else if (organisations[idx] != null && organisations[idx] !== organisationId) { + this.isPermissionsOnMultipleOrganisations = true; } idx++; } @@ -203,10 +184,10 @@ export class ContextCreateComponent implements OnInit,OnDestroy { get stepProgress() { let stepProgress: number; // For the first step, check if the controls are enabled and if the second step is available or not - if(this.stepIndex===0&&this.form.controls.enableControl.value===true) { - stepProgress=((this.stepIndex+1)/this.stepCount)*PROGRESS_BAR_MULTIPLICATOR; + if (this.stepIndex === 0 && this.form.controls.enableControl.value === true) { + stepProgress = ((this.stepIndex + 1) / this.stepCount) * PROGRESS_BAR_MULTIPLICATOR; } else { - stepProgress=PROGRESS_BAR_MULTIPLICATOR; + stepProgress = PROGRESS_BAR_MULTIPLICATOR; } return stepProgress; } diff --git a/ui/ui-frontend/projects/referential/src/app/context/context-create/context-edit-permission/context-edit-permission.component.ts b/ui/ui-frontend/projects/referential/src/app/context/context-create/context-edit-permission/context-edit-permission.component.ts index d7e005730d0dae8b103b998239b7fb0bfc01cfcc..b3aa3cf6bec61e6436e2dba1a08fb53593505b76 100644 --- a/ui/ui-frontend/projects/referential/src/app/context/context-create/context-edit-permission/context-edit-permission.component.ts +++ b/ui/ui-frontend/projects/referential/src/app/context/context-create/context-edit-permission/context-edit-permission.component.ts @@ -36,15 +36,15 @@ */ /* tslint:disable:no-use-before-declare */ -import {Component,EventEmitter,forwardRef,Input,OnInit,Output} from '@angular/core'; -import {ControlValueAccessor,NG_VALUE_ACCESSOR} from '@angular/forms'; -import {ContextPermission} from 'projects/vitamui-library/src/public-api'; -import {AuthService,Option} from 'ui-frontend-common'; -import {Customer,Tenant} from 'ui-frontend-common/app/modules/models/customer'; -import {AccessContractService} from '../../../access-contract/access-contract.service'; -import {CustomerApiService} from '../../../core/api/customer-api.service'; -import {TenantApiService} from '../../../core/api/tenant-api.service'; -import {IngestContractService} from '../../../ingest-contract/ingest-contract.service'; +import { Component, EventEmitter, forwardRef, Input, OnInit, Output } from '@angular/core'; +import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; +import { ContextPermission } from 'projects/vitamui-library/src/public-api'; +import { AuthService, Option } from 'ui-frontend-common'; +import { Customer, Tenant } from 'ui-frontend-common/app/modules/models/customer'; +import { AccessContractService } from '../../../access-contract/access-contract.service'; +import { CustomerApiService } from '../../../core/api/customer-api.service'; +import { TenantApiService } from '../../../core/api/tenant-api.service'; +import { IngestContractService } from '../../../ingest-contract/ingest-contract.service'; export const CONTEXT_PERMISSION_VALUE_ACCESSOR: any = { provide: NG_VALUE_ACCESSOR, @@ -122,7 +122,7 @@ export class ContextEditPermissionComponent implements ControlValueAccessor, OnI accessTenants.forEach((tenant) => { this.accessService.getAllForTenant('' + tenant.identifier).subscribe( accessContracts => { - this.accessContracts.set('' + tenant.identifier, accessContracts.filter(ac => ac.status === 'ACTIVE').map(x => ({ + this.accessContracts.set('' + tenant.identifier, accessContracts.map(x => ({ label: x.name, key: x.identifier }))); @@ -136,7 +136,7 @@ export class ContextEditPermissionComponent implements ControlValueAccessor, OnI ingestTenants.forEach((tenant) => { this.ingestService.getAllForTenant('' + tenant.identifier).subscribe( ingestContracts => { - this.ingestContracts.set('' + tenant.identifier, ingestContracts.filter(ic => ic.status === 'ACTIVE').map(x => ({ + this.ingestContracts.set('' + tenant.identifier, ingestContracts.map(x => ({ label: x.name, key: x.identifier }))); diff --git a/ui/ui-frontend/projects/referential/src/app/context/context-preview/context-information-tab/context-information-tab.component.ts b/ui/ui-frontend/projects/referential/src/app/context/context-preview/context-information-tab/context-information-tab.component.ts index 97a58cf7bd980a1613c215cf748f2fe941544748..105e65a58882186f63fe5b1cd4a29d13f05d92f9 100644 --- a/ui/ui-frontend/projects/referential/src/app/context/context-preview/context-information-tab/context-information-tab.component.ts +++ b/ui/ui-frontend/projects/referential/src/app/context/context-preview/context-information-tab/context-information-tab.component.ts @@ -34,17 +34,17 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {Component, EventEmitter, Input, Output} from '@angular/core'; -import {FormBuilder, FormControl, FormGroup, Validators} from '@angular/forms'; -import {Context} from 'projects/vitamui-library/src/public-api'; -import {Observable, of} from 'rxjs'; -import {catchError, filter, map, switchMap} from 'rxjs/operators'; -import {diff, Option} from 'ui-frontend-common'; -import {extend, isEmpty} from 'underscore'; +import { Component, EventEmitter, Input, Output } from '@angular/core'; +import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms'; +import { Context } from 'projects/vitamui-library/src/public-api'; +import { Observable, of } from 'rxjs'; +import { catchError, filter, map, switchMap } from 'rxjs/operators'; +import { diff, Option } from 'ui-frontend-common'; +import { extend, isEmpty } from 'underscore'; +import { SecurityProfileService } from '../../../security-profile/security-profile.service'; +import { ContextService } from '../../context.service'; -import {ContextService} from '../../context.service'; -import {SecurityProfileService} from '../../../security-profile/security-profile.service'; @Component({ selector: 'app-context-information-tab', @@ -172,11 +172,8 @@ export class ContextInformationTabComponent { this.prepareSubmit().subscribe(() => { this.contextService.get(this._context.identifier).subscribe( response => { - this.submited = false; - this.context = extend(this.context, response); - // Update the activation and deactivation dates - this.context.activationDate = response.activationDate ? response.activationDate : null; - this.context.deactivationDate = response.deactivationDate ? response.deactivationDate : null; + this.submited = false; + this.context = response; } ); }, () => { diff --git a/ui/ui-frontend/projects/referential/src/app/context/context-preview/context-preview.component.ts b/ui/ui-frontend/projects/referential/src/app/context/context-preview/context-preview.component.ts index fb2b90fe9b9921070cbb045a1e5c0134b4c80d47..7c800b6b36ac245d77d4d8842ed3f25d0b9ed704 100644 --- a/ui/ui-frontend/projects/referential/src/app/context/context-preview/context-preview.component.ts +++ b/ui/ui-frontend/projects/referential/src/app/context/context-preview/context-preview.component.ts @@ -86,6 +86,7 @@ export class ContextPreviewComponent implements AfterViewInit { async checkBeforeExit() { if (await this.confirmAction()) { const submitAccessContractUpdate: Observable<Context> = this.tabLinks[this.tabs.selectedIndex].prepareSubmit(); + submitAccessContractUpdate.subscribe(() => { this.contextService.get(this.context.identifier).subscribe( response => { @@ -93,17 +94,14 @@ export class ContextPreviewComponent implements AfterViewInit { } ); }); + } else { + this.tabLinks[this.tabs.selectedIndex].resetForm(this.context); } } async interceptTabChange(tab: MatTab, tabHeader: MatTabHeader, idx: number) { if (this.tabUpdated[this.tabs.selectedIndex]) { await this.checkBeforeExit(); - } else { - if (idx === 1) { - // Reset the permissions for if the context has changed - this.tabLinks[idx].resetForm(this.context); - } } const args = [tab, tabHeader, idx]; diff --git a/ui/ui-frontend/projects/referential/src/app/context/context.component.ts b/ui/ui-frontend/projects/referential/src/app/context/context.component.ts index 80dfd850097908cd09dbe9efc106acbcaba55e71..d8bf05b3d4bd90ca244af7eafbdac8d2be735659 100644 --- a/ui/ui-frontend/projects/referential/src/app/context/context.component.ts +++ b/ui/ui-frontend/projects/referential/src/app/context/context.component.ts @@ -34,15 +34,15 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import {Component,OnInit,ViewChild} from '@angular/core'; +import {Component, OnInit, ViewChild} from '@angular/core'; import {MatDialog} from '@angular/material/dialog'; import {ActivatedRoute} from '@angular/router'; -import {ApplicationService,GlobalEventService,SidenavPage} from 'ui-frontend-common'; + +import {ApplicationService, GlobalEventService, SidenavPage} from 'ui-frontend-common'; import {Context} from '../../../../vitamui-library/src/lib/models/context'; import {ContextCreateComponent} from './context-create/context-create.component'; import {ContextListComponent} from './context-list/context-list.component'; - @Component({ selector: 'app-context', templateUrl: './context.component.html', diff --git a/ui/ui-referential/src/main/config/ui-referential-application-dev.yml b/ui/ui-referential/src/main/config/ui-referential-application-dev.yml index 2f775036e16be00a1728722c07f7b2fb8f3d5b26..8371685661fd86184d4395d0d8d188deb78bb678 100644 --- a/ui/ui-referential/src/main/config/ui-referential-application-dev.yml +++ b/ui/ui-referential/src/main/config/ui-referential-application-dev.yml @@ -144,3 +144,5 @@ list-enable-external-identifiers: - ACCESS_CONTRACT - MANAGEMENT_CONTRACT - PROFILE + - SECURITY_PROFILE + - CONTEXT