How to use Elasticseach API in kibana custom plugin?

I have a custom plugin created, I want to get current user login details to check whether the user is admin or not. I found out Elasticseach API this can be used to do so, but I did not get any proper way to use it.

Can anybody reply with the procedure to do so? How can I use this call in kibana plugin public/components/app.tsx or in server.route call?

Hello @Disha_Bodade

What version of kibana are you developing for?

Which privileges do you need the user to have? There are a lot of different options. You could look at the user and roles settings to determine what you need and then we could find a programmatic way to check.

I am developing for kibana-7.10.2.
I don't want to give any privileges to user. I want to check what privileges user has. For example: user1 logged in through kibana and that user has backend role as admin. then that user1 should be able to access plugin page. if it does not has backend role as admin, that user shouldn't be able to access the plugin page.

yes, for above scenario I want to do it programmatically in kibana client side or server side.

You should use the capabilities api. unfortunately its not well documented.

I recommend looking at the index pattern management plugin to see how its used

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.