fix: tighten permission checks in mediapool media list - #6614
Merged
Conversation
The mediapool referenced a `no_permission` key that is not defined in any lang file, so the permission errors of the bulk delete and of the media detail page rendered as `[translate:no_permission]`. Use the existing `no_rights_to_this_function` message instead and move it from the structure/content plugin to core, including all translations, so it no longer depends on that plugin being available.
The bulk move only checked whether the user has permission for the target category. The file itself was addressed by its filename and its category assignment was overwritten without verifying where the file came from, so write permission on any single category was enough to pull arbitrary files out of categories that are blocked for the user. Once moved, all further access controls apply to the now permitted target category. Load the media object and require permission for its source category as well, mirroring the bulk delete right below, and skip files that fail the check. Errors and success messages are collected per file, so a partially permitted selection no longer reports only the outcome of the last file. The list also offered checkboxes for media the user has no permission for: media permissions are flat, while the search filters by category path (or not at all, in global search mode), so files from subcategories showed up as selectable. Render the checkbox only when the user has permission for the media's own category, which covers the bulk delete as well.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tightens the permission checks in the mediapool media list and fixes a message key that did not exist.
Details are intentionally brief here — the relevant parts are only mentioned in the commit messages for now and will be described properly once released.