Code Monkey home page Code Monkey logo

Comments (5)

fratzinger avatar fratzinger commented on August 17, 2024 3

released as v0.5.0

from feathers-casl.

fratzinger avatar fratzinger commented on August 17, 2024

Please fork the repo, do the changes to your fork and make a PR with the new test.
Would you please also add a test with:

    can("read", "tests", {
      $or: [
        { published: true }
        { user_id: { $in: [1] } },
      ]
    });
}

I know Casl states out, that this is not possible, but I would like to see the outcome.

I see that you're not using rulesToQuery or other helpers that CASL provides for this kind of thing. Is there a reason for that?
As stated on slack before, the following will not work properly with rulesToQuery:

rule: can('find', 'posts', { id: { $in: [1, 2, 3] } })
query: service('posts').find({ query: { id: { $in: [1, 2] } } } );

Expected:
finds 2 items with ids 1 and 2

Actually:
finds 3 items with ids 1, 2 and 3

from feathers-casl.

fratzinger avatar fratzinger commented on August 17, 2024

The problem with rulesToQuery is, that not all adapters support $not, $and and $nor (toMongoQuery).
I've started a new branch: https://github.com/fratzinger/feathers-casl/tree/multiple-adapters to test against most of the popular adapters.

from feathers-casl.

fratzinger avatar fratzinger commented on August 17, 2024

Please have a look at: https://github.com/fratzinger/feathers-casl/tree/logical-or that consequently integrates the $or logical

from feathers-casl.

fratzinger avatar fratzinger commented on August 17, 2024

I consider this ready now for v0.5.0 but I need some investigations. Stay tuned.

from feathers-casl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.