Initial commit: MeetLet Adobe Connect Bridge Marketplace edition (Moodle plugin).
Single-plugin source tree for mod_meetletacbmarketplace — admin, licensing, and marketplace integration. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
|
||||
/**
|
||||
* Reset site access settings (role mapping or feature matrix) to built-in defaults.
|
||||
*
|
||||
* @package mod_meetletacbmarketplace
|
||||
* @copyright 2026 MeetLet
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
define('AJAX_SCRIPT', true);
|
||||
|
||||
require_once('../../../config.php');
|
||||
|
||||
use mod_meetletacbmarketplace\local\featureaccess;
|
||||
use mod_meetletacbmarketplace\local\roles;
|
||||
|
||||
require_login();
|
||||
require_capability('moodle/site:config', context_system::instance());
|
||||
require_sesskey();
|
||||
|
||||
\mod_meetletacbmarketplace\registration\manager::require_registered();
|
||||
|
||||
$section = required_param('section', PARAM_ALPHA);
|
||||
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
|
||||
try {
|
||||
if ($section === 'rolemapping') {
|
||||
$rules = roles::builtin_site_defaults();
|
||||
$json = json_encode($rules, JSON_UNESCAPED_UNICODE);
|
||||
set_config('default_participants', $json, 'meetletacbmarketplace');
|
||||
echo json_encode([
|
||||
'success' => true,
|
||||
'section' => 'rolemapping',
|
||||
'matrix' => roles::matrix_from_rules($rules),
|
||||
'message' => get_string('reset_success_rolemapping', 'meetletacbmarketplace'),
|
||||
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($section === 'featureaccess') {
|
||||
$matrix = featureaccess::builtin_defaults();
|
||||
$json = json_encode($matrix, JSON_UNESCAPED_UNICODE);
|
||||
set_config('featureaccess', $json, 'meetletacbmarketplace');
|
||||
echo json_encode([
|
||||
'success' => true,
|
||||
'section' => 'featureaccess',
|
||||
'matrix' => $matrix,
|
||||
'message' => get_string('reset_success_featureaccess', 'meetletacbmarketplace'),
|
||||
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
||||
exit;
|
||||
}
|
||||
|
||||
throw new moodle_exception('invalidparameter');
|
||||
} catch (Throwable $e) {
|
||||
$error = $e->getMessage();
|
||||
if ($e instanceof moodle_exception) {
|
||||
$info = get_exception_info($e);
|
||||
if (!empty($info->message)) {
|
||||
$error = (string)$info->message;
|
||||
}
|
||||
}
|
||||
echo json_encode([
|
||||
'success' => false,
|
||||
'error' => $error !== '' ? $error : get_string('reset_error', 'meetletacbmarketplace'),
|
||||
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
||||
}
|
||||
Reference in New Issue
Block a user