Fix share page permissions
This commit is contained in:
1 parent
f41c0221c4
commit
9d477b25b4
7 files changed
+47
-29
No files matched your search
@@ -83,6 +83,10 @@ export function SharePage() {
|
||||
}
|
||||
}, [setTheme]);
|
||||
|
||||
// Check if the requested path is allowed
|
||||
const pageKey = path || '';
|
||||
const isAllowed = pageKey === '' || parameters[pageKey] === true;
|
||||
|
||||
const entityPage =
|
||||
shareType === ENTITY_TYPE.board && boardId ? (
|
||||
<BoardViewPage boardId={boardId} showActions={false} />
|
||||
@@ -92,6 +96,12 @@ export function SharePage() {
|
||||
<LinkPage linkId={linkId} showHeaderActions={false} />
|
||||
) : null;
|
||||
|
||||
useEffect(() => {
|
||||
if (!isAllowed) {
|
||||
router.replace(`/share/${slug}`);
|
||||
}
|
||||
}, [isAllowed, slug, router]);
|
||||
|
||||
if (entityPage) {
|
||||
return (
|
||||
<Column>
|
||||
@@ -101,12 +111,7 @@ export function SharePage() {
|
||||
);
|
||||
}
|
||||
|
||||
// Check if the requested path is allowed
|
||||
const pageKey = path || '';
|
||||
const isAllowed = pageKey === '' || parameters[pageKey] === true;
|
||||
|
||||
if (!isAllowed) {
|
||||
router.replace(`/share/${slug}`);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user