[FIX] web_editor: remove command /image for portal users
The command `/image` used by portal users (in a forum post for example) throws an access error. This fix removes this command for portal users until master. In master, the command is reintroduced [here]. Indeed, before the new editor in v15, those restricted users could insert an image as we were using an "in place" image upload dialog from summernote resulting in simple base64 image added in the image tag. This allowed to add image without creating an attachment. But with the new editor, there is no such base64 image upload, and it would be too tedious / risky to introduce one in stable. [here]: https://github.com/odoo/odoo/pull/82612 opw-2648770 task-2811325 X-original-commit: e453d4c119a69f285d9a014babe485492bbe9c40 Part-of: odoo/odoo#89890
This commit is contained in:
@@ -3,6 +3,7 @@ odoo.define('web_editor.wysiwyg', function (require) {
|
||||
|
||||
const dom = require('web.dom');
|
||||
const core = require('web.core');
|
||||
const session = require('web.session');
|
||||
const Widget = require('web.Widget');
|
||||
const Dialog = require('web.Dialog');
|
||||
const customColors = require('web_editor.custom_colors');
|
||||
@@ -98,6 +99,7 @@ const Wysiwyg = Widget.extend({
|
||||
|
||||
var options = this._editorOptions();
|
||||
this._value = options.value;
|
||||
this.options.isInternalUser = await session.user_has_group('base.group_user');
|
||||
|
||||
this.$editable = this.$editable || this.$el;
|
||||
this.$editable.html(this._value);
|
||||
@@ -1793,7 +1795,9 @@ const Wysiwyg = Widget.extend({
|
||||
}, 150);
|
||||
},
|
||||
},
|
||||
{
|
||||
];
|
||||
if (options.isInternalUser) {
|
||||
commands.push({
|
||||
groupName: 'Medias',
|
||||
title: 'Image',
|
||||
description: 'Insert an image.',
|
||||
@@ -1801,8 +1805,8 @@ const Wysiwyg = Widget.extend({
|
||||
callback: () => {
|
||||
this.openMediaDialog();
|
||||
},
|
||||
},
|
||||
];
|
||||
});
|
||||
}
|
||||
if (options.allowCommandVideo) {
|
||||
commands.push({
|
||||
groupName: 'Medias',
|
||||
|
||||
Reference in New Issue
Block a user