From dbbb7ead565011b0b927578b9f841c3fcc8aabb9 Mon Sep 17 00:00:00 2001 From: fantasticit Date: Tue, 5 Apr 2022 13:37:23 +0800 Subject: [PATCH] fix: update guard message --- packages/server/src/guard/document-auth.guard.ts | 4 ++-- packages/server/src/guard/wiki-user.guard.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/server/src/guard/document-auth.guard.ts b/packages/server/src/guard/document-auth.guard.ts index ab600cb2..0e2c4144 100644 --- a/packages/server/src/guard/document-auth.guard.ts +++ b/packages/server/src/guard/document-auth.guard.ts @@ -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); } } diff --git a/packages/server/src/guard/wiki-user.guard.ts b/packages/server/src/guard/wiki-user.guard.ts index cf7655ae..9256d8ee 100644 --- a/packages/server/src/guard/wiki-user.guard.ts +++ b/packages/server/src/guard/wiki-user.guard.ts @@ -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;