staging into master #426

Merged
edraft merged 83 commits from staging into master 2023-11-06 20:06:34 +01:00
Showing only changes of commit 2f161d2f43 - Show all commits

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]);