Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'w17_MDL-32477_m22_cloneperm' of git://github.com/skodak…

…/moodle into MOODLE_22_STABLE
  • Loading branch information...
commit ac05e65ef21c23f15f0ce1ee0518cc2416612029 2 parents 7b969f0 + 804feed
@danpoltawski danpoltawski authored
Showing with 2 additions and 1 deletion.
  1. +2 −1  lib/accesslib.php
View
3  lib/accesslib.php
@@ -2484,6 +2484,7 @@ function update_capabilities($component = 'moodle') {
}
}
// Add new capabilities to the stored definition.
+ $existingcaps = $DB->get_records_menu('capabilities', array(), 'id', 'id, name');
foreach ($newcaps as $capname => $capdef) {
$capability = new stdClass();
$capability->name = $capname;
@@ -2494,7 +2495,7 @@ function update_capabilities($component = 'moodle') {
$DB->insert_record('capabilities', $capability, false);
- if (isset($capdef['clonepermissionsfrom']) && in_array($capdef['clonepermissionsfrom'], $storedcaps)){
+ if (isset($capdef['clonepermissionsfrom']) && in_array($capdef['clonepermissionsfrom'], $existingcaps)){
if ($rolecapabilities = $DB->get_records('role_capabilities', array('capability'=>$capdef['clonepermissionsfrom']))){
foreach ($rolecapabilities as $rolecapability){
//assign_capability will update rather than insert if capability exists
Please sign in to comment.
Something went wrong with that request. Please try again.