2.0.0
What's Changed
- update packages [snyk] by @obsd in #19
- Throw more accurate exceptions in case OPA or the PDP return an error response or timeout
- get user permissions from the PDP now returns roles as well
- get user tenants directly from the PDP:
List<TenantDetails> userTenants = permit.getUserTenants(
User.fromString("auth0|elon")
);
Breaking changes
All check functions will now throw a more accurate PermitApiError
that contains a status code as well as the actual error in case the call to OPA or the PDP fails or encounters a timeout.
Changes required in your code
You need to add a catch block to this code example, instead of:
import io.permit.sdk.Permit;
import io.permit.sdk.PermitConfig;
Permit permit = new Permit( ... );
try {
boolean permitted = permit.check(
User.fromString("[USER KEY]"),
"create",
Resource.fromString("document")
);
} catch (IOException e) {
fail("got error: " + e);
}
you'll need to also catch PermitApiError
:
import io.permit.sdk.Permit;
import io.permit.sdk.PermitConfig;
Permit permit = new Permit( ... );
try {
boolean permitted = permit.check(
User.fromString("[USER KEY]"),
"create",
Resource.fromString("document")
);
} catch (IOException e) {
fail("got error: " + e);
} catch (PermitApiError e) {
fail("got error: " + e);
}
Full Changelog: 1.4.0...2.0.0