4

I got strange error while running command "php bin/magento setup:upgrade".

Error: We can't find the role for the user you wanted...

Unable to complete my all command process.

Please help.

2 Answers 2

16

in my case it was caused by Shopial_Facebook (which I do not need). I ran

php bin/magento module:disable Shopial_Facebook 

cleared cache and the error was gone. I hope it helps.

2
  • 1
    Please note that Shopial_Facebook has been removed from the Magento base as of Magento 2.2.6 so upgrading to 2.2.6 also does the trick.
    – Isolde
    Commented Oct 12, 2018 at 13:45
  • Very strange.. thank you for confirming @Isolde that it's a good long-term fix too!
    – JustinP
    Commented Oct 24, 2018 at 14:46
4

Solution:

Please go to file: vendor/magento/module-authorization/Model/Acl/AclRetriever.php at line# 85 and edit below code into edit one:

Original Code:

        if (!$role) {
            throw new AuthorizationException(
                __('We can\'t find the role for the user you wanted.')
            );
        }
        $allowedResources = $this->getAllowedResourcesByRole($role->getId());

Edit Code:

        if (!$role) {
            $allowedResources = array();
        }

Now, please run setup:upgrade and rest commands.

Important:

Once success, please revert back the file.

Thanks,

2
  • Please dont do this. All admin users and permissions might get deleted. Commented Jun 8, 2022 at 16:49
  • Indeed, It doesn’t seems to be a permanent solution, it might be the module that is broken somewhere. Commented Oct 13, 2022 at 12:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.