MDL-30761 make it work under Oracle. To revisit after MDL-29765 is done.

This commit is contained in:
Eloy Lafuente (stronk7)
2011-12-20 22:36:31 +01:00
parent 311b953168
commit e968c5f910
+7 -1
View File
@@ -1604,7 +1604,9 @@ function role_assign($roleid, $userid, $contextid, $component = '', $itemid = 0,
$timemodified = time();
}
/// Check for existing entry
// Check for existing entry
// TODO: Revisit this sql_empty() use once Oracle bindings are improved. MDL-29765
$component = ($component === '') ? $DB->sql_empty() : $component;
$ras = $DB->get_records('role_assignments', array('roleid'=>$roleid, 'contextid'=>$context->id, 'userid'=>$userid, 'component'=>$component, 'itemid'=>$itemid), 'id');
if ($ras) {
@@ -1717,6 +1719,10 @@ function role_unassign_all(array $params, $subcontexts = false, $includemanual =
}
}
// TODO: Revisit this sql_empty() use once Oracle bindings are improved. MDL-29765
if (isset($params['component'])) {
$params['component'] = ($params['component'] === '') ? $DB->sql_empty() : $params['component'];
}
$ras = $DB->get_records('role_assignments', $params);
foreach($ras as $ra) {
$DB->delete_records('role_assignments', array('id'=>$ra->id));