Open shankiflang opened 1 year ago
@shankiflang Did you find the problem? I have a imilar issue.
@shankiflang Did you find the problem? I have a imilar issue.
no! I ended up using casl without nest-casl by configuring my own permissions and this works.
Same here
Have you correctly imported the module features in your module?
@Module({
imports: [CaslModule.forFeature({ permissions })],
})
I had the same issue while testing and it was this missing import inside my beforeEach that triggered this error
it works, but in a specific way.
CaslModule.forRoot<Roles>({
// Role to grant full access, optional
superuserRole: Roles.admin,
// Function to get casl user from request
// Optional, defaults to `(request) => request.user`
getUserFromRequest: (request) => request.currentUser,
}),
must be in AppModule
and
@Module({
imports: [CaslModule.forFeature({ permissions })],
})
must be in the other one. and controller where you are going to use it must be in the same module where you declared CaslModule.forFeature({ permissions })
I'm running into this issue as well and it seems that everything works as expected when I import the CaslModule
in the same module where I import permissions but when I encapsulate the configuration in another module, re-export the CaslModule
and then import the parent module into the feature module, that's when I get this error. Hope it makes sense.
I think this is related to https://github.com/getjerry/nest-casl/issues/905 and I think the line of code that is commented out and is being mentioned in the other ticket is the reason this is happening as well.
Hi, I'm looking to use nest with casl (hence the use of this lib). I'm using prisma for the data part (which isn't native to nest-casl, so can cause problems). Here is the definition of my permissions:
And this is the error I receive: