odiseoteam / SyliusRbacPlugin

This plugin provides basic roles and permissions management functionality for Sylius.
MIT License
3 stars 0 forks source link

API requests denied due to RBAC redirect to admin login instead of returning a 40x error #9

Open rimas-kudelis opened 3 years ago

rimas-kudelis commented 3 years ago

We're using this plugin in combination with the API plugin and marketplace plugin, and, naturally, we want to restrict which products vendor users may access via the API.

I've decorated the AdministratorAccessChecker to also check permissions when accessing API endpoints, but now an attempt by a vendor user to access another vendor's product via the API causes a 302 redirect to the dashboard (and subsequently to the login page) instead of properly failing like API requests should.

I think a best fix for this would be to adjust AccessCheckListener to fail differently for non-HTML requests. At least that's the path I think I'm going to pursue for now.