Showing posts with label permission. Show all posts
Showing posts with label permission. Show all posts

Wednesday, May 29, 2013

How to reset magento Admin user, role and resources permission to all?

scenario 1: All resource permissions were set to none for the admin role
Solution:
Step 1: Get current admin role details
SELECT * FROM admin_role WHERE role_name = 'Administrators' 
/*Administrators - is  Your admin role name*/
Step 2: Remove Existing permissions for the Admin role
/*clean all permission rules*/
DELETE admin_rule
 FROM admin_rule, admin_role
WHERE 
 admin_role.role_name = 'Administrators' /* Your admin role name*/
 AND admin_rule.role_id = admin_role.role_id
Step 3: Update Permission rule for the admin role
INSERT INTO admin_rule (role_id, resource_id, assert_id, role_type, permission)
VALUES ('1','all', '0', 'G', 'allow')
scenario 2: Admin was assignd to a wron role
Solution:
Step 1: Load your user information
    
  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'
Step 2: Load Role information
SELECT * FROM admin_role WHERE role_type = 'G'
Step 3:Update your user for the proper role
UPDATE admin_role SET parent_id = [put selected role_id here] WHERE user_id = [your USER id]