Skip to content

Conversation

@fw-bot
Copy link
Contributor

@fw-bot fw-bot commented Feb 18, 2025

Before this commit all systray items of website were hidden for users that did not have the Restricted Editor right.

This commit limits only some of the items to users having the Restricted Editor right:

  • Published: unrelated
  • Mobile preview: unrelated
  • Website switcher: unrelated
    • New: Restricted Editor only
  • Edit in backend: unrelated
  • Translate: Restricted Editor only
  • Edit: Restricted Editor only

It therefore now shows the Published button only based on the result of the _compute_can_publish method of the website.published.mixin. The default implementation now checks whether the user has write access to the website_published field on the record.

Steps to reproduce:

  • Install website_crm_partner_assign.
  • Connect as a user without any Website role, and in Sales, the "User: Own Documents Only" role.
  • Go to a partner in the /partners page. => "Published" button did not appear.

And on the contrary:

  • Connect as a Restricted Editor user without Sales rights.
  • Go to a partner in the /partners page.
  • Click on "Published". => An access right error notification did appear.

task-3175890

Forward-Port-Of: #195866
Forward-Port-Of: #112421

@robodoo
Copy link
Contributor

robodoo commented Feb 18, 2025

Pull request status dashboard

@robodoo robodoo added forwardport This PR was created by @fw-bot conflict There was an error while creating this forward-port PR labels Feb 18, 2025
@fw-bot
Copy link
Contributor Author

fw-bot commented Feb 18, 2025

@bso-odoo @qsm-odoo cherrypicking of pull request #112421 failed.

stdout:

Auto-merging addons/website/models/mixins.py
Auto-merging addons/website/models/website_page.py
Auto-merging addons/website/static/src/systray_items/edit_website.js
CONFLICT (content): Merge conflict in addons/website/static/src/systray_items/edit_website.js
Auto-merging addons/website/static/src/systray_items/mobile_preview.js
Auto-merging addons/website/static/src/systray_items/new_content.js
CONFLICT (modify/delete): addons/website/static/src/systray_items/translate_website.js deleted in 5e91bb5d3dc1cc3121a377e6dcd9bc07af7c48fe and modified in e799a27c34267a709b4422058209421df3c3cb34.  Version e799a27c34267a709b4422058209421df3c3cb34 of addons/website/static/src/systray_items/translate_website.js left in tree.

Either perform the forward-port manually (and push to this branch, proceeding as usual) or close this PR (maybe?).

In the former case, you may want to edit this PR message as well.

⚠️ after resolving this conflict, you will need to merge it via @robodoo.

More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port

@C3POdoo C3POdoo added the RD research & development, internal work label Feb 18, 2025
@bso-odoo bso-odoo force-pushed the saas-17.4-16.0-fix_can_publish_right-bso-413037-fw branch from e50ab32 to 4e1aa85 Compare February 19, 2025 10:27
@C3POdoo C3POdoo requested review from a team February 19, 2025 10:40
Before this commit all systray items of website were hidden for users
that did not have the Restricted Editor right.

This commit limits only some of the items to users having the
Restricted Editor right:
- Published: unrelated (but still need to be able to publish)
- Mobile preview: technically unrelated, but keeping it limited to
Restricted Editor only
- Website switcher: unrelated (but still need multi website enabled)
- + New: Restricted Editor only
- Edit in backend: unrelated
- Translate: Restricted Editor only
- Edit: Restricted Editor only

It therefore now shows the Published button only based on the result of
the `_compute_can_publish` method of the `website.published.mixin`.
The default implementation now checks whether the user has write access
to the `website_published` field on the record.

Steps to reproduce:
- Install `website_crm_partner_assign`.
- Connect as a user without any Website role, and in Sales, the "User:
Own Documents Only" role.
- Go to a partner in the `/partners` page.
=> "Published" button did not appear.

And on the contrary:
- Connect as a Restricted Editor user without Sales rights.
- Go to a partner in the `/partners` page.
- Click on "Published".
=> An access right error notification did appear.

task-3175890

X-original-commit: e799a27
@bso-odoo bso-odoo force-pushed the saas-17.4-16.0-fix_can_publish_right-bso-413037-fw branch from 4e1aa85 to eb5eaa6 Compare February 19, 2025 12:08
This commit adds tests to verify that partners can only be published by
users having the correct access rights.

task-3175890

X-original-commit: 5c0a0b5
@bso-odoo bso-odoo force-pushed the saas-17.4-16.0-fix_can_publish_right-bso-413037-fw branch 3 times, most recently from 6649a0b to b4955e4 Compare February 20, 2025 14:39
This commit defines access rights and a dedicated "Tester" role to allow
for the edition of the `test.model`.
The test verifies that each kind of user either has, or does not have
access to each item of the systray.

- Checked for:
* admins
* tester and restricted editor
* non-tester but restricted editor
* non-restricted editors but testers
* neither

task-3175890

X-original-commit: 2dccaae
@bso-odoo bso-odoo force-pushed the saas-17.4-16.0-fix_can_publish_right-bso-413037-fw branch from b4955e4 to c4d64b3 Compare February 20, 2025 14:44
@bso-odoo
Copy link
Contributor

@robodoo r+

robodoo pushed a commit that referenced this pull request Feb 21, 2025
Before this commit all systray items of website were hidden for users
that did not have the Restricted Editor right.

This commit limits only some of the items to users having the
Restricted Editor right:
- Published: unrelated (but still need to be able to publish)
- Mobile preview: technically unrelated, but keeping it limited to
Restricted Editor only
- Website switcher: unrelated (but still need multi website enabled)
- + New: Restricted Editor only
- Edit in backend: unrelated
- Translate: Restricted Editor only
- Edit: Restricted Editor only

It therefore now shows the Published button only based on the result of
the `_compute_can_publish` method of the `website.published.mixin`.
The default implementation now checks whether the user has write access
to the `website_published` field on the record.

Steps to reproduce:
- Install `website_crm_partner_assign`.
- Connect as a user without any Website role, and in Sales, the "User:
Own Documents Only" role.
- Go to a partner in the `/partners` page.
=> "Published" button did not appear.

And on the contrary:
- Connect as a Restricted Editor user without Sales rights.
- Go to a partner in the `/partners` page.
- Click on "Published".
=> An access right error notification did appear.

task-3175890

X-original-commit: e799a27
Part-of: #198208
Related: odoo/enterprise#79612
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
robodoo pushed a commit that referenced this pull request Feb 21, 2025
This commit adds tests to verify that partners can only be published by
users having the correct access rights.

task-3175890

X-original-commit: 5c0a0b5
Part-of: #198208
Related: odoo/enterprise#79612
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
robodoo pushed a commit that referenced this pull request Feb 21, 2025
This commit defines access rights and a dedicated "Tester" role to allow
for the edition of the `test.model`.
The test verifies that each kind of user either has, or does not have
access to each item of the systray.

- Checked for:
* admins
* tester and restricted editor
* non-tester but restricted editor
* non-restricted editors but testers
* neither

task-3175890

closes #198208

X-original-commit: 2dccaae
Related: odoo/enterprise#79612
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
@robodoo robodoo closed this Feb 21, 2025
@xmo-odoo xmo-odoo deleted the saas-17.4-16.0-fix_can_publish_right-bso-413037-fw branch March 7, 2025 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conflict There was an error while creating this forward-port PR forwardport This PR was created by @fw-bot RD research & development, internal work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants