Giter Club home page Giter Club logo

Comments (9)

andoriyu avatar andoriyu commented on September 8, 2024 1

I think a way to fix it is to change adapter::remove_filtered_policy to accept vectors of any length and change query based on length.

from sqlx-adapter.

hsluoyz avatar hsluoyz commented on September 8, 2024 1

@andoriyu can you make a PR?

from sqlx-adapter.

casbin-bot avatar casbin-bot commented on September 8, 2024

@smrpn @hackerchai @PsiACE @GopherJ

from sqlx-adapter.

andoriyu avatar andoriyu commented on September 8, 2024

Using debugger, I narrowed down the issue to this area of the code:

    async fn remove_filtered_policy(
        &mut self,
        _sec: &str,
        pt: &str,
        field_index: usize,
        field_values: Vec<String>,
    ) -> Result<bool> {
        if field_index <= 5 && !field_values.is_empty() && field_values.len() >= 6 - field_index {
            adapter::remove_filtered_policy(&self.pool, pt, field_index, field_values).await
        } else {
            Ok(false)
        }
    }

field_values.len() is 0, so it short circuits to Ok(false) branch.

from sqlx-adapter.

hsluoyz avatar hsluoyz commented on September 8, 2024

@PsiACE

from sqlx-adapter.

andoriyu avatar andoriyu commented on September 8, 2024

@andoriyu can you make a PR?

@hsluoyz sure I will try to put it together later today (PDT).

Would you be open if I change casbin-rs API a bit? (not in this PR)

Right now, Rule is Vec<String>. I can make polymorphic and accept things like: [String; N], tuples with up to 6 values etc.

from sqlx-adapter.

hsluoyz avatar hsluoyz commented on September 8, 2024

@andoriyu we should not introduce breaking change. But we can add appropriate new APIs.

from sqlx-adapter.

andoriyu avatar andoriyu commented on September 8, 2024

@hsluoyz the I was thinking doing would keep backward compatibility, just in addition to Vec<String> in will take other things.

from sqlx-adapter.

hsluoyz avatar hsluoyz commented on September 8, 2024

@andoriyu no breaking change then OK!

from sqlx-adapter.

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.