14. Magento. How to reset magento Admin user, role and resources permission to all
2 min read
Untitled Document
- In some cases, while managing User Role / Permissions, all resource permissions may be set to none for the admin role. If this happens, you won’t be able to login to admin panel and/or you will receive the following error
-
So, lets see how to fix the problem if all resource permissions were set to none for the admin role .
- Login to your PhPmyAdmin panel to manage your database.
- Backup your database.
- Select your database and click on the SQL tab.
- Now we need to get current admin role details. Copy and paste the following query:
1SELECT * FROM admin_role WHERE role_name = ‘Administrators’
where Administrators – is Your admin role name
- Next step is to remove existing permissions for the Admin role. Copy and paste the following query:
12345DELETE admin_ruleFROM admin_rule, admin_roleWHEREadmin_role.role_name = ‘Administrators’AND admin_rule.role_id = admin_role.role_id
- Lastly we need to update permission rule for the admin role. Copy and paste the following query:
12INSERT INTO admin_rule (role_id, resource_id, assert_id, role_type, permission)VALUES (‘1′,’all’, ‘0’, ‘G’, ‘allow’)
- Go back to your site admin, reload the page and try to login. You should be able to access your admin panel and manage your site.
- In some cases, Admin may be assigned to a wrong role
- If that is the case, please follow the steps bellow.
- To load your user information import the following query:
1234SELECT ar.*, au.*FROM admin_user AS auINNER JOIN admin_role AS ar ON (au.user_id = ar.user_id)WHERE au.username = ‘username’
- To load Role information:
1SELECT * FROM admin_role WHERE role_type = ‘G’
- To update your user for the proper role:
1UPDATE admin_role SET parent_id = [put selected role_id here] WHERE user_id = [your USER id]
where [your USER id] is your actual User ID
Thank you for reading this video tutorial. Now you know how to reset magento Admin user, role and resources permission to all in Magento.