Handle normal user cannot access user management page. Fixes https://github.com/GNS3/gns3-server/issues/2460
Some checks are pending
CodeQL / Analyze (javascript) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
Build / Node ${{ matrix.node }} (14) (push) Waiting to run
Build / Node ${{ matrix.node }} (16) (push) Waiting to run
Build / Node ${{ matrix.node }} (18) (push) Waiting to run

This commit is contained in:
grossmj 2024-12-26 17:21:37 +07:00
parent 2e581c4495
commit 2227d11932
No known key found for this signature in database
GPG Key ID: 1E7DD6DBB53FF3D7

View File

@ -11,6 +11,7 @@
* Author: Sylvain MATHIEU, Elise LEBEAU
*/
import {Component, OnInit, QueryList, ViewChild, ViewChildren} from '@angular/core';
import {Location} from '@angular/common';
import {ActivatedRoute, Router} from "@angular/router";
import {Controller} from "@models/controller";
import {MatSort} from "@angular/material/sort";
@ -49,7 +50,8 @@ export class UserManagementComponent implements OnInit {
private progressService: ProgressService,
private controllerService: ControllerService,
public dialog: MatDialog,
private toasterService: ToasterService) { }
private toasterService: ToasterService,
private location: Location) { }
ngOnInit() {
const controllerId = this.route.parent.snapshot.paramMap.get('controller_id');
@ -88,6 +90,8 @@ export class UserManagementComponent implements OnInit {
},
(error) => {
this.progressService.setError(error);
this.toasterService.error(`Cannot open the user management page`);
this.location.back();
}
);
}