Skip to content
Snippets Groups Projects
Commit fc1363d6 authored by DFNVC's avatar DFNVC
Browse files

Anpassung für Moodle 3.6 und 3.7 - Bug MDL-65668

parent 834174ca
No related branches found
No related tags found
No related merge requests found
...@@ -11,13 +11,63 @@ ...@@ -11,13 +11,63 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/ */
//
// DFNconf - Workaround wegen Bug MDL-65668
//
function ac_assign_capability($capability, $permission, $roleid, $contextid, $overwrite = false) {
global $USER, $DB;
if ($contextid instanceof context) {
$context = $contextid;
} else {
$context = context::instance_by_id($contextid);
}
// Capability must exist.
//if (!$capinfo = get_capability_info($capability)) {
// throw new coding_exception("Capability '{$capability}' was not found! This has to be fixed in code.");
//}
if (empty($permission) || $permission == CAP_INHERIT) { // if permission is not set
unassign_capability($capability, $roleid, $context->id);
return true;
}
$existing = $DB->get_record('role_capabilities', array('contextid'=>$context->id, 'roleid'=>$roleid, 'capability'=>$capability));
if ($existing and !$overwrite) { // We want to keep whatever is there already
return true;
}
$cap = new stdClass();
$cap->contextid = $context->id;
$cap->roleid = $roleid;
$cap->capability = $capability;
$cap->permission = $permission;
$cap->timemodified = time();
$cap->modifierid = empty($USER->id) ? 0 : $USER->id;
if ($existing) {
$cap->id = $existing->id;
$DB->update_record('role_capabilities', $cap);
} else {
if ($DB->record_exists('context', array('id'=>$context->id))) {
$DB->insert_record('role_capabilities', $cap);
}
}
// Reset any cache of this role, including MUC.
accesslib_clear_role_cache($roleid);
return true;
}
function xmldb_adobeconnect_install() { function xmldb_adobeconnect_install() {
global $DB; global $DB;
// The commented out code is waiting for a fix for MDL-25709
$result = true; $result = true;
$timenow = time(); $timenow = time();
$sysctx = get_context_instance(CONTEXT_SYSTEM); $sysctx = context_system::instance();
$mrole = new stdClass(); $mrole = new stdClass();
$levels = array(CONTEXT_COURSECAT, CONTEXT_COURSE, CONTEXT_MODULE); $levels = array(CONTEXT_COURSECAT, CONTEXT_COURSE, CONTEXT_MODULE);
...@@ -51,11 +101,9 @@ function xmldb_adobeconnect_install() { ...@@ -51,11 +101,9 @@ function xmldb_adobeconnect_install() {
if ($rid = create_role(get_string('adobeconnectpresenter', 'adobeconnect'), 'adobeconnectpresenter', if ($rid = create_role(get_string('adobeconnectpresenter', 'adobeconnect'), 'adobeconnectpresenter',
get_string('adobeconnectpresenterdescription', 'adobeconnect'), 'adobeconnectpresenter')) { get_string('adobeconnectpresenterdescription', 'adobeconnect'), 'adobeconnectpresenter')) {
$mrole = new stdClass(); $mrole = new stdClass();
$mrole->id = $rid; $mrole->id = $rid;
$result = $result && assign_capability('mod/adobeconnect:meetingpresenter', CAP_ALLOW, $mrole->id, $sysctx->id); $result = $result && ac_assign_capability('mod/adobeconnect:meetingpresenter', CAP_ALLOW, $mrole->id, $sysctx->id);
set_role_contextlevels($mrole->id, $levels); set_role_contextlevels($mrole->id, $levels);
} else { } else {
$result = false; $result = false;
...@@ -93,7 +141,7 @@ function xmldb_adobeconnect_install() { ...@@ -93,7 +141,7 @@ function xmldb_adobeconnect_install() {
$mrole = new stdClass(); $mrole = new stdClass();
$mrole->id = $rid; $mrole->id = $rid;
$result = $result && assign_capability('mod/adobeconnect:meetingparticipant', CAP_ALLOW, $mrole->id, $sysctx->id); $result = $result && ac_assign_capability('mod/adobeconnect:meetingparticipant', CAP_ALLOW, $mrole->id, $sysctx->id);
set_role_contextlevels($mrole->id, $levels); set_role_contextlevels($mrole->id, $levels);
} else { } else {
$result = false; $result = false;
...@@ -130,7 +178,7 @@ function xmldb_adobeconnect_install() { ...@@ -130,7 +178,7 @@ function xmldb_adobeconnect_install() {
$mrole = new stdClass(); $mrole = new stdClass();
$mrole->id = $rid; $mrole->id = $rid;
$result = $result && assign_capability('mod/adobeconnect:meetinghost', CAP_ALLOW, $mrole->id, $sysctx->id); $result = $result && ac_assign_capability('mod/adobeconnect:meetinghost', CAP_ALLOW, $mrole->id, $sysctx->id);
set_role_contextlevels($mrole->id, $levels); set_role_contextlevels($mrole->id, $levels);
} else { } else {
$result = false; $result = false;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/ */
$plugin->version = 2018121900; // The current module version (Date: YYYYMMDDXX) $plugin->version = 2019073000; // The current module version (Date: YYYYMMDDXX)
$plugin->requires = 2014051212; // Requires this Moodle version $plugin->requires = 2014051212; // Requires this Moodle version
$plugin->component = 'mod_adobeconnect'; $plugin->component = 'mod_adobeconnect';
$plugin->cron = 0; // Period for cron to check this module (secs) $plugin->cron = 0; // Period for cron to check this module (secs)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment