How to define a Deadbolt role in Java?

67 Views Asked by At

Deadbolt's documentation is sparse, really.

Let's say that I have a standard User. The User object I use has a method - "getThing"

I want a role that applies for a "getThing" value of more than 50.

How would I go about doing this? Is this possible, or am I misunderstanding deadbolt?

1

There are 1 best solutions below

0
Steve Chaloner On

Roles represent static constraints, e.g. the subject has role x and access to a resource requires the subject to have role y.

For your requirements, you need to use a dynamic constraint. This is some arbitrary rule defined by you that must be satisfied to allow access to a resource.

You can read about the different constraints in the documentation, including dynamic constraints.