I am having issues using access control using cerbos
I have imported the example implementation of access controll using cerbos
and it has code as follows :
11 Replies
Hi @srinivasbhuvanagiri. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
xenophobic-harlequin•15mo ago
i am not able to access resources
----------------------
It seems like you haven't provided the code you're referring to. However, based on the information extracts, I can provide you with an example implementation of access control using Cerbos in a refine project.
First, install Cerbos:
Then, create a Cerbos object in the
App.tsx
file and define it in <Refine>
:
This example demonstrates how to use refine and Cerbos to simplify access control management throughout your application. For more information, refer to the refine Access Control Provider documentation (https://refine.dev/docs/api-reference/core/providers/accessControl-provider/) and the Cerbos example source code (https://github.com/refinedev/refine/tree/master/examples/access-control-cerbos).
----------------------
Note: you can ask me a follow up question by @ mentioning me again
:speech_balloon:
----------------------<@1016596495673339954> kapa.ai is still learning and improving, please let us how it did by reacting below
xenophobic-harlequin•15mo ago
![No description](https://cdn.answeroverflow.com/1122856752103305246/image.png)
xenophobic-harlequin•15mo ago
can anyone please help me
i am not able to implement cerbos
role based authorization
adverse-sapphire•15mo ago
Hey @srinivasbhuvanagiri have you tried using
console.log
to get information about what's not working? Maybe try to get some information about the answers that the cerbos client library provides like: console.log({ action, params, resource, result })
I think check the parameters that are being passed to cerbos would also make sense. Or using the library in isolation first to understand how it's working.xenophobic-harlequin•15mo ago
where do we define policies when we are using refine
@bastianwegge how do we define policies
adverse-sapphire•15mo ago
@srinivasbhuvanagiri everything related to your authorization will be defined within cerbos. Refine only leverages the library you're including to call a specific command like
const result = await cerbos.check(cerbosPayload);
. The result of that command can then be used like shown above by kapa.ai (like result.isAuthorized
).
accessControlProvider
is basically a method to say "I want external authorization, here's how it looks like"xenophobic-harlequin•15mo ago
i am using cerbos admin api
so how can i integrate it with refine
@bastianwegge can you please help me out
with cerbos admin api i am creating policies dynamically
so i am not able to configure it with refine
can anyone help me
adverse-sapphire•15mo ago
@srinivasbhuvanagiri please either a concrete question or provide more information to work with, like some code inside of a codesandbox or on GitHub, otherwise we won't be able to help. Maybe take some time to read about the integration or look at the example here (https://refine.dev/docs/examples/access-control/cerbos/).