mirror of
https://github.com/docmost/docmost.git
synced 2026-08-25 15:57:11 +08:00
quick page sharing fix
This commit is contained in:
@@ -46,8 +46,9 @@ export class ShareService {
|
|||||||
throw new NotFoundException('Share not found');
|
throw new NotFoundException('Share not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
const isRestricted =
|
const isRestricted = await this.pagePermissionRepo.hasRestrictedAncestor(
|
||||||
await this.pagePermissionRepo.hasRestrictedAncestor(share.pageId);
|
share.pageId,
|
||||||
|
);
|
||||||
if (isRestricted) {
|
if (isRestricted) {
|
||||||
throw new NotFoundException('Share not found');
|
throw new NotFoundException('Share not found');
|
||||||
}
|
}
|
||||||
@@ -110,6 +111,9 @@ export class ShareService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getSharedPage(dto: ShareInfoDto, workspaceId: string) {
|
async getSharedPage(dto: ShareInfoDto, workspaceId: string) {
|
||||||
|
//TODO: we should resolve the page from the share id
|
||||||
|
if (!dto.pageId) throw new NotFoundException('Shared page not found');
|
||||||
|
|
||||||
const share = await this.getShareForPage(dto.pageId, workspaceId);
|
const share = await this.getShareForPage(dto.pageId, workspaceId);
|
||||||
|
|
||||||
if (!share) {
|
if (!share) {
|
||||||
@@ -126,8 +130,9 @@ export class ShareService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Block access to restricted pages
|
// Block access to restricted pages
|
||||||
const isRestricted =
|
const isRestricted = await this.pagePermissionRepo.hasRestrictedAncestor(
|
||||||
await this.pagePermissionRepo.hasRestrictedAncestor(page.id);
|
page.id,
|
||||||
|
);
|
||||||
if (isRestricted) {
|
if (isRestricted) {
|
||||||
throw new NotFoundException('Shared page not found');
|
throw new NotFoundException('Shared page not found');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user