import { Injectable , CanActivate , ExecutionContext } from '@nestjs/common' ; @ Injectable ( ) export class SuperUserGuard implements CanActivate { param context { ExecutionContext } returns { Promise < boolean > } async canActivate ( context ) { const { user } = context . switchToHttp ( ) . getRequest ( ) ; return ! ! user . isSuperUser ; } }