Giter Site home page Giter Site logo

Comments (5)

schaloner avatar schaloner commented on August 24, 2024

This is the reason I changed the signature of getSubject in 2.3.3 to return a Subject and not a promise. You're using 2.3.2, I guess?

from deadbolt-2-java.

johdah avatar johdah commented on August 24, 2024

Yes, I will update. But I got the following error when rewriting the getSubject method.

[error] /home/johdah/Development/svn/MobitecAccess/branches/Johan/Hibernate/app/auth/MyDynamicResourceHandler.java:188: non-static method checkPatternEquality(be.objectify.deadbolt.core.models.Subject,java.lang.String) cannot be referenced from a static context
[error] DeadboltAnalyzer.checkPatternEquality

MyDynamicResourceHandler looks like this.

    public boolean isAllowed(final String name, final String meta, final DeadboltHandler deadboltHandler, final Http.Context ctx) {
        final DynamicResourceHandler handler = HANDLERS.get(name);

//      return deadboltHandler.getSubject(ctx).map(
//          new F.Function<Subject, Boolean>() {
//              @Override
//              public Boolean apply(Subject subject) throws Throwable {
        if(meta.isEmpty()) return true;
        Subject subject = deadboltHandler.getSubject(ctx);

        // Check if permission pattern applied as meta is allowed!
        if(!DeadboltAnalyzer.checkPatternEquality(subject, meta)) {
            Logger.debug(String.format("Access failed to %s", meta));
            return false;
        }

        boolean result = false;
        if (handler == null) {
            Logger.error("No handler available for " + name);
        } else {
            result = handler.isAllowed(name, meta, deadboltHandler, ctx);
        }
        return result;
//              }
//          }
//      ).get(1, TimeUnit.SECONDS);
    }

from deadbolt-2-java.

schaloner avatar schaloner commented on August 24, 2024

DeadboltAnalyzer's methods are not static any more, because people were asking for DI support. You can declare a static DeadboltAnalyzer in your MyDynamicResourceHandler class and reference that instead.

from deadbolt-2-java.

johdah avatar johdah commented on August 24, 2024

Thanks! Then it will hopefully work without the errors now then.

from deadbolt-2-java.

schaloner avatar schaloner commented on August 24, 2024

No further issues reported on this topic.

from deadbolt-2-java.

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.