Help for integrating the Laravel package
Forum rules: Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
#3438 by wassim.hattab
26 Sep 2016, 08:27
Hello,
i'm trying to set permission to the admin in the expert mode so he cannot change or add or delete a catalog i just want to let him to add a product to a catalog so i saw the request that is sent to do action and i realized that there is different method name sent either insertItems or save items or...
i created a new permission in my backend
and in the do action i'm verifying if this admin has access to modify catalog but i can't find a way to redirect him back
aimeospermission.jpg
aimeospermission.jpg (36.97 KiB) Viewed 409 times


but i'm getting error and it's keep loading and if i remove the output and send an empty array it gave me error undefined variazble output and if i delete the array it's also giving me an error
Any recommendation?
#3442 by aimeos
26 Sep 2016, 10:17
You can only return an error object for JSON RPC calls, redirects won't have any effects (it's AJAX).

If you want to allow only adding products to categories, the simple admin interface can do this as well (in the product detail view). This would be much easier.
#3450 by wassim.hattab
26 Sep 2016, 15:53
ok i added
throw new \Exception( 'You do not have permission to the folowing action!' );

But it's not showing as alert like other exceptions it's showing in the inspect element network
is there a method to show the exception as alert?
#3452 by aimeos
26 Sep 2016, 16:09
Throwing an exception in the Laravel code doesn't transform into a JSON RPC error message. You have to build and return a JSON response yourself. Use this code as example: https://github.com/aimeos/ai-admin-extadm/blob/master/controller/extjs/src/Controller/ExtJS/JsonRpc.php#L157