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

Categories permissions for "categories" and "categoryList" #29883

Merged

Conversation

pmarjan
Copy link
Contributor

@pmarjan pmarjan commented Sep 3, 2020

Description (*)

Fixes #29880

Collection Processors (via Composite processor) are added. Context is passed as optional parameter.

Related Pull Requests

https://github.com/magento/partners-magento2ee/pull/319

Fixed Issues (if relevant)

  1. GraphQL "categories" and "categoryList" do not consider Category Permissions configuration

Manual testing scenarios (*)

  1. ...
  2. ...

Questions or comments

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)

…tegory Permissions configuration

Introduce collection processors, pass the context so to obtain customer group
@pmarjan pmarjan added Project: GraphQL PAP Partners acceleration program labels Sep 3, 2020
@pmarjan pmarjan added this to the 2.4.2 milestone Sep 3, 2020
@pmarjan pmarjan self-assigned this Sep 3, 2020
@m2-assistant
Copy link

m2-assistant bot commented Sep 3, 2020

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

⚠️ According to the Magento Contribution requirements, all Pull Requests must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of Pull Requests happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@pmarjan
Copy link
Contributor Author

pmarjan commented Sep 3, 2020

@magento run all tests

Copy link

@BarnyShergold BarnyShergold left a comment

Choose a reason for hiding this comment

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

There seems to be quite a lot of new code files here and some substantial changes to core methods - is there a reason why there is no test coverage?

/** @var SearchCriteriaCollectionProcessor */
private $collectionProcessor;

public function __construct(

Choose a reason for hiding this comment

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

No DocBlock

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

SearchCriteriaInterface $searchCriteria,
ContextInterface $context = null
): Collection
{

Choose a reason for hiding this comment

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

This { should be on previous line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hey @BarnyShergold

the changes to core methods are with the purpose to expose modular collection processing, so other layers in the application can have a say what the collection consists of.
Check maybe implementation of "products" query for an example - it is the same idea.

On a closer look, please notice, there is no bug to be solved, or new requirement to be satisfied, just a refactor, thus, should be sufficient that already present api-functinal tests do not break (and they don't :) ), no need for new ones.

In more details, I would bring your attention to GraphQl/Catalog tests, and there all the Category*.Test.php and all tests from CategoriesQuery folder are the top relevant to verify the refactor.

Anyway, bigger picture is here: #28550, if it helps to gain depth on the idea that is running in this PR. If any questions, just contact me... I can give you even more details.

Choose a reason for hiding this comment

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

@pmarjan - Your reasoning is sound - just wanted to check!
You just need to fix the minor format issues and the failing tests and all will be good.

@ghost ghost moved this from Pending Review to Changes Requested in Pull Requests Dashboard Sep 7, 2020
@ghost ghost assigned BarnyShergold Sep 7, 2020
…tegory Permissions configuration

Address static tests
@pmarjan
Copy link
Contributor Author

pmarjan commented Sep 11, 2020

@magento run all tests

1 similar comment
@pmarjan
Copy link
Contributor Author

pmarjan commented Sep 15, 2020

@magento run all tests

@pmarjan
Copy link
Contributor Author

pmarjan commented Sep 25, 2020

@magento run all tests

2 similar comments
@pmarjan
Copy link
Contributor Author

pmarjan commented Sep 25, 2020

@magento run all tests

@BarnyShergold
Copy link

@magento run all tests

public function process(
Collection $collection,
SearchCriteriaInterface $searchCriteria,
ContextInterface $context = null
Copy link
Contributor

Choose a reason for hiding this comment

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

just a minor observation in comparison to the product processor
Noticed that there we passed attributes as well. I guess here we did not need it here. Not sure because this is meant as an extension point if we need to add it and just not use it ourselves..maybe other extensions will..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. Now, I have edited to pass attributesNames as well. Currently are not used, but someday maybe someone extends this.

@ghost ghost assigned cpartica Sep 29, 2020
…tegory Permissions configuration

PR review points
@ghost ghost moved this from Changes Requested to Ready for Testing in Pull Requests Dashboard Oct 7, 2020
@magento-engcom-team magento-engcom-team merged commit b279b6d into magento:2.4-develop Oct 10, 2020
@m2-assistant
Copy link

m2-assistant bot commented Oct 10, 2020

Hi @pmarjan, 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.

@sidolov sidolov removed this from Ready for Testing in Pull Requests Dashboard Oct 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GraphQL "categories" and "categoryList" do not consider Category Permissions configuration
4 participants