The button code expects a string from the event but integer is given which makes the acl check not working incorrect.
The onDisplay method expects a string and check if it's empty:
joomla-cms/plugins/editors-xtd/image/src/Extension/Image.php
Lines 76 to 88 in aeab632
In the onEditorButtonsSetup method we provide $event->getAsset() to the onDisplay method which always returns an integer.
joomla-cms/plugins/editors-xtd/image/src/Extension/Image.php
Lines 58 to 59 in aeab632
5.4
the acl check should be able to handle integer correctly or the setup method should provide a string.
handle integer correctly
No response
No response
| Labels |
Added:
bug
|
||
| Labels |
Added:
No Code Attached Yet
|
||
We received Asset ID here, but $user->authorise('core.edit', $asset) method expect $asset is asset name, so the correct fix would be get asset name base on given ID and pass it to $user->authorise calls for checking permission
I wonder if the permission check for the button is needed at all. From quick look at the code, it seems the check means "show the button if the current user can add/edit item". However, that kind of check is already handled by our ACL system in controller. If user does not have permission to add/edit item, they cannot reach the form, editor won't be displayed, so the check seems useless to me. Not sure if I missed something here.
This should be asset ID, I think it always integer
joomla-cms/libraries/src/Form/Field/EditorField.php
Line 212 in 7996a3f
Asset ID of edited content.
I would try to change this line to check zero or empty:
joomla-cms/plugins/editors-xtd/image/src/Extension/Image.php
Line 88 in 6fe4e29
Something like: