GithubHelp home page GithubHelp logo

Comments (6)

rsinger86 avatar rsinger86 commented on May 4, 2024 1

from drf-access-policy.

HonakerM avatar HonakerM commented on May 4, 2024

@rsinger86 Any help would be greatly appreciated. I thought that the issue could be happening because of a user error but here is my current config and the error still appears:

class GenericObjectPermission(AccessPolicy):
    # ? Used for actual operations
    statements =  [
        {
            "action":["*"],
            "principal":"authenticated",
            "effect":"allow",
            "condition":"is_adminoffice"
        },
        {
            "action":["*"],
            "principal":"authenticated",
            "effect":"allow",
            "condition":"is_sysadmin"
        },

    def is_sysadmin(self, request, view, action) -> bool:
        return True

    def is_adminoffice(self, request, view, action) -> bool:
        return True

The request normally works but sometimes it will fail. This only happens in browser (I have been unable to reproduce it with curl)

from drf-access-policy.

rsinger86 avatar rsinger86 commented on May 4, 2024

I'm leaning toward a 1.0 release with a breaking change that delineates the following:

  • method conditions that contain complex boolean expressions and are evaluated with pyparsing
  • simple method conditions that reference a single method

I made a mistake in not doing this from the start (see #55). I'm thinking the best way to handle would be to have a separate expression_condition key. With this update, your statements would avoid pyparsing.

from drf-access-policy.

HonakerM avatar HonakerM commented on May 4, 2024

@rsinger86 Thank you for your response and for this project! It has really helped ease the development of my product.

How can I go about avoiding this issue (Im planning on opening up my project to beta and this is kinda the last blocker)? I've seen this happen with both simple method conditions as well as a basic complex expression e.g. (is_adminoffice or is_sysadmin) so I'm not really sure how to stop/avoid it. I can also downgrade to 0.8.6 if this error does not occur there.

Thank you again for your help.

from drf-access-policy.

rsinger86 avatar rsinger86 commented on May 4, 2024

@HonakerM the 1.0 release should make this work for you

from drf-access-policy.

HonakerM avatar HonakerM commented on May 4, 2024

@rsinger86 just checked and it works perfectly!! Will let you know if I encounter the error again. Thank you again for all your work.

from drf-access-policy.

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.