Adobe Connect Bridge free edition (meetletacbfree) v1.1.3
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?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/>.
|
||||
|
||||
/**
|
||||
* Ajax endpoint: run one Adobe Connect connection-test step.
|
||||
*
|
||||
* @package mod_meetletacbfree
|
||||
* @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_meetletacbfree\local\conntest_runner;
|
||||
|
||||
require_login();
|
||||
require_capability('moodle/site:config', context_system::instance());
|
||||
require_sesskey();
|
||||
|
||||
\mod_meetletacbfree\registration\manager::require_registered();
|
||||
|
||||
$step = required_param('step', PARAM_ALPHA);
|
||||
$result = conntest_runner::run_step($step);
|
||||
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
echo json_encode($result);
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
|
||||
/**
|
||||
* Ajax endpoint: activate / recheck / deactivate MeetLet site registration.
|
||||
*
|
||||
* @package mod_meetletacbfree
|
||||
* @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_meetletacbfree\registration\error_mapper;
|
||||
use mod_meetletacbfree\registration\manager;
|
||||
use mod_meetletacbfree\registration\registration_exception;
|
||||
|
||||
require_login();
|
||||
require_capability('moodle/site:config', context_system::instance());
|
||||
require_sesskey();
|
||||
|
||||
$action = required_param('action', PARAM_ALPHA);
|
||||
$apiurl = optional_param('registration_api_url', '', PARAM_URL);
|
||||
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
|
||||
try {
|
||||
if ($apiurl !== '') {
|
||||
set_config(manager::CONFIG_API_URL, rtrim($apiurl, '/'), 'meetletacbfree');
|
||||
}
|
||||
|
||||
if ($action === 'activate') {
|
||||
manager::activate();
|
||||
echo json_encode([
|
||||
'success' => true,
|
||||
'message' => get_string('registration_activated', 'meetletacbfree'),
|
||||
'summary' => manager::status_summary(),
|
||||
]);
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($action === 'recheck' || $action === 'refresh' || $action === 'validate') {
|
||||
manager::recheck(true);
|
||||
echo json_encode([
|
||||
'success' => true,
|
||||
'message' => get_string('registration_rechecked', 'meetletacbfree'),
|
||||
'summary' => manager::status_summary(),
|
||||
]);
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($action === 'deactivate') {
|
||||
manager::deactivate();
|
||||
echo json_encode([
|
||||
'success' => true,
|
||||
'message' => get_string('registration_deactivated', 'meetletacbfree'),
|
||||
'summary' => manager::status_summary(),
|
||||
]);
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($action === 'status') {
|
||||
echo json_encode([
|
||||
'success' => true,
|
||||
'summary' => manager::status_summary(),
|
||||
]);
|
||||
exit;
|
||||
}
|
||||
|
||||
throw new moodle_exception('invalidparameter');
|
||||
} catch (Throwable $e) {
|
||||
$ex = registration_exception::from_throwable($e);
|
||||
$mapped = error_mapper::from_exception($ex);
|
||||
echo json_encode([
|
||||
'success' => false,
|
||||
'error' => $mapped['message'] ?? $ex->get_api_message(),
|
||||
'error_code' => $ex->get_error_code(),
|
||||
'request_id' => $ex->get_request_id(),
|
||||
'summary' => manager::status_summary(),
|
||||
]);
|
||||
}
|
||||
@@ -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_meetletacbfree
|
||||
* @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_meetletacbfree\local\featureaccess;
|
||||
use mod_meetletacbfree\local\roles;
|
||||
|
||||
require_login();
|
||||
require_capability('moodle/site:config', context_system::instance());
|
||||
require_sesskey();
|
||||
|
||||
\mod_meetletacbfree\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, 'meetletacbfree');
|
||||
echo json_encode([
|
||||
'success' => true,
|
||||
'section' => 'rolemapping',
|
||||
'matrix' => roles::matrix_from_rules($rules),
|
||||
'message' => get_string('reset_success_rolemapping', 'meetletacbfree'),
|
||||
], 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, 'meetletacbfree');
|
||||
echo json_encode([
|
||||
'success' => true,
|
||||
'section' => 'featureaccess',
|
||||
'matrix' => $matrix,
|
||||
'message' => get_string('reset_success_featureaccess', 'meetletacbfree'),
|
||||
], 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', 'meetletacbfree'),
|
||||
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
||||
}
|
||||
Reference in New Issue
Block a user