MDL-79709 tiny_premium: Capability to access Tiny Premium features

This commit is contained in:
David Woloszyn
2023-12-11 09:47:31 +11:00
parent a891866cbd
commit 4116a75858
4 changed files with 39 additions and 3 deletions
@@ -30,7 +30,7 @@ use editor_tiny\plugin;
class plugininfo extends plugin {
/**
* Determine if the plugin should be enabled by checking if the Tiny Premium API key is set.
* Determine if the plugin should be enabled by checking the capability and if the Tiny Premium API key is set.
*
* @param context $context The context that the editor is used within
* @param array $options The options passed in when requesting the editor
@@ -44,6 +44,6 @@ class plugininfo extends plugin {
array $fpoptions,
?editor $editor = null
): bool {
return get_config('tiny_premium', 'apikey') != false;
return has_capability('tiny/premium:accesspremium', $context) && (get_config('tiny_premium', 'apikey') != false);
}
}