Closed arnofo closed 5 years ago
I don't think, that it's dirty fix, but a desired solution for now. I just did the same.
Maybe it should be mentioned in readme to override RouteNameCheckerInterface
service.
I agree with @diimpp. Overwriting the default service is totally the way you should customize the behavior of this plugin. The other question is, how can we make it easier and more developer-friendly :) We can start with adding such a tip to the plugin's README.
I have custom resource "article"
I configured this custom section for rbac
The entry "Articles" is properly hidden from the main menu but is still accessible via URL.
I have not had the time to look into a proper fix but i noticed the file
App\Rbac\Access\Checker\HardcodedRouteNameChecker
has a functionisAdminRoute
which looks for route prefixes to determine if it is an admin route.My custom resource being prefix with
app_admin
, this will return false.(This function is called in
Sylius\RbacPlugin\Access\Listener\AccessCheckListener::createAccessRequestFromEvent
, which i believe is responsible for preventing access by url)Dirty fix
Create you own file
HardcodedRouteNameChecker
override the bundle's class