diff options
| author | Xavier Morel <xmo@openerp.com> | 2014-06-17 12:01:52 +0200 |
|---|---|---|
| committer | Xavier Morel <xmo@openerp.com> | 2014-06-17 12:01:52 +0200 |
| commit | 79e10200d5cc78d39a139f63eb2a69309878ab04 (patch) | |
| tree | 3e9e640a14532d4e0af4abfc69d26a42451055ef /addons/website/static/src/js/website.editor.js | |
| parent | 63a6ba92e2c0bade494ac05910210046e695b787 (diff) | |
[IMP] prevent edition of page if groups which current user doesn't have
If the current view uses @groups attributes (possibly in called templates),
the corresponding elements are rendered to a void (empty string in qweb). If
said user can edit the page, does so and saves a view section in which there's
a @groups to which he has no access, the element[@groups] is completely
removed from the template once saved, losing it.
If QWeb encounters an @groups to which the current user has no right during
rendering, have it request a no-RTE page, so the user can not RTE-edit the
page (or drop snippets in it).
Diffstat (limited to 'addons/website/static/src/js/website.editor.js')
| -rw-r--r-- | addons/website/static/src/js/website.editor.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/addons/website/static/src/js/website.editor.js b/addons/website/static/src/js/website.editor.js index fcb957cafda..f8d1a66bc80 100644 --- a/addons/website/static/src/js/website.editor.js +++ b/addons/website/static/src/js/website.editor.js @@ -3,6 +3,7 @@ var website = openerp.website; var _t = openerp._t; + website.no_editor = !!$(document.documentElement).data('editable-no-editor'); website.add_template_file('/website/static/src/xml/website.editor.xml'); website.dom_ready.done(function () { @@ -496,6 +497,17 @@ this.$('#website-top-edit').hide(); this.$('#website-top-view').show(); + if (website.no_editor) { + var help_text = $(document.documentElement).data('editable-no-editor'); + this.$('button[data-action=edit]') + .prop('disabled', website.no_editor) + .parent() + // help must be set on form above button because it does + // not appear on disabled button + .attr('title', help_text); + } + + $('.dropdown-toggle').dropdown(); this.customize_setup(); |
