diff --git a/addons/website/controllers/main.py b/addons/website/controllers/main.py index 2078f692e0d..17672de72af 100644 --- a/addons/website/controllers/main.py +++ b/addons/website/controllers/main.py @@ -752,6 +752,15 @@ class Website(Home): if res_model not in ('website.page', 'ir.ui.view') and 'seo_name' in record: # allow custom slugify res['seo_name_default'] = slugify(record.display_name) # default slug, if seo_name become empty res['seo_name'] = record.seo_name and slugify(record.seo_name) or '' + + try: + record.check_access_rights('write') + record.check_access_rule('write') + except AccessError: + res['can_edit_seo'] = False + else: + res['can_edit_seo'] = True + return res @http.route(['/google.html'], type='http', auth="public", website=True, sitemap=False) diff --git a/addons/website/i18n/website.pot b/addons/website/i18n/website.pot index 262446bd769..0304c3a6d07 100644 --- a/addons/website/i18n/website.pot +++ b/addons/website/i18n/website.pot @@ -12551,6 +12551,13 @@ msgstr "" msgid "You do not have the rights to publish/unpublish" msgstr "" +#. module: website +#. odoo-javascript +#: code:addons/website/static/src/components/dialog/seo.xml:0 +#, python-format +msgid "You don't have permissions to edit this record." +msgstr "" + #. module: website #. odoo-javascript #: code:addons/website/static/src/components/dialog/seo.xml:0 diff --git a/addons/website/static/src/components/dialog/seo.js b/addons/website/static/src/components/dialog/seo.js index 0b19250c567..7540d3a8245 100644 --- a/addons/website/static/src/components/dialog/seo.js +++ b/addons/website/static/src/components/dialog/seo.js @@ -383,9 +383,10 @@ export class OptimizeSEODialog extends Component { 'res_model': this.object.model, }); - this.canEditDescription = 'website_meta_description' in this.data; - this.canEditTitle = 'website_meta_title' in this.data; - this.canEditUrl = 'seo_name' in this.data; + this.canEditSeo = this.data.can_edit_seo; + this.canEditDescription = this.canEditSeo && 'website_meta_description' in this.data; + this.canEditTitle = this.canEditSeo && 'website_meta_title' in this.data; + this.canEditUrl = this.canEditSeo && 'seo_name' in this.data; seoContext.title = this.canEditTitle && this.data.website_meta_title; // If website.page, hide the google preview & tell user his page is currently unindexed diff --git a/addons/website/static/src/components/dialog/seo.xml b/addons/website/static/src/components/dialog/seo.xml index d857a98de5f..d086792c432 100644 --- a/addons/website/static/src/components/dialog/seo.xml +++ b/addons/website/static/src/components/dialog/seo.xml @@ -169,7 +169,11 @@ size="size" primaryClick="() => this.save()" primaryTitle="saveButton" + showFooter="canEditSeo" contentClass="contentClass"> + - - + env.services.website.currentWebsite - && env.services.website.isDesigner + && env.services.website.isRestrictedEditor && !!env.services.website.currentWebsite.metadata.canOptimizeSeo, }); registry.category('website_custom_menus').add('website.menu_ace_editor', {