Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After upgrade to v20.7.0 I got some alert on Admin Login #4007

Closed
starnetwork opened this issue May 23, 2024 · 16 comments · Fixed by #4022
Closed

After upgrade to v20.7.0 I got some alert on Admin Login #4007

starnetwork opened this issue May 23, 2024 · 16 comments · Fixed by #4022
Labels

Comments

@starnetwork
Copy link

Preconditions (*)

  1. 20.7.0

Steps to reproduce (*)

  1. Login to Magento LTS Admin, click on Clicking here inside the alert box and getting Orphaned Role Resources empty page without any Roles.

Expected result (*)

  1. that magento admin will not show this alert.

Actual result (*)

  1. Attaching Screenshot of the error on admin login
  2. Attaching screenshot of the error on "Clicking here"

Screenshot 2024-05-23 132619
Screenshot 2024-05-23 132647

@fballiano
Copy link
Contributor

you see the alert but then when you click there's the "no records"? really weird

@kiatng what do you think?

btw this is the original PR #3647

@hirale
Copy link
Contributor

hirale commented May 23, 2024

confirmed.

@fballiano
Copy link
Contributor

@kiatng true, it happens only right after login, if you refresh the alert disappears

@starnetwork
Copy link
Author

@fballiano
true, refresh and the alert disappears but it's back every time any admin do login again and again

@fballiano
Copy link
Contributor

I know, but it was important to tell that to the original author of the PR for debug

@kiatng
Copy link
Contributor

kiatng commented May 24, 2024

I did a test on the latest next branch:

adminhtml.xml, add a Test resource:

<config>
    <acl>
        <resources>
            <admin>
                <children>
                    <celera_crib translate="label" module="crib">
                        <title>Celera Modules</title>
                        <children>
                            <crib translate="title">
                                <title>Crib Services</title>
                                <sort_order>1000</sort_order>
                            </crib>
                            <test translate="title">
                                <title>Test</title>
                                <sort_order>1100</sort_order>
                            </test>
                        </children>
                    </celera_crib>

Then in backend > System > Roles > select a role and toggle the checkbox of the resource > Save

image

Logout from backend.

Changed resource now to Test2 in adminhtml.xml

                            <test2 translate="title">
                                <title>Test2</title>
                                <sort_order>1100</sort_order>
                            </test2>

Login to backend, notice of orphaned resource Test:

image

Click on the link, the orphaned resource is listed:

image

I do not know why the grid can be empty. I will think about it.

@pquerner
Copy link
Contributor

Check the exception log file, maybe something is in there.

@fballiano
Copy link
Contributor

it happens for a customer of mine:
Screenshot 2024-05-24 alle 18 42 37

but then clicking on the link:

Screenshot 2024-05-24 alle 18 42 44

and in the table those resources are there:

Screenshot 2024-05-24 alle 18 46 48

@kiatng
Copy link
Contributor

kiatng commented May 26, 2024

@fballiano Could it be cache? Can you try refresh it?

@fballiano
Copy link
Contributor

@kiatng no it's been reset many times

@kiatng
Copy link
Contributor

kiatng commented May 27, 2024

@fballiano Need your help: what is the output array of Mage::getModel('admin/roles')->getResourcesList2D();? Do you see orphaned resources such as admin/storepickup/holidays/action listed in the array?

@fballiano
Copy link
Contributor

yes there are:

Screenshot 2024-05-27 alle 11 22 05

@JonLaliberte
Copy link
Contributor

Just wanted to confirm the problem as well.
After requesting a delete of ~30 orphaned roles, a message came up saying it deleted ~150. That's always scary.
Logged out, back in and the message came back, but the table is empty now.

@kiatng
Copy link
Contributor

kiatng commented May 30, 2024

Just wanted to confirm the problem as well. After requesting a delete of ~30 orphaned roles, a message came up saying it deleted ~150. That's always scary. Logged out, back in and the message came back, but the table is empty now.

That's because an orphaned resource may have several entries in the table admin_rule, for example if user1 to user5 are not allowed a resource, it'll have 5 entries in the table for the resource. That's why it reported deletion of 150.

Because I cannot replicate the annoying message and empty grid, I am stumped why this happen to some people. I am still working on it trying to pin point the source. @fballiano is helping me on this.

I welcome any lead or theory.

@kiatng
Copy link
Contributor

kiatng commented May 31, 2024

With @fballiano help, I finally managed to replicate the bug. Please allow a few days to find the cause.

The bug is that the notice about orphaned resources is wrong. However, I think the empty grid is correct, so there is no danger of wrongly deleting resources.

@kiatng
Copy link
Contributor

kiatng commented May 31, 2024

The cause is actually an additional <action> node in the adminhtml.xml file:

<config>
    <!-- ... -->
    <acl> <!-- UNDER THIS ACL NODE -->
         <resources>
              <admin>
                <children>
                    <storepickup module="storepickup" translate="title">
                        <title>Store Pickup</title>
                        <sort_order>70</sort_order>
                        <children>
                            <stores module="storepickup" translate="title">
                                <title>Manage Stores</title>
                                <sort_order>0</sort_order>
                                <action>storepickup/adminhtml_store</action> <!-- REMOVE THIS LINE -->
                            </stores>

The <action> node is for assigning a menu item to a controller action. It should not be in the ACL.

@fballiano Please test by removing all <action> nodes under <acl>, refresh the cache, and see if the orphaned resource notice is rendered.

It's a bit more complicated than I thought. The <action> is added to the table admin_rule by mistake. It's a mistake because the node is not part of the ACL.
image

In admin > System > Permissions > Roles > edit a role, the resources are correctly listed without the <action>.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants