cancel
Showing results for 
Search instead for 
Did you mean: 

Admin roles have been changed by accident no none of us can do anything

Highlighted

Admin roles have been changed by accident no none of us can do anything

Morning all, hope we're all well.

We were in the process of changing someone's permissions and somehow (and we don't know how) the Job roles of Admin users has been pretty much unticked so nobody has access to anything except very basic admin panel.

This means we can't modify any users as the entire team now has no permissions.

We've created a new user using scripts but that just gives the new user the same (minimal privileges as the rest of us - almost none.

Any help appreciated.

Magento ver. 2.3.4-p2 

1 REPLY 1
Highlighted

Re: Admin roles have been changed by accident no none of us can do anything

@noel_vance ,

try reset all user through MySQL: 


1. Create a mysqldump of the current database
2. reset all admin users Truncating three Table using.

 

TRUNCATE TABLE admin_user;
TRUNCATE TABLE authorization_role;
TRUNCATE TABLE authorization_rule;

3: Insert new User in with All Roles , Run below three Command

 

 

INSERT INTO admin_user (user_id, firstname, lastname, email, username, password, created, modified, logdate, lognum, reload_acl_flag, is_active, extra, rp_token, rp_token_created_at, interface_locale, failures_num, first_failure, lock_expires, refresh_token) VALUES (1, 'Amit', 'Emizen', 'emizen@example.com', 'amit_emizen', '45cf9053530ceb9fde49794d9e6d81fd2ce481b0136067986a5c9bc139a7d08f:FivE4hOQqPtW1xdE:2', '2020-10-11 10:48:31', '2019-09-09 13:20:42', '2020-10-11 13:20:42', 46, 0, 1, '{"configState":{"contact_contact":"1","web_default_layouts":"0","web_default":"1","web_secure":"1","web_seo":"1","web_unsecure":"1","wishlist_wishlist_link":"1","wishlist_email":"1","wishlist_general":"1","admin_emails":"0","admin_startup":"0","dev_front_end_development_workflow":"1","dev_restrict":"0","dev_debug":"1","dev_template":"0","sw_megamenu_general":"1","newsletter_general":"1","newsletter_subscription":"1","dev_js":"0","admin_security":"0","admin_url":"0","admin_dashboard":"0","admin_captcha":"0","sw_megamenu_custom_links":"1","sw_megamenu_cat_labels":"1","cms_wysiwyg":"1","catalog_frontend":"1","catalog_fields_masks":"0","catalog_review":"1","catalog_productalert":"1","catalog_productalert_cron":"1","catalog_placeholder":"1","catalog_recently_products":"1","catalog_product_video":"0","catalog_price":"0","catalog_layered_navigation":"1","catalog_search":"0","catalog_seo":"0","catalog_navigation":"1","catalog_downloadable":"1","catalog_custom_options":"0","layered_navigation_module":"1","layered_navigation_general":"1","carriers_flatrate":"1","carriers_freeshipping":"1","carriers_tablerate":"1","carriers_temando":"1","carriers_ups":"1","carriers_usps":"1","carriers_fedex":"1","carriers_dhl":"1","shipping_origin":"1","shipping_shipping_policy":"1","tax_vertex_settings":"1","tax_classes":"1","tax_calculation":"1","tax_defaults":"1","tax_display":"1","tax_cart_display":"1","tax_sales_display":"1","tax_weee":"1","tax_vertex_seller_info":"0","tax_vertex_delivery_terms":"0","tax_avaiable_shipping_product_codes":"0","tax_vertex_logging":"0","dev_grid":"0","dev_static":"0","dev_image":"0","dev_css":"0","dev_translate_inline":"0","general_store_information":"1","general_single_store_mode":"1","general_locale":"1","general_region":"1","general_country":"1","productinquiry_general_option":"1","productinquiry_google_captcha":"1","productinquiry_email_setting":"1","trans_email_ident_general":"1","product_attachment_general":"1","product_attachment_display_configuration":"1"}}', NULL, NULL, 'en_US', 0, NULL, NULL, NULL);

INSERT INTO authorization_role (role_id, parent_id, tree_level, sort_order, role_type, user_id, user_type, role_name) VALUES (1, 0, 1, 1, 'G', 0, '2', 'Administrators'), (2, 1, 2, 0, 'U', 1, '2', 'admin');

INSERT INTO authorization_rule (rule_id, role_id, resource_id, privileges, permission) VALUES (1, 1, 'Magento_Backend::all', NULL, 'allow');

4. now flush Magento cache 

 

 

php bin/magento cache:flush ;
    
php bin/magento cache:clean ;

5. try to login with : 

 

  • username: admin
  • password: admin@123

it may not work as the HASH will be different so try creating a new user from the command line now 

php bin/magento admin:user:create --admin-user=amit_emizen --admin-password=emizen123456 --admin-email=amitemizen@example.com --admin-firstname=Amit --admin-lastname=EmizenTech

I hope it helps.