xwikisas / macro-pdfviewer

0 stars 4 forks source link

The "Upload file" button does not appear when trying to upload using the PDF Viewer Macro, if edit right is not given at wiki level to that group/user #44

Closed AndreeaChi closed 1 year ago

AndreeaChi commented 2 years ago

Steps to reproduce:

  1. On a 14.4.5/13.10.5/14.4.6 XWiki Jetty instance, install PDF Viewer Macro Pro, 2.4. I tested on both Firefox 106.0.5 & Chrome 107.0

  2. Add a standard user (Simple, default hidden pages setting) in a new Group - XWikiRegularUsersGroup

  3. At wiki level, set these rights for the XWikiAdminGroup and leave empty for all the other groups:

    image
  4. At this point, give to the XWikiRegularUsersGroup on the Sandbox Page & Children level Edit rights.

  5. With a user from the XWikiRegularUsersGroup edit Sandbox TestPage1, with no pre-existing PDF attached to the page (no matter the editor type, inline or WYSIWYG) and add the PDF Viewer Macro.

  6. Click in the "Select or upload a PDF file" field

Expected result: a button with "Upload a file" under the "Select or upload a PDF file" field

Actual result: the "Upload a file" button does not appear

image

In the console, the Source map error: Error: request failed with status 404 Resource URL: null Source Map URL: suggestAttachments.min.js.map appears when inserting the PDF Viewer macro, then when first clicking in the Select or upload a PDF file field, the message JQMIGRATE: jQuery.trim is deprecated; use String.prototype.trim appears.

Also, giving View at wiki level for the group or any right, even Admin on the Sandbox Page & Children level to the group, does not help.

AndreeaChi commented 2 years ago

To confirm this, I created a SecondRegularUser and added it in a new group called ExtraGroup.

Then, I gave the Edit right to the ExtraGroup at wiki level

image

and on the Sandbox Page & Children (this second setting is required only if the Edit right is kept for the XWikiRegularUsersGroup).

image

On a separate browser session, I logged in with the SecondRegularUser and edited TestPage2, added the PDF Viewer macro and the "Upload file" button appears, while the same messages appeared in the console:

image

If I remove the Edit right from the ExtraGroup at wiki level, the "Upload file" button is again not shown.

mflorea commented 2 years ago

The jQuery Migrate warning from the JavaScript console don't affect the feature / end user. They only inform the developer that the code needs to be updated because it uses deprecated / dropped APIs.

oanalavinia commented 1 year ago

This issue was closed as part of CKEditor in here. To apply this fix for the File Manager App, CKEditor needs to be upgraded to 1.64.9 https://jira.xwiki.org/browse/CKEDITOR-499 Note that since CKEditor was merged in the XWiki platform at some point, an upgrade will not be possible for those versions. Check this issue for details on which XWiki versions might still have this problem https://jira.xwiki.org/browse/XWIKI-20491