MDL-76787 tiny_h5p: correct capability for plugin enabled state.

This commit is contained in:
Paul Holden 2023-01-03 21:26:04 +00:00
parent 12e9d9e1bf
commit a082b6e084
2 changed files with 2 additions and 14 deletions

View File

@ -41,7 +41,7 @@ class plugininfo extends plugin implements
?\editor_tiny\editor $editor = null
): bool {
// Users must have permission to embed content.
return has_capability('atto/h5p:addembed', $context);
return has_capability('tiny/h5p:addembed', $context);
}
public static function get_available_buttons(): array {

View File

@ -1,4 +1,4 @@
@editor @editor_tiny @tiny_media @javascript @_file_upload
@editor @editor_tiny @tiny_h5p @javascript @_file_upload
Feature: Use the TinyMCE editor to upload an h5p package
In order to work with h5p
As a content creator
@ -58,21 +58,9 @@ Feature: Use the TinyMCE editor to upload an h5p package
Given the following "permission overrides" exist:
| capability | permission | role | contextlevel | reference |
| tiny/h5p:addembed | Prohibit | editingteacher | Course | C1 |
| moodle/h5p:deploy | Prohibit | editingteacher | Course | C1 |
When I am on the PageName1 "page activity editing" page logged in as teacher1
Then "Configure H5P content" "button" should not exist
@javascript
Scenario: When a user does not have the Embed H5P capability, they cannot embed H5P content with TinyMCE
Given the following "permission overrides" exist:
| capability | permission | role | contextlevel | reference |
| tiny/h5p:addembed | Prohibit | editingteacher | Course | C1 |
And I am on the PageName1 "page activity editing" page logged in as teacher1
And I click on "Configure H5P" "button"
Then I should not see "H5P URL" in the "Insert H5P content" "dialogue"
And I should see "H5P file upload" in the "Insert H5P content" "dialogue"
And I should see "H5P options" in the "Insert H5P content" "dialogue"
@javascript
Scenario: When a user does not have the Upload H5P capability, they can embed but not upload H5P content with TinyMCE
Given the following "permission overrides" exist: