admidio icon indicating copy to clipboard operation
admidio copied to clipboard

Documents & Files: download incorrectly requires upload permission

Open Feichtl opened this issue 8 months ago • 1 comments

Description

In Admidio 5.0.7, file downloads from the "Documents & Files" module appear to require upload permission, even when the folder and file should be downloadable.

Observed behavior:

  • The folder is visible
  • The file is visible
  • Download fails with a "no rights / insufficient permission" message

Environment

  • Admidio version: 5.0.7

What I checked

  • adm_files.fil_locked = 0
  • adm_folders.fol_locked = 0
  • adm_folders.fol_public = 1 for public folders
  • The issue also occurs for a member-only folder when logged in as a normal member with view access

Expected behavior

Users should be able to download files if they have view/download access to the folder. Download should not require upload permission.

Actual behavior

Download is blocked because the code checks hasUploadRight() before allowing the request to continue.

Relevant code in v5.0.7

In: adm_program/modules/documents-files.php

There is a check like this:

if ($getMode != 'list') { $folder = new Folder($gDb); $folder->getFolderForDownload($getFolderUUID); if (!$folder->hasUploadRight()) { $gMessage->show($gL10n->get('SYS_NO_RIGHTS')); } }

This also affects mode=download, so downloads require folder_upload rights.

Why I believe this is a bug

For downloads, the relevant permission should be folder_view / public folder access, not folder_upload.

Suggested fix

Exclude "download" from the upload-right check, e.g.

if ($getMode != 'list' && $getMode != 'download') { ... }

This seems consistent with the current master branch behavior.

Temporary workaround

Changing the condition locally from

if ($getMode != 'list') {

to

if ($getMode != 'list' && $getMode != 'download') {

makes downloads work as expected.

Feichtl avatar Mar 25 '26 14:03 Feichtl

fixed with 1bc4d2b90a41363064b1d679eecbdf1f8b8a6968

Fasse avatar Mar 26 '26 17:03 Fasse