Is current user logged in in Cockpit? Do he/she has rights to modify current content?

Hi all, I am new in Cockpit. This tool is awesome! Thanks

I have a HTML + CSS site, consuming data through Cockpit API. Everything was easy to configure and is working fine.

Now, I would like to show an “edit button” in front-end to site editors, whenever they have rights to modify the content they are browsing.

Which is the right way to check if current user is logged and has permissons to modify a specific content in Cockpit, in the same browser instance that he/she is using to navigate?

Thanks in advance