Sun. Jun 30th, 2024

14. Magento. How to reset magento Admin user, role and resources permission to all

2 min read


Untitled Document

 

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

    magento_reset_admin_user_role_and_resources_permission_to_all_1

  2. So, lets see how to fix the problem if all resource permissions were set to none for the admin role .

  3. Login to your PhPmyAdmin panel to manage your database.
  4. Backup your database.
  5. Select your database and click on the SQL tab.
  6. Now we need to get current admin role details. Copy and paste the following query:
    1
    SELECT * FROM admin_role WHERE role_name = ‘Administrators’

    where Administrators – is Your admin role name

    magento_reset_admin_user_role_and_resources_permission_to_all_2

  7. Next step is to remove existing permissions for the Admin role. Copy and paste the following query:
    1
    2
    3
    4
    5
    DELETE admin_rule
     FROM admin_rule, admin_role
    WHERE
     admin_role.role_name = ‘Administrators’
     AND admin_rule.role_id = admin_role.role_id
  8. Lastly we need to update permission rule for the admin role. Copy and paste the following query:
    1
    2
    INSERT INTO admin_rule (role_id, resource_id, assert_id, role_type, permission)
    VALUES (‘1′,’all’, ‘0’, ‘G’, ‘allow’)
  9. 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.
  10. In some cases, Admin may be assigned to a wrong role
  11. If that is the case, please follow the steps bellow.
  12. To load your user information import the following query:
    1
    2
    3
    4
    SELECT ar.*, au.*
    FROM admin_user AS au
    INNER JOIN admin_role AS ar ON (au.user_id = ar.user_id)
    WHERE au.username = ‘username’
  13. To load Role information:
    1
    SELECT * FROM admin_role WHERE role_type = ‘G’
  14. To update your user for the proper role:
    1
    UPDATE 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.

 

June 2024
M T W T F S S
« Jun    
 12
3456789
10111213141516
17181920212223
24252627282930