PrestaShop icon indicating copy to clipboard operation
PrestaShop copied to clipboard

Remove shops from multistore header shop list if they are not associated with current employee

Open alisamie97 opened this issue 1 year ago • 10 comments

Questions Answers
Branch? 1.7.8.x
Description? Check issues descriptions. When you create a new employee that is associated to a list of specific shops and not all of them, you expect that employee has access to those shops only and not all the shops. But if you login with the new employee account, you can see in the multistore header that all shops are available. This PR is a fix for this issue.
Type? bug fix
Category? BO
BC breaks? no
Deprecations? no
Fixed ticket? Fixes #27704 and #27377
Related PRs No
How to test? Enable multistore and create an extra shop. Create a new profile other in BO > Configure > Advanced Parameters > Team > Profiles. Then create give all permissions to that profile. And finally create a new employee with that profile and associate to the new shop you just created. Do not associate to the main shop. Then login via that new employee account and check multistore header. You should see only the associated shops in the create employee form that you have selected. You can also verify this by manually altering the ps_employee_shop table
Possible impacts? Not sure

alisamie97 avatar Aug 15 '22 15:08 alisamie97

Hello @stifler97!

This is your first pull request on the PrestaShop project. Thank you, and welcome to this Open Source community!

prestonBot avatar Aug 15 '22 15:08 prestonBot

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: https://github.com/PrestaShop/PrestaShop/blob/9887e7ece9810d847b8f31558ac2baabd1a91659/src/Core/Form/IdentifiableObject/DataHandler/EmployeeFormDataHandler.php#L136-L139

alisamie97 avatar Aug 15 '22 15:08 alisamie97

Can somebody tell me what is wrong with the code that cs fixer is showing me?

alisamie97 avatar Aug 17 '22 10:08 alisamie97

Can somebody tell me what is wrong with the code that cs fixer is showing me?

A simple blank space is needed after if Capture d’écran 2022-08-17 à 15 28 48

matks avatar Aug 17 '22 13:08 matks

Hi @stifler97

I think you could use cs-fixer locally: https://devdocs.prestashop.com/1.7/modules/testing/basic-checks/#coding-standards

I highly recommend you check how the CI works in PrestaShop and how it helps us maintain the codebase's consistency.

kpodemski avatar Aug 17 '22 13:08 kpodemski

Hi @stifler97, we are planning a patch release for September, we would like to have your contribution in it. Have you checked @matks comment ?

MatShir avatar Aug 18 '22 14:08 MatShir

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.

alisamie97 avatar Aug 18 '22 17:08 alisamie97

Hi every one. Is every thing ok with this PR? Just a reminder.

alisamie97 avatar Aug 28 '22 12:08 alisamie97

just a reminder. It has been a month since I opened this PR

alisamie97 avatar Sep 23 '22 06:09 alisamie97

Hey @stifler97, I thought that it would be better to familiarize you with this space more.

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: https://github.com/PrestaShop/PrestaShop/projects/26#card-85029280 Ps is a large project with many tasks with different aspects, so they know better when it should be added, and to which version. However, you can track your contribution through the projects and issues. Take a look at the issue: https://github.com/PrestaShop/PrestaShop/issues/27377 you can see that it has been labeled many times (take a look at this cart too: https://github.com/PrestaShop/PrestaShop/projects/26#card-85029280)

So, everything is normal ;)

samberrry avatar Sep 23 '22 08:09 samberrry

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.

kpodemski avatar Oct 28 '22 22:10 kpodemski