Skip to content

Conversation

@fw-bot
Copy link
Contributor

@fw-bot fw-bot commented Mar 15, 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: #201531
Forward-Port-Of: #112421

The `is-ready` attribute of the website preview iframe is only set after
the wysiwyg lazy assets are loaded.
Because of this, the iframe is never set as ready for users who are not
a least website restricted editors.
This prevents tours from matching selectors inside the iframe.

This commit also makes the public root ready for non-website users.

runbot-114278
runbot-114279
runbot-114281
runbot-114283
runbot-114287
runbot-114289

X-original-commit: b3e5725
Part-of: odoo#200223
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
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: 1afcf7c
This commit adds tests to verify that partners can only be published by
users having the correct access rights.

task-3175890

X-original-commit: ea3346e
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: 4e03b73
@robodoo robodoo added the forwardport This PR was created by @fw-bot label Mar 15, 2025
@robodoo
Copy link
Contributor

robodoo commented Mar 15, 2025

Pull request status dashboard

@fw-bot
Copy link
Contributor Author

fw-bot commented Mar 15, 2025

@bso-odoo @qsm-odoo this PR targets master and is the last of the forward-port chain.

To merge the full chain, use

@robodoo r+

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

@C3POdoo C3POdoo added the RD research & development, internal work label Mar 15, 2025
@bso-odoo
Copy link
Contributor

@robodoo r+

robodoo pushed a commit that referenced this pull request Mar 17, 2025
The `is-ready` attribute of the website preview iframe is only set after
the wysiwyg lazy assets are loaded.
Because of this, the iframe is never set as ready for users who are not
a least website restricted editors.
This prevents tours from matching selectors inside the iframe.

This commit also makes the public root ready for non-website users.

runbot-114278
runbot-114279
runbot-114281
runbot-114283
runbot-114287
runbot-114289

X-original-commit: b3e5725
Part-of: #201954
Related: odoo/enterprise#81547
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 Mar 17, 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: 1afcf7c
Part-of: #201954
Related: odoo/enterprise#81547
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 Mar 17, 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: ea3346e
Part-of: #201954
Related: odoo/enterprise#81547
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 Mar 17, 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 #201954

X-original-commit: 4e03b73
Related: odoo/enterprise#81547
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
@robodoo robodoo added the 18.3 label Mar 17, 2025
@robodoo robodoo closed this Mar 17, 2025
@fw-bot fw-bot deleted the master-16.0-fix_can_publish_right-bso-422497-fw branch March 24, 2025 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

18.3 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