mirror of
https://github.com/docmost/docmost.git
synced 2025-11-12 16:02:35 +10:00
validate
This commit is contained in:
@ -156,6 +156,9 @@ export class PageController {
|
||||
@AuthUser() user: User,
|
||||
) {
|
||||
const history = await this.pageHistoryService.findById(dto.historyId);
|
||||
if (!history) {
|
||||
throw new NotFoundException('Page history not found');
|
||||
}
|
||||
|
||||
const ability = await this.spaceAbility.createForUser(
|
||||
user,
|
||||
@ -175,7 +178,6 @@ export class PageController {
|
||||
@AuthUser() user: User,
|
||||
) {
|
||||
const ability = await this.spaceAbility.createForUser(user, dto.spaceId);
|
||||
console.log(ability.can(SpaceCaslAction.Read, SpaceCaslSubject.Page));
|
||||
if (ability.cannot(SpaceCaslAction.Read, SpaceCaslSubject.Page)) {
|
||||
throw new ForbiddenException();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user