I receive an error when referencing a menu item feed for the first time as an anonymous user.
The error is:
PHP Fatal error: Class 'Drupal\rest_menu_items\Plugin\rest\resource\AccessDeniedHttpException' not found in [application path]\modules\rest_menu_items\src\Plugin\rest\resource\RestMenuItemsResource.php on line 129
The error is occurring because of the condition:
$this->currentUser->hasPermission($permission)
... which is resolving to false for an anonymous user even though the anonymous role is properly assigned the permission to "View Published Content" as well as the permission to "Access GET on Menu items per menu resource".
Other items to note but hopefully shouldn't matter in my "non-traditional" setup is that this is a multi site setup, in a Windows/MSSQL Server environment, with Workbench modules installed.
Comments
Comment #2
fabianderijkI've tried this is multiple setups, and I cannot reproduce this.
Comment #3
fschwic commentedI had the same issue. After changing the menu and the module configuration I got the described error. After once retrieving the menu-json as admin, it was again working as anonymous user.
Comment #4
Robert_Gyllenberg commentedHi folks,
I have the same experience as fschwic The api works for a couple of hours, but then stops working.
After reloading as authenticated user, it also works from e.g. a private browsing anonymous user, but then again it stops working.
BR. /Robert
Comment #5
imiksuExperiencing same issue. I got it right away after enabling permissions for anonymous users to
Access GET on Menu items per menu resource.Comment #6
imiksuNote that this issue applies for the 1.2 release. DEV branch seems not having the same code and shouldn't cause issues I guess.
Comment #7
Robert_Gyllenberg commentedThank you iMiksu for pointing out the version. I was indeed running 8.x-1.2 and switching to the DEV-branch of (release 2017-02-20) solved the problem so far.
Comment #8
Robert_Gyllenberg commented