Permalink
Browse files

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

  • Loading branch information...
1 parent 1729746 commit 6662dee76d536e1ba9004d73b4714e7b54992720 @stronk7 stronk7 committed Dec 20, 2011
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/accesslib.php
View
@@ -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));

0 comments on commit 6662dee

Please sign in to comment.