Seeking advice on How to Implement Site Access Plugin

I have a plugin that provisions access to sites for existing Matomo users. It has been working really well for those that already have access to at least 1 site. I am unsure how to implement it to support users with no current site access. I implemented the plugin as a controller action. It looks like users without at least read access to 1 site are forbidden to execute actions on the plugin as they get the no access error. Any tips? This is the plugin https://github.com/jbrule/matomoplugin-SiteAccessProvisioner.

Thank you,
Josh

Hi @jbrulz
Maybe @RonanChardonneau or @ronan_hello can give some tips? They already created some plugins…

Hello,

I need more context to be get a complete response.
This plugin is used to sync CMS users to Matomo and grant site access right ?

Did you try using the API ? With bulk request ?
You will be able to handle users with 1, n or 0 websites in a row without any limitations.

But if you want a fancy GUI in order to reproduce the action several times, you may contact the plugin editor and hope for an update.

Regards,
Ronan

Looks like Matomo’s permission checks are blocking users with no site access. You can bypass this using @NoAccessRequired and handle access inside your plugin instead. Also check how core plugins manage global permissions for similar cases.