Skip to content

Bulk ACL management for AsynchronousOperations Admin UI #27580

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

Closed
wants to merge 9 commits into from

Conversation

nuzil
Copy link
Contributor

@nuzil nuzil commented Apr 4, 2020

Description (*)

After Migrating of Asynchronous Operations from Magento Commerce to Magento Open Source, looks like part of functionality was extended.

In details:
In magento_bulk table was added user_type, which defines type of the user who created Bulk Operation.

Possible types are:

  • Admin
  • Integration
  • Guest
  • Customer

In current implementation all Admin UI components have no idea about user type:

https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/AsynchronousOperations/view/adminhtml/ui_component/bulk_listing.xml - in default Grid there are NO DataSource is defined, so Admin see the whole operations, but at the same time, he cannot see Details of those operations:

https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/AsynchronousOperations/Controller/Adminhtml/Bulk/Details.php#L52

But at you can see from implementation,
https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/AsynchronousOperations/Model/AccessValidator.php#L58

that permissions are checked based on UserID and fully ignoring UserType. Which means, that Admin has access to All transactions or all user types with the same ID.

Fixed Issues (if relevant)

Current implementation will add:

  • New ACL roles for give possibilities for Admin define permissions for Admin/Integration user to have access only to specific user types operations.
  • With restricted user role, Admin will be able to see only operations that are assigned to him, View detailes or Restart them
  • Also Admin notifications will be restricted only to allowed.

Questions or comments

Auto tests still in process, but main implementation can be already reviewed.

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 are green)

Resolved issues:

  1. resolves [Issue] Bulk ACL management for AsynchronousOperations Admin UI #29757: Bulk ACL management for AsynchronousOperations Admin UI

@m2-assistant
Copy link

m2-assistant bot commented Apr 4, 2020

Hi @nuzil. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Guide documentation.

@sidolov sidolov added Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Severity: S2 Major restrictions or short-term circumventions are required until a fix is available. labels Aug 17, 2020
@sidolov sidolov self-assigned this Aug 26, 2020
@sidolov
Copy link
Contributor

sidolov commented Aug 26, 2020

@magento create issue

* @return BulkSummaryInterface[]
* @since 100.2.0
*/
public function getBulksByUserAndType($userId, $userTypeId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding the new methods to the interface is backward-incompatible change. Please, introduce new interface with this method.

/**
* @inheritDoc
*/
public function getBulksByUserAndType($userId, $userTypeId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be extracted to the separate class

/**
* @inheritDoc
*/
public function getBulksByUserAndType($userId, $userTypeId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be extracted to separate class

*/
class AccessManager
{
public const BULK_LOGGING_ACL_GUESTS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to make constants private?

* @param int $bulkUuid
* @return bool
*/
public function isAllowedForBulkUuid($bulkUuid)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to split this class into three with one method.

@engcom-Charlie
Copy link
Contributor

@nuzil can you please look at the requested changes?
Thank you.

@engcom-Charlie
Copy link
Contributor

Hi @nuzil, I'm closing this PR now due to inactivity.
Please reopen and update if you wish to continue.
Thank you for your collaboration.

@m2-assistant
Copy link

m2-assistant bot commented Sep 21, 2020

Hi @nuzil, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@nuzil
Copy link
Contributor Author

nuzil commented Sep 21, 2020

Hi @engcom-Charlie
I'm on it. As you can see I sync up branches only 4 days ago. Its require some time to refactor so many stuff.

@nuzil nuzil reopened this Sep 21, 2020
@m2-assistant
Copy link

m2-assistant bot commented Sep 21, 2020

Hi @nuzil. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names. Allowed build names are:

  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE,
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests

You can find more information about the builds here

ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review.

For more details, please, review the Magento Contributor Guide documentation.

Copy link
Contributor

@gabrieldagama gabrieldagama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving the PR to the correct state, as @nuzil mentioned, it is being worked on.

@engcom-Charlie
Copy link
Contributor

Hi, @nuzil will you continue on this PR?
Thank you.

@engcom-Charlie
Copy link
Contributor

Hi @nuzil, I'm closing this PR now due to inactivity.
Please reopen and update if you wish to continue.
Thank you for your collaboration.

@m2-assistant
Copy link

m2-assistant bot commented Oct 30, 2020

Hi @nuzil, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@ghost ghost removed the Progress: needs update label Oct 30, 2020
@engcom-Charlie engcom-Charlie mentioned this pull request Nov 9, 2020
4 tasks
@engcom-Charlie
Copy link
Contributor

Closed as duplicate #30806.

@m2-assistant
Copy link

m2-assistant bot commented Dec 2, 2020

Hi @nuzil, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Frontend Component: AsynchronousOperations Component: Bulk Event: Global-Contribution-Day Partner: Comwrap partners-contribution Pull Request is created by Magento Partner Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Release Line: 2.4 Severity: S2 Major restrictions or short-term circumventions are required until a fix is available.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Issue] Bulk ACL management for AsynchronousOperations Admin UI
5 participants