Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit 64b4e79e authored by Joze RIHTARSIC's avatar Joze RIHTARSIC
Browse files

Pull request #187: [EDELIVERY-14170] logout on session timeout even if changed data

Merge in EDELIVERY/smp from bugfix/EDELIVERY-14170-edit-documents-the-save-changes-confirmation-popup-should-not-appeare-after to development

* commit '4384adf8':
  [EDELIVERY-14170] logout on session timeout even if changed data
parents 3168c360 4384adf8
Branches
Tags
No related merge requests found
......@@ -323,11 +323,6 @@ See the Licence for the specific language governing permissions and limitations
<artifactId>spring-context-support</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
......
This diff is collapsed.
......@@ -17,19 +17,19 @@
"private": true,
"dependencies": {
"@angular/animations": "^18.2.8",
"@angular/cdk": "^18.2.8",
"@angular/cdk": "^18.2.9",
"@angular/common": "^18.2.8",
"@angular/compiler": "^18.2.8",
"@angular/core": "^18.2.8",
"@angular/flex-layout": "^15.0.0-beta.42",
"@angular/forms": "^18.2.8",
"@angular/material": "^18.2.8",
"@angular/material-moment-adapter": "^18.2.8",
"@angular/material": "^18.2.9",
"@angular/material-moment-adapter": "^18.2.9",
"@angular/platform-browser": "^18.2.8",
"@angular/platform-browser-dynamic": "^18.2.8",
"@angular/platform-server": "^18.2.8",
"@angular/router": "^18.2.8",
"@codemirror/commands": "^6.7.0",
"@codemirror/commands": "^6.7.1",
"@codemirror/language": "^6.10.3",
"@codemirror/language-data": "^6.5.1",
"@codemirror/merge": "^6.7.2",
......
import {inject} from '@angular/core';
import {NavigationService} from "../window/sidenav/navigation-model.service";
import {CancelDialogComponent} from "../common/dialogs/cancel-dialog/cancel-dialog.component";
import {
CancelDialogComponent
} from "../common/dialogs/cancel-dialog/cancel-dialog.component";
import {MatDialog} from "@angular/material/dialog";
import {BeforeLeaveGuard} from "../window/sidenav/navigation-on-leave-guard";
import {SecurityService} from "../security/security.service";
export const dirtyDeactivateGuard = (component: BeforeLeaveGuard) => {
const navigationService = inject(NavigationService);
const dialog = inject(MatDialog);
const navigationService: NavigationService = inject(NavigationService);
const dialog: MatDialog = inject(MatDialog);
const securityService: SecurityService = inject(SecurityService);
if (!component) {
return true;
}
if (component.isDirty && !component.isDirty()) return true;
if (component.isDirty && !component.isDirty()) {
return true;
}
// if the user is not logged in, we can navigate away
// no data can be saved anymore
if (!securityService.hasUISessionData()) {
return true;
}
return dialog.open(CancelDialogComponent).afterClosed().toPromise().then((cancelChanges: boolean) => {
// rollback the navigation
if (!cancelChanges) {
......
......@@ -226,14 +226,16 @@ export class SecurityService {
subject.next(false);
}
});
} else {
let currentUser = this.getCurrentUser();
subject.next(currentUser !== null);
subject.next(this.hasUISessionData());
}
return subject.asObservable();
}
hasUISessionData(): boolean {
return !!this.getCurrentUser();
}
isCurrentUserSystemAdmin(): boolean {
return this.isCurrentUserInRole([Authority.SYSTEM_ADMIN]);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment