Fixed technicianFullDataAccess
All checks were successful
Deploy dev on push / on-push-deploy_sh-edraft (push) Successful in 3m59s

This commit is contained in:
Sven Heidemann 2023-11-05 17:50:37 +01:00
parent 23a3dbbc5e
commit 2f161d2f43

View File

@ -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<void>();
@ -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]);