Why is document library set to ignore permissions?

I am working on a member site where I have advanced permission turned on. members and or groups have folders containing files only they can view. The document library block is ignoring permissions.

This was noted in the forum back in 2022.

I am wondering why this code is in the block? also selecting Only show files owned by current logged-in user has no effect.

For the moment I have commented out line 883 in controller.php
Is there a reason for this line to be included in the block? I can’t think of why you would want permissions ignored by default.

Thanks
Colin

Edit: removing that line of code results in no files being shown to guests even though there are files with view permission granted to guests.

Your edit kind of explains why it’s there. If I remember right, when FileList checks permissions it uses the “view file in file manager” permission, not the normal view/download one, and guests never have the file manager one. So without ignorePermissions() guests get an empty list, even on files they’re allowed to download. I’d try giving Guest that file manager permission on just the one public folder and see if the block behaves.

I have ran some tests and giving guest permissions to Search File Folder then shows allowed files and folders. But my question remains as to why it is set up like this? In its current form, private files and folders become publicly available. I cant think of any reason why this would be the required behavior?

Yeah, I can’t think of a good reason either. My guess is the block was written with public download lists in mind and nobody thought about private folders. Might be worth opening an issue on GitHub, then the core team can at least say whether it’s intended.

The Document Library was a premium addon in c5.6. At some point in v7 or for v8 it was incorporated into the core.

That explains it then. As an addon for public download lists it made sense, and probably nobody went back to the permission part when it moved into core.