validate
This commit is contained in:
parent
28ec542ed6
commit
f65e5c872b
1 changed files with 3 additions and 1 deletions
|
|
@ -156,6 +156,9 @@ export class PageController {
|
||||||
@AuthUser() user: User,
|
@AuthUser() user: User,
|
||||||
) {
|
) {
|
||||||
const history = await this.pageHistoryService.findById(dto.historyId);
|
const history = await this.pageHistoryService.findById(dto.historyId);
|
||||||
|
if (!history) {
|
||||||
|
throw new NotFoundException('Page history not found');
|
||||||
|
}
|
||||||
|
|
||||||
const ability = await this.spaceAbility.createForUser(
|
const ability = await this.spaceAbility.createForUser(
|
||||||
user,
|
user,
|
||||||
|
|
@ -175,7 +178,6 @@ export class PageController {
|
||||||
@AuthUser() user: User,
|
@AuthUser() user: User,
|
||||||
) {
|
) {
|
||||||
const ability = await this.spaceAbility.createForUser(user, dto.spaceId);
|
const ability = await this.spaceAbility.createForUser(user, dto.spaceId);
|
||||||
console.log(ability.can(SpaceCaslAction.Read, SpaceCaslSubject.Page));
|
|
||||||
if (ability.cannot(SpaceCaslAction.Read, SpaceCaslSubject.Page)) {
|
if (ability.cannot(SpaceCaslAction.Read, SpaceCaslSubject.Page)) {
|
||||||
throw new ForbiddenException();
|
throw new ForbiddenException();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue