Skip to content

Commit

Permalink
Merge pull request #468 from permitio/gidi/per-11478-update-permit-ja…
Browse files Browse the repository at this point in the history
…va-docs-new-getuserpermissionfromopa

Update getuserpermission section - add new fucntino getUserPermission…
  • Loading branch information
gideonsmila authored Dec 23, 2024
2 parents be5d47b + 91c788d commit 93d0623
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion docs/how-to/enforce-permissions/user-permissions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,38 @@ UserPermissions permissions = permit.getUserPermissions(
);

```
</TabItem>

## Get user permissions directly from opa

:::info Note
This feature is not supported when using FactDB and should not be used with FactDB enabled on the PDP
:::

:::info Info
When experiencing high load, it may be more efficient to call the OPA engine directly from the SDK.
Please note that to enable this, you will need to expose the OPA port (8181).
:::

```java
import io.permit.sdk.Permit;
import io.permit.sdk.PermitConfig;
import io.permit.sdk.enforcement.*;
import io.permit.sdk.util.Context;
import java.util.Arrays;


Permit permit = new Permit(
new PermitConfig.Builder("[YOUR_API_KEY]").build()
);

UserPermissions permissions = permit.getUserPermissionsFromOPA(
new GetUserPermissionsQuery(
User.fromString("john@doe.com")
)
);

```
</TabItem>
</Tabs>


0 comments on commit 93d0623

Please sign in to comment.