mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-24 20:14:35 -04:00
refactor(edit): lazy-load relations
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
7f7886c5a7
commit
4e70044a2c
5 changed files with 26 additions and 20 deletions
|
@ -14,10 +14,14 @@ import {
|
|||
Param,
|
||||
Post,
|
||||
UseGuards,
|
||||
UseInterceptors
|
||||
UseInterceptors,
|
||||
} from '@nestjs/common';
|
||||
|
||||
import { AlreadyInDBError, ForbiddenIdError, NotInDBError } from '../../../errors/errors';
|
||||
import {
|
||||
AlreadyInDBError,
|
||||
ForbiddenIdError,
|
||||
NotInDBError,
|
||||
} from '../../../errors/errors';
|
||||
import { HistoryService } from '../../../history/history.service';
|
||||
import { SessionGuard } from '../../../identity/session.guard';
|
||||
import { ConsoleLoggerService } from '../../../logger/console-logger.service';
|
||||
|
|
|
@ -55,11 +55,11 @@ export class PermissionsGuard implements CanActivate {
|
|||
const note = await getNote(this.noteService, noteIdOrAlias);
|
||||
switch (permissions[0]) {
|
||||
case Permission.READ:
|
||||
return this.permissionsService.mayRead(user, note);
|
||||
return await this.permissionsService.mayRead(user, note);
|
||||
case Permission.WRITE:
|
||||
return this.permissionsService.mayWrite(user, note);
|
||||
return await this.permissionsService.mayWrite(user, note);
|
||||
case Permission.OWNER:
|
||||
return this.permissionsService.isOwner(user, note);
|
||||
return await this.permissionsService.isOwner(user, note);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue