-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Add Role column to admin user grid #10891
Conversation
)->join( | ||
['detail_role' => $this->getTable('authorization_role')], | ||
'user_role.parent_id = detail_role.role_id', | ||
['role_name'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will affect every user collection instantiated, isn't it?
Something like https://magento.stackexchange.com/a/124204, a separate collection just for grid, looks like a better option. Not sure if there is to way do it in more declarative way.
Just my 2 cents, before proceeding please wait for somebody to actually confirm such feature fits well into core.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes the JOINs will happen on every collection load. This was based on the sales rule grid
magento2/app/code/Magento/SalesRule/view/adminhtml/layout/sales_rule_promo_quote_index.xml
Line 15 in 75155ae
<argument name="dataSource" xsi:type="object">Magento\SalesRule\Model\ResourceModel\Rule\Quote\Collection</argument> |
Not sure what the concern would be. The performance cost should be negligible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I searched for the usages of this Collection, it is not used in any performance-critical flows. Join should be fine here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vrann glad to know, thanks! Hope you checked EE/B2B codebases as well.
Is it correct that such approach with _initSelect
is up-to-date? Like, there is no declarative way to declare join for the grid etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please merge with the latest from |
@mpchadwick ^^ |
@vrann Should be merge develop back in tonight hopefully. |
@vrann I've merged |
@vrann Just pushed an update to fix visibility on _initSelect. Viewing Locked Users page in admin was resulting in 500 error. Noticed that while looking at the Travis results. |
@mpchadwick thank you, I also fixed that internally. Another issue needed to resolve was with the b2b version crashing when filtered by user_id column: now it is ambiguous which table user_id should come from. |
@mpchadwick thank you, the feature is successfully accepted. It is not indicated as merge because we did the same commit. |
Description
Adds a column to the admin user grid to show the users role
This can be useful for example to see all the users with "admin" privileges on a store with many users. Without this, you need to click into each manually
See: #9557
Contribution checklist