fix: update guard message

This commit is contained in:
fantasticit 2022-04-05 13:37:23 +08:00
parent 6496422754
commit dbbb7ead56
2 changed files with 3 additions and 3 deletions

View File

@ -49,12 +49,12 @@ export class DocumentAuthorityGuard implements CanActivate {
if (needAuth === 'createUser') {
if (document.createUserId !== user.id) {
throw new HttpException('您不是该文档的创建者,无法删除', HttpStatus.FORBIDDEN);
throw new HttpException('您不是该文档的创建者,无法操作', HttpStatus.FORBIDDEN);
}
} else if (needAuth) {
const authority = await this.documentService.getDocumentAuthority(documentId, user.id);
if (!authority || !authority[needAuth]) {
throw new HttpException('您无权查看此文档', HttpStatus.FORBIDDEN);
throw new HttpException('您无权操作此文档', HttpStatus.FORBIDDEN);
}
}

View File

@ -46,7 +46,7 @@ export class WikiUserRoleGuard implements CanActivate {
const wikiUser = await this.wikiService.findWikiUser(wikiId, user.id);
if (!wikiUser && targetUserRole && wikiUser.userRole !== targetUserRole) {
throw new HttpException('您无权查看该知识库', HttpStatus.FORBIDDEN);
throw new HttpException('您无权操作该知识库', HttpStatus.FORBIDDEN);
}
return true;