Skip to content

Commit

Permalink
fix: missing cache module for role permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
rahul-rocket committed Mar 18, 2024
1 parent d6d8dcd commit f60fe3e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions packages/core/src/role-permission/role-permission.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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 { }
4 changes: 2 additions & 2 deletions packages/core/src/shared/guards/tenant-permission.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit f60fe3e

Please sign in to comment.