From 2f161d2f43eb97aad98ad613f783bcb283a335ae Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Sun, 5 Nov 2023 17:50:37 +0100 Subject: [PATCH] Fixed technicianFullDataAccess --- .../app/modules/view/server/profile/profile.component.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/web/src/app/modules/view/server/profile/profile.component.ts b/web/src/app/modules/view/server/profile/profile.component.ts index 6625f101..21ae1a88 100644 --- a/web/src/app/modules/view/server/profile/profile.component.ts +++ b/web/src/app/modules/view/server/profile/profile.component.ts @@ -18,6 +18,7 @@ import { Mutations } from "../../../../models/graphql/mutations.model"; import { MenuItem } from "primeng/api"; import { UserWarning } from "../../../../models/data/user_warning.model"; import moment from "moment"; +import { SidebarService } from "../../../../services/sidebar/sidebar.service"; @Component({ selector: "app-profile", @@ -34,6 +35,7 @@ export class ProfileComponent implements OnInit, OnDestroy { public isEditingNewUserWarning: boolean = false; public isEditing: boolean = false; public isModerator: boolean = false; + public hasTechnicianAccess: boolean = false; private unsubscriber = new Subject(); @@ -45,7 +47,8 @@ export class ProfileComponent implements OnInit, OnDestroy { private auth: AuthService, private toast: ToastService, private translate: TranslateService, - private toastService: ToastService + private toastService: ToastService, + private sidebarService: SidebarService, ) { } @@ -78,7 +81,8 @@ export class ProfileComponent implements OnInit, OnDestroy { let authUser = await this.auth.getLoggedInUser(); this.spinner.showSpinner(); let user: UserDTO | null = authUser?.users?.find(u => u.server == server.id) ?? null; - if (!user || user?.id != params["memberId"] && !user?.isModerator) { + this.hasTechnicianAccess = (this.sidebarService.hasFeature("TechnicianFullAccess") && user?.isTechnician) ?? false; + if (!user || user?.id != params["memberId"] && !user?.isModerator && !this.hasTechnicianAccess) { this.toast.error(this.translate.instant("view.server.profile.permission_denied"), this.translate.instant("view.server.profile.permission_denied_d")); this.spinner.hideSpinner(); await this.router.navigate(["/server", server.id]);