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
Remove shops from multistore header shop list if they are not associated with current employee #29342
Conversation
Hello @stifler97! This is your first pull request on the PrestaShop project. Thank you, and welcome to this Open Source community! |
Keep in mind that if you select Super Admin as the new employee profile in new employee form, you are associating all the shops with this new employee by default and blindly. Just check this: PrestaShop/src/Core/Form/IdentifiableObject/DataHandler/EmployeeFormDataHandler.php Lines 136 to 139 in 9887e7e
|
Can somebody tell me what is wrong with the code that cs fixer is showing me? |
Hi @stifler97 I think you could use cs-fixer locally: I highly recommend you check how the CI works in PrestaShop and how it helps us maintain the codebase's consistency. |
@@ -93,6 +93,16 @@ public function header(bool $lockedToAllShopContext): Response | |||
$groupList = $this->entityManager->getRepository(ShopGroup::class)->findBy(['active' => true]); | |||
} | |||
|
|||
$associatedShops = $this->getContext()->employee->getAssociatedShops(); |
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.
Interesting. I am worried about one usecase: is it possible to configure an employee to "have access to ALL SHOPS" and if yes, does this code work with it?
I think this code works
- when an employee is configured to have access to some shops in particular (example: employee Mathieu F has access to shops 1, 4 and 5 but not 2 and 3)
- when an employee is configured to have access to some group of shops in particular (example: employee Mathieu F has access to groups 1 and 3 but not 2)
I am worried about the 3rd usecase
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 did not see any code that checks shop groups so there is no worries for groups. But it is a nice feature to have.
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.
#29342 (comment) As you mentioned here, I think the 3rd case @matks is worried about is covered by this line. If an employee is super admin and has access to all shops then getAssociatedShops ()
will simply return all ids. So it looks ok to me, but maybe worth testing the third case :)
Hi @stifler97, we are planning a patch release for September, we would like to have your contribution in it. Have you checked @matks comment ? |
Hi. That is a good news for me as a new comer. I just added a new fix to this PR. |
@@ -93,6 +93,16 @@ public function header(bool $lockedToAllShopContext): Response | |||
$groupList = $this->entityManager->getRepository(ShopGroup::class)->findBy(['active' => true]); | |||
} | |||
|
|||
$associatedShops = $this->getContext()->employee->getAssociatedShops(); |
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.
#29342 (comment) As you mentioned here, I think the 3rd case @matks is worried about is covered by this line. If an employee is super admin and has access to all shops then getAssociatedShops ()
will simply return all ids. So it looks ok to me, but maybe worth testing the third case :)
Hi every one. Is every thing ok with this PR? Just a reminder. |
just a reminder. It has been a month since I opened this PR |
Hey @stifler97, In short, you must be patient. Adding something one month or two months ago does not mean that it should be merged immediately. Normally, Ps team manage and prioritize tasks within projects, please take a look at: So, everything is normal ;) |
Thank you, @stifler97, for your PR; I've just approved it and assigned it to the QA team. Thanks, @samberrry, for your help. The truth is that this PR was lost because we have a problem tracking PRs with only one remaining review. |
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.
hello @stifler97
I have checked this PR. The related issues seem not to be fixed.
issue.27377.not.fixed.mp4
issue.27704.not.fixed.mp4
Could you please check again?
Thank You!
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.
Hello @stifler97
1.7.8.x doesn't allow new improvements and features anymore. Would you be interested in moving your improvement to the develop
branch and addressing QA feedback?
ps_employee_shop
table