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

Add Role column to admin user grid #10891

Closed
wants to merge 3 commits into from

Conversation

@mpchadwick
Copy link
Contributor

commented Sep 14, 2017

Description

image

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

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)
)->join(
['detail_role' => $this->getTable('authorization_role')],
'user_role.parent_id = detail_role.role_id',
['role_name']

This comment has been minimized.

Copy link
@orlangur

orlangur Sep 15, 2017

Contributor

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.

This comment has been minimized.

Copy link
@mpchadwick

mpchadwick Sep 15, 2017

Author Contributor

Yes the JOINs will happen on every collection load. This was based on the sales rule grid

<argument name="dataSource" xsi:type="object">Magento\SalesRule\Model\ResourceModel\Rule\Quote\Collection</argument>

https://github.com/magento/magento2/blob/develop/app/code/Magento/SalesRule/Model/ResourceModel/Rule/Quote/Collection.php#L10

https://github.com/magento/magento2/blob/develop/app/code/Magento/SalesRule/Model/ResourceModel/Rule/Collection.php#L279-L288

Not sure what the concern would be. The performance cost should be negligible.

This comment has been minimized.

Copy link
@vrann

vrann Sep 18, 2017

Contributor

I searched for the usages of this Collection, it is not used in any performance-critical flows. Join should be fine here.

This comment has been minimized.

Copy link
@orlangur

orlangur Sep 18, 2017

Contributor

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

This comment has been minimized.

Copy link
@mpchadwick

mpchadwick Sep 18, 2017

Author Contributor

@vrann @orlangur also note that there are indexes on both the columns used in the JOIN so I really wouldn't be worried about perf.

@vrann

This comment has been minimized.

Copy link
Contributor

commented Sep 18, 2017

please merge with the latest from develop

@vrann

This comment has been minimized.

Copy link
Contributor

commented Sep 18, 2017

@mpchadwick

This comment has been minimized.

Copy link
Contributor Author

commented Sep 18, 2017

@vrann Should be merge develop back in tonight hopefully.

@mpchadwick

This comment has been minimized.

Copy link
Contributor Author

commented Sep 18, 2017

@vrann I've merged develop back to this branch.

@vrann vrann self-assigned this Sep 19, 2017

@vrann vrann added this to the September 2017 milestone Sep 19, 2017

@vrann vrann added the develop label Sep 19, 2017

@mpchadwick

This comment has been minimized.

Copy link
Contributor Author

commented Sep 24, 2017

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

@vrann

This comment has been minimized.

Copy link
Contributor

commented Sep 25, 2017

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

magento-team pushed a commit that referenced this pull request Sep 27, 2017

@vrann

This comment has been minimized.

Copy link
Contributor

commented Sep 28, 2017

@mpchadwick thank you, the feature is successfully accepted. It is not indicated as merge because we did the same commit.

@vrann vrann closed this Sep 28, 2017

AntonEvers added a commit to AntonEvers/magento2 that referenced this pull request Oct 3, 2017

Merge remote-tracking branch 'upstream/develop' into ip-ranges
* upstream/develop: (619 commits)
  MAGETWO-80367: Skip Jenkins builds and fix tests
  MAGETWO-80288: Fix unit tests on jenkins
  MQE-350: Demos for Core and SE Teams
  MQE-292: Use "selector" name consistently instead of "locator"
  MQE-350: Demos for Core and SE Teams
  Clean up code but getting read of 'Blank line found at start of control structure' coding standard violations
  MSI: Add Support of PHP 7 Syntax for MSI APIs
  Add EventObject to CMS Page/Block Collection
  Add EventObject to CMS Page/Block Collection
  Add EventPrefix to CMS Page/Block Collection
  Add EventPrefix to CMS Page/Block Collection
  MAGETWO-75524: Add Role column to admin user grid magento#10891
  MAGETWO-71048: WIP: Admin Config Search magento#10335
  SetMethods to null in MockBuilder
  Delete CallExit function for After plugin logic execution
  Removed double tag from configuration XML. Fixes magento#11000
  MAGETWO-75124: Add unit test paths inside infrastructure
  Add VAT number to email source variables
  MAGETWO-75635: Merge 2.2.0-develop into develop
  MAGETWO-75635: Merge 2.2.0-develop into develop
  ...

Conflicts:
	composer.lock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.