最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

casl $exists operator not working correctly in ability.can method - Stack Overflow

programmeradmin0浏览0评论

Describe the bug Rule conditions with $exists operator not working correctly in the ability.can method. The syntax is correct and using the accessibleBy function returns the correct query conditions. Checking with the ability.can method returns false on the same objects that match the conditions of the query above, removing conditions with the $exists operator fix the issue. The debugging methods aren't helping either

To Reproduce Steps to reproduce the behavior: 1- Create a mongoose model 2- create rules for mongoose model with condition that uses the $exists operator 3- create ability with createMongoAbility using those rules 3- get objects using query conditions returned by accessibleBy method 4- use the ability.can method on those same objects returned by the query

Expected behavior ability.can method should be working correctly with $exists operator

Interactive example

CASL Version

@casl/ability - v 6.7.3 @casl/mongoose - v 8.0.3

Environment: nodejs version tested 20 -> 23

发布评论

评论列表(0)

  1. 暂无评论