mirror of
https://github.com/docmost/docmost.git
synced 2026-05-07 06:23:06 +08:00
check
This commit is contained in:
+1
-1
Submodule apps/server/src/ee updated: 247e5eb7d1...05d3f55c78
@@ -16,6 +16,7 @@ import { User } from '@docmost/db/types/entity.types';
|
|||||||
import SpaceAbilityFactory from '../../core/casl/abilities/space-ability.factory';
|
import SpaceAbilityFactory from '../../core/casl/abilities/space-ability.factory';
|
||||||
import { JwtAuthGuard } from '../../common/guards/jwt-auth.guard';
|
import { JwtAuthGuard } from '../../common/guards/jwt-auth.guard';
|
||||||
import { PageRepo } from '@docmost/db/repos/page/page.repo';
|
import { PageRepo } from '@docmost/db/repos/page/page.repo';
|
||||||
|
import { PageAccessService } from '../../core/page-access/page-access.service';
|
||||||
import {
|
import {
|
||||||
SpaceCaslAction,
|
SpaceCaslAction,
|
||||||
SpaceCaslSubject,
|
SpaceCaslSubject,
|
||||||
@@ -32,6 +33,7 @@ export class ExportController {
|
|||||||
private readonly exportService: ExportService,
|
private readonly exportService: ExportService,
|
||||||
private readonly pageRepo: PageRepo,
|
private readonly pageRepo: PageRepo,
|
||||||
private readonly spaceAbility: SpaceAbilityFactory,
|
private readonly spaceAbility: SpaceAbilityFactory,
|
||||||
|
private readonly pageAccessService: PageAccessService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
@UseGuards(JwtAuthGuard)
|
@UseGuards(JwtAuthGuard)
|
||||||
@@ -50,10 +52,7 @@ export class ExportController {
|
|||||||
throw new NotFoundException('Page not found');
|
throw new NotFoundException('Page not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
const ability = await this.spaceAbility.createForUser(user, page.spaceId);
|
await this.pageAccessService.validateCanView(page, user);
|
||||||
if (ability.cannot(SpaceCaslAction.Read, SpaceCaslSubject.Page)) {
|
|
||||||
throw new ForbiddenException();
|
|
||||||
}
|
|
||||||
|
|
||||||
const zipFileStream = await this.exportService.exportPages(
|
const zipFileStream = await this.exportService.exportPages(
|
||||||
dto.pageId,
|
dto.pageId,
|
||||||
|
|||||||
Reference in New Issue
Block a user