chore: guest user profile access-related problem (#3089)
* fix: resolve guest user profile access-related problem * chore: header and app sidebar permission validation added
This commit is contained in:
parent
2605b938f0
commit
6c61fbd102
4 changed files with 60 additions and 37 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import { observer } from "mobx-react-lite";
|
||||
import { useRouter } from "next/router";
|
||||
// mobx store
|
||||
import { useMobxStore } from "lib/mobx/store-provider";
|
||||
// components
|
||||
|
|
@ -14,6 +15,7 @@ const AUTHORIZED_ROLES = [20, 15, 10];
|
|||
|
||||
export const ProfileAuthWrapper: React.FC<Props> = observer((props) => {
|
||||
const { children, className, showProfileIssuesFilter } = props;
|
||||
const router = useRouter();
|
||||
|
||||
const {
|
||||
user: { currentWorkspaceRole },
|
||||
|
|
@ -23,12 +25,14 @@ export const ProfileAuthWrapper: React.FC<Props> = observer((props) => {
|
|||
|
||||
const isAuthorized = AUTHORIZED_ROLES.includes(currentWorkspaceRole);
|
||||
|
||||
const isAuthorizedPath = router.pathname.includes("assigned" || "created" || "subscribed");
|
||||
|
||||
return (
|
||||
<div className="h-full w-full md:flex md:flex-row-reverse md:overflow-hidden">
|
||||
<ProfileSidebar />
|
||||
<div className="flex w-full flex-col md:h-full md:overflow-hidden">
|
||||
<ProfileNavbar isAuthorized={isAuthorized} showProfileIssuesFilter={showProfileIssuesFilter} />
|
||||
{isAuthorized ? (
|
||||
{isAuthorized || !isAuthorizedPath ? (
|
||||
<div className={`w-full overflow-hidden md:h-full ${className}`}>{children}</div>
|
||||
) : (
|
||||
<div className="grid h-full w-full place-items-center text-custom-text-200">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue