mirror of
https://github.com/fantasticit/think.git
synced 2026-10-30 22:56:06 +08:00
fix: update guard message
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user