新建一个demoRoles的守卫,nest generate guard demoRoles core/guards
This commit is contained in:
parent
37ab2ebe18
commit
3f353b9936
|
@ -0,0 +1,7 @@
|
||||||
|
import { DemoRolesGuard } from './demo-roles.guard';
|
||||||
|
|
||||||
|
describe('DemoRolesGuard', () => {
|
||||||
|
it('should be defined', () => {
|
||||||
|
expect(new DemoRolesGuard()).toBeDefined();
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { CanActivate, ExecutionContext, Injectable } from '@nestjs/common';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class DemoRolesGuard implements CanActivate {
|
||||||
|
canActivate(
|
||||||
|
context: ExecutionContext,
|
||||||
|
): boolean | Promise<boolean> | Observable<boolean> {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue