From 5ae4f13c14a2e30198b897de500a591841fe1bba Mon Sep 17 00:00:00 2001 From: Kostis Trantzas Date: Sat, 28 Jun 2025 22:18:10 +0300 Subject: [PATCH] Disable a non-admin user to delete Service Orders/Resources/Test instances (fix for #31) --- .../list-resource-inventory.component.html | 2 +- .../list-resource-inventory.component.ts | 4 +++- .../list-service-orders/list-service-orders.component.html | 2 +- .../list-service-orders/list-service-orders.component.ts | 2 ++ .../list-service-tests/list-service-tests.component.html | 4 ++-- .../list-service-tests/list-service-tests.component.ts | 4 +++- src/app/shared/components/redirect/redirect.component.ts | 4 ++-- 7 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/app/p_resources/admin/inventoryManagement/list-resource-inventory/list-resource-inventory.component.html b/src/app/p_resources/admin/inventoryManagement/list-resource-inventory/list-resource-inventory.component.html index 770dd80..65d18c9 100644 --- a/src/app/p_resources/admin/inventoryManagement/list-resource-inventory/list-resource-inventory.component.html +++ b/src/app/p_resources/admin/inventoryManagement/list-resource-inventory/list-resource-inventory.component.html @@ -53,7 +53,7 @@ - diff --git a/src/app/p_resources/admin/inventoryManagement/list-resource-inventory/list-resource-inventory.component.ts b/src/app/p_resources/admin/inventoryManagement/list-resource-inventory/list-resource-inventory.component.ts index 450f6b4..c436c14 100644 --- a/src/app/p_resources/admin/inventoryManagement/list-resource-inventory/list-resource-inventory.component.ts +++ b/src/app/p_resources/admin/inventoryManagement/list-resource-inventory/list-resource-inventory.component.ts @@ -11,6 +11,7 @@ import { fadeIn } from 'src/app/shared/animations/animations'; import { AppService } from 'src/app/shared/services/app.service'; import { HttpErrorResponse } from '@angular/common/http'; import { DeleteResourceComponent } from '../../catalogManagement/delete-resource/delete-resource.component'; +import { AuthService } from 'src/app/shared/services/auth.service'; @Component({ selector: 'app-list-resource-inventory', @@ -25,7 +26,8 @@ export class ListResourceInventoryComponent implements OnInit { public dialog: MatDialog, private resourceService: ResourceService, private toast: ToastrService, - public appService: AppService + public appService: AppService, + public authService: AuthService ) { } displayedColumns = ['name', '@type', 'category', 'resourceStatus', 'startOperatingDate', 'actions'] diff --git a/src/app/p_services/admin/orderManagement/list-service-orders/list-service-orders.component.html b/src/app/p_services/admin/orderManagement/list-service-orders/list-service-orders.component.html index 71d2c71..02e54a2 100644 --- a/src/app/p_services/admin/orderManagement/list-service-orders/list-service-orders.component.html +++ b/src/app/p_services/admin/orderManagement/list-service-orders/list-service-orders.component.html @@ -87,7 +87,7 @@ - + diff --git a/src/app/p_services/admin/orderManagement/list-service-orders/list-service-orders.component.ts b/src/app/p_services/admin/orderManagement/list-service-orders/list-service-orders.component.ts index 92dc8a7..c021512 100644 --- a/src/app/p_services/admin/orderManagement/list-service-orders/list-service-orders.component.ts +++ b/src/app/p_services/admin/orderManagement/list-service-orders/list-service-orders.component.ts @@ -22,6 +22,7 @@ import interactionPlugin from '@fullcalendar/interaction'; import resourceTimelinePlugin from '@fullcalendar/resource-timeline'; import { Router } from '@angular/router'; import { Plugins } from 'protractor/built/plugins'; +import { AuthService } from 'src/app/shared/services/auth.service'; @Component({ selector: 'app-list-service-orders', @@ -37,6 +38,7 @@ export class ListServiceOrdersComponent implements OnInit { private toastr: ToastrService, private cacheService: CacheSearchParametersService, public appService: AppService, + public authService: AuthService, private router: Router ) { } diff --git a/src/app/p_testing/admin/testManagement/list-service-tests/list-service-tests.component.html b/src/app/p_testing/admin/testManagement/list-service-tests/list-service-tests.component.html index 2d8095b..eb1e55f 100644 --- a/src/app/p_testing/admin/testManagement/list-service-tests/list-service-tests.component.html +++ b/src/app/p_testing/admin/testManagement/list-service-tests/list-service-tests.component.html @@ -53,13 +53,13 @@ - + Actions - + diff --git a/src/app/p_testing/admin/testManagement/list-service-tests/list-service-tests.component.ts b/src/app/p_testing/admin/testManagement/list-service-tests/list-service-tests.component.ts index 6d5cf1e..b33031e 100644 --- a/src/app/p_testing/admin/testManagement/list-service-tests/list-service-tests.component.ts +++ b/src/app/p_testing/admin/testManagement/list-service-tests/list-service-tests.component.ts @@ -13,6 +13,7 @@ import { ServiceTest } from 'src/app/openApis/serviceTestManagement/models'; import { AppService } from 'src/app/shared/services/app.service'; import { DeleteServiceTestComponent } from '../delete-service-test/delete-service-test.component'; import { HttpErrorResponse } from '@angular/common/http'; +import { AuthService } from 'src/app/shared/services/auth.service'; @Component({ selector: 'app-list-service-tests', @@ -26,7 +27,8 @@ export class ListServiceTestsComponent implements OnInit { private testSpecificationService: ServiceTestService, private toast: ToastrService, public appService: AppService, - private dialog: MatDialog + private dialog: MatDialog, + public authService: AuthService ) { } displayedColumns = ['name', 'description', 'lastUpdate', 'testSpecification', 'service', 'actions'] diff --git a/src/app/shared/components/redirect/redirect.component.ts b/src/app/shared/components/redirect/redirect.component.ts index 9dd049f..4354f21 100644 --- a/src/app/shared/components/redirect/redirect.component.ts +++ b/src/app/shared/components/redirect/redirect.component.ts @@ -21,10 +21,10 @@ export class RedirectComponent implements OnInit { this.router.navigate(['services', 'services_marketplace']) } else if (activePortal === 'resources') { - this.router.navigate(['resources', 'resource_catalogs']) + this.router.navigate(['resources', 'resource_inventory']) } else if (activePortal === 'testing') { - this.router.navigate(['testing', 'service_test_specs']) + this.router.navigate(['testing', 'service_tests']) } else if (activePortal === 'products') { -- GitLab