Merge branch 'MDL-79709-master' of https://github.com/davewoloszyn/moodle
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Tiny premium capabilities.
|
||||
*
|
||||
* @package tiny_premium
|
||||
* @copyright 2023 David Woloszyn <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$capabilities = [
|
||||
'tiny/premium:accesspremium' => [
|
||||
'captype' => 'read',
|
||||
'contextlevel' => CONTEXT_USER,
|
||||
'archetypes' => [
|
||||
'user' => CAP_ALLOW,
|
||||
],
|
||||
],
|
||||
];
|
||||
@@ -28,4 +28,5 @@ defined('MOODLE_INTERNAL') || die();
|
||||
$string['pluginname'] = 'Tiny premium';
|
||||
$string['apikey'] = 'API key';
|
||||
$string['apikey_desc'] = 'Your Tiny premium API key requires a paid subscription. You can find your key on your Tiny Cloud account page.';
|
||||
$string['premium:accesspremium'] = 'Access Tiny Premium features';
|
||||
$string['privacy:metadata'] = 'The Tiny premium plugin for TinyMCE does not store any personal data.';
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2023100900;
|
||||
$plugin->version = 2023111300;
|
||||
$plugin->requires = 2023100400;
|
||||
$plugin->component = 'tiny_premium';
|
||||
|
||||
Reference in New Issue
Block a user