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

mgalgano created an issue. See original summary.

fabianderijk’s picture

Status: Active » Closed (cannot reproduce)

I've tried this is multiple setups, and I cannot reproduce this.

fschwic’s picture

I 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.

Robert_Gyllenberg’s picture

Status: Closed (cannot reproduce) » Needs work

Hi 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

imiksu’s picture

Priority: Normal » Major

Experiencing same issue. I got it right away after enabling permissions for anonymous users to Access GET on Menu items per menu resource.

imiksu’s picture

Version: 8.x-1.0 » 8.x-1.2

Note that this issue applies for the 1.2 release. DEV branch seems not having the same code and shouldn't cause issues I guess.

Robert_Gyllenberg’s picture

Thank 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.

Robert_Gyllenberg’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.