fix: check perms before installing library during restore#81
Merged
rhell4 merged 1 commit intostable-catalystfrom Feb 11, 2026
Merged
fix: check perms before installing library during restore#81rhell4 merged 1 commit intostable-catalystfrom
rhell4 merged 1 commit intostable-catalystfrom
Conversation
keevan
reviewed
Feb 11, 2026
keevan
left a comment
There was a problem hiding this comment.
Some re-wording suggestions. Overall changes are sound and make sense.
Thanks Rossco
376047e to
38f7c94
Compare
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.
Problem:
Perms are not checked when a user tries to restore a H5P activity with a library that is not installed on the site. This means users could bypass the permissions by backing up the activity in a different site with the library and then restoring it into another site without the library.
Solution:
Ideally it would be nice to just skip the activity and leave a message for the user doing the restore. Unfortunately doing this at a point we can is too late, leading to issues with restoring contexts, sections, files, etc. due to the activity being now missing. Alternative is to restore the activity but not the library, meaning when going to the activity it will error due to the library being missing, this may be confusing to the user and may be missed by the user if they do not check.
The most simplest way is to throw an exception with the exact reason why the restore is not possible. The user can then exclude that activity, ask the required people to install that library, etc.
The logic with the
is_recommendedstuff is taken from here: https://github.com/h5p/h5p-editor-php-library/blob/80b3b281ee9d064b563f242e8ee7a0026b5bf205/h5peditor.class.php#L526Testing: