Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magento 2: setup upgrade error "We can't find the role for the user you wanted"

Tags:

magento2

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.

like image 721
Abdullah Avatar asked Nov 29 '22 22:11

Abdullah


2 Answers

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.

like image 183
Isolde Avatar answered Dec 23 '22 21:12

Isolde


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,

like image 44
Kashif Avatar answered Dec 23 '22 20:12

Kashif