server: check organization

This commit is contained in:
fantasticit 2022-06-30 22:06:02 +08:00
parent 5f49205306
commit 9fa0df1f2f
1 changed files with 4 additions and 1 deletions

View File

@ -139,12 +139,15 @@ export class OrganizationService {
* @returns * @returns
*/ */
public async getOrganizationDetail(user: IUser, id: IOrganization['id']) { public async getOrganizationDetail(user: IUser, id: IOrganization['id']) {
const organization = await this.organizationRepo.findOne({ id });
if (!organization) {
throw new HttpException('组织不存在', HttpStatus.NOT_FOUND);
}
await this.authService.canView(user.id, { await this.authService.canView(user.id, {
organizationId: id, organizationId: id,
wikiId: null, wikiId: null,
documentId: null, documentId: null,
}); });
const organization = await this.organizationRepo.findOne({ id });
return organization; return organization;
} }