diff --git a/packages/core/src/role-permission/role-permission.module.ts b/packages/core/src/role-permission/role-permission.module.ts index b6fa5084211..2f064cfc10e 100644 --- a/packages/core/src/role-permission/role-permission.module.ts +++ b/packages/core/src/role-permission/role-permission.module.ts @@ -2,6 +2,7 @@ import { forwardRef, Module } from '@nestjs/common'; import { TypeOrmModule } from '@nestjs/typeorm'; import { CqrsModule } from '@nestjs/cqrs'; import { RouterModule } from '@nestjs/core'; +import { CacheModule } from '@nestjs/cache-manager'; import { MikroOrmModule } from '@mikro-orm/nestjs'; import { RolePermissionController } from './role-permission.controller'; import { RolePermission } from './role-permission.entity'; @@ -17,10 +18,11 @@ import { TypeOrmRolePermissionRepository } from './repository'; forwardRef(() => TypeOrmModule.forFeature([RolePermission])), forwardRef(() => MikroOrmModule.forFeature([RolePermission])), forwardRef(() => RoleModule), - CqrsModule + CqrsModule, + CacheModule.register({ isGlobal: true }) ], controllers: [RolePermissionController], providers: [RolePermissionService, TypeOrmRolePermissionRepository], - exports: [TypeOrmModule, MikroOrmModule, RolePermissionService, TypeOrmRolePermissionRepository] + exports: [TypeOrmModule, MikroOrmModule, CacheModule, RolePermissionService, TypeOrmRolePermissionRepository] }) export class RolePermissionModule { } diff --git a/packages/core/src/shared/guards/tenant-permission.guard.ts b/packages/core/src/shared/guards/tenant-permission.guard.ts index 81d470f5dba..283fbc0525c 100644 --- a/packages/core/src/shared/guards/tenant-permission.guard.ts +++ b/packages/core/src/shared/guards/tenant-permission.guard.ts @@ -3,11 +3,11 @@ import { Reflector } from '@nestjs/core'; import { PermissionsEnum, RolesEnum } from '@gauzy/contracts'; import { environment as env } from '@gauzy/config'; import { isNotEmpty, PERMISSIONS_METADATA, removeDuplicates } from '@gauzy/common'; +import { Cache } from 'cache-manager'; +import { CACHE_MANAGER } from '@nestjs/cache-manager'; import { RequestContext } from './../../core/context'; import { TenantBaseGuard } from './tenant-base.guard'; import { RolePermissionService } from '../../role-permission/role-permission.service'; -import { Cache } from 'cache-manager'; -import { CACHE_MANAGER } from '@nestjs/cache-manager'; @Injectable() export class TenantPermissionGuard extends TenantBaseGuard implements CanActivate {