Remove non-admin workbench
This commit is contained in:
@@ -11,7 +11,6 @@ import Login from "../views/Login.vue";
|
||||
import Register from "../views/Register.vue";
|
||||
import ForgotPassword from "../views/ForgotPassword.vue";
|
||||
import StudyHome from "../views/StudyHome.vue";
|
||||
import MyWorkbench from "../views/workbench/MyWorkbench.vue";
|
||||
import FaqDetail from "../views/FaqDetail.vue";
|
||||
import AuditLogs from "../views/admin/AuditLogs.vue";
|
||||
import AdminUsers from "../views/admin/Users.vue";
|
||||
@@ -84,14 +83,8 @@ const routes: RouteRecordRaw[] = [
|
||||
{
|
||||
path: "/",
|
||||
component: Layout,
|
||||
redirect: "/workbench",
|
||||
redirect: "/project/overview",
|
||||
children: [
|
||||
{
|
||||
path: "workbench",
|
||||
name: "MyWorkbench",
|
||||
component: MyWorkbench,
|
||||
meta: { title: TEXT.menu.workbench },
|
||||
},
|
||||
{
|
||||
path: "profile",
|
||||
name: "ProfileSettings",
|
||||
@@ -552,7 +545,7 @@ router.beforeEach(async (to, _from, next) => {
|
||||
next({ path: "/login" });
|
||||
return;
|
||||
}
|
||||
if (isAdmin && (to.path === "/" || to.path === "/workbench")) {
|
||||
if (isAdmin && to.path === "/") {
|
||||
next({ path: studyStore.currentStudy ? "/project/overview" : "/admin/users" });
|
||||
return;
|
||||
}
|
||||
@@ -565,7 +558,7 @@ router.beforeEach(async (to, _from, next) => {
|
||||
: "/admin/users"
|
||||
: studyStore.currentStudy
|
||||
? "/project/overview"
|
||||
: "/workbench",
|
||||
: "/admin/projects",
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -573,12 +566,12 @@ router.beforeEach(async (to, _from, next) => {
|
||||
if (to.meta.adminProjectPermission) {
|
||||
const allowed = await ensureAdminProjectAccess(to, isAdmin).catch(() => false);
|
||||
if (!allowed) {
|
||||
next({ path: isAdmin ? "/admin/users" : "/workbench" });
|
||||
next({ path: isAdmin ? "/admin/users" : "/admin/projects" });
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (to.meta.requiresAdmin && !isAdmin) {
|
||||
next({ path: "/workbench" });
|
||||
next({ path: "/admin/projects" });
|
||||
return;
|
||||
}
|
||||
if (to.name === "AdminAuditLogs") {
|
||||
@@ -593,7 +586,7 @@ router.beforeEach(async (to, _from, next) => {
|
||||
}
|
||||
}
|
||||
if (to.meta.requiresStudy && !studyStore.currentStudy) {
|
||||
next({ path: isAdmin ? "/admin/users" : "/workbench" });
|
||||
next({ path: isAdmin ? "/admin/users" : "/admin/projects" });
|
||||
return;
|
||||
}
|
||||
if (to.meta.requiresStudy && studyStore.currentStudy) {
|
||||
@@ -605,7 +598,7 @@ router.beforeEach(async (to, _from, next) => {
|
||||
const canAccessProjectRoute = hasProjectPermission(studyStore.currentPermissions, projectRole, permission, isAdmin);
|
||||
if (!canAccessProjectRoute) {
|
||||
const fallback = findFirstAccessibleProjectPath(studyStore.currentPermissions, projectRole, isAdmin);
|
||||
next({ path: fallback || "/workbench" });
|
||||
next({ path: fallback || "/admin/projects" });
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user