feat(editor): Replace middleware for Role checks with Scope checks (#7847)

This commit is contained in:
Alex Grozav
2023-11-29 10:35:40 +02:00
committed by GitHub
parent d4970410e1
commit 72852a60eb
18 changed files with 267 additions and 111 deletions

View File

@@ -0,0 +1,15 @@
import type { RouterMiddleware } from '@/types/router';
import { VIEWS } from '@/constants';
import type { DefaultUserMiddlewareOptions } from '@/types/rbac';
import { isDefaultUser } from '@/rbac/checks';
export const defaultUserMiddleware: RouterMiddleware<DefaultUserMiddlewareOptions> = async (
to,
from,
next,
) => {
const valid = isDefaultUser();
if (!valid) {
return next({ name: VIEWS.HOMEPAGE });
}
};