Skip to content

Commit

Permalink
MDL-53566 core: Add support for context locking
Browse files Browse the repository at this point in the history
This chagne adds support for a new feature known as Context Locking.
This allows a context to be locked, thereby removing all write
capabilities for all users (including admin) for that context, and all
child contexts.
  • Loading branch information
andrewnicols committed Nov 13, 2018
1 parent 208950c commit 0616f04
Show file tree
Hide file tree
Showing 16 changed files with 526 additions and 63 deletions.
2 changes: 1 addition & 1 deletion cohort/lib.php
Expand Up @@ -634,4 +634,4 @@ function cohort_get_list_of_themes() {
}
}
return $themes;
}
}
3 changes: 3 additions & 0 deletions course/classes/category.php
Expand Up @@ -238,6 +238,7 @@ public static function get($id, $strictness = MUST_EXIST, $alwaysreturnhidden =
$record->visible = 1;
$record->depth = 0;
$record->path = '';
$record->locked = 0;
self::$coursecat0 = new self($record);
}
return self::$coursecat0;
Expand Down Expand Up @@ -2458,6 +2459,7 @@ public function prepare_to_cache() {
$context = $this->get_context();
$a['xi'] = $context->id;
$a['xp'] = $context->path;
$a['xl'] = $context->locked;
return $a;
}

Expand Down Expand Up @@ -2486,6 +2488,7 @@ public static function wake_from_cache($a) {
$record->ctxdepth = $record->depth + 1;
$record->ctxlevel = CONTEXT_COURSECAT;
$record->ctxinstance = $record->id;
$record->ctxlocked = $a['xl'];
return new self($record, true);
}

Expand Down
1 change: 1 addition & 0 deletions lang/en/role.php
Expand Up @@ -411,6 +411,7 @@
$string['site:manageallmessaging'] = 'Add, remove, block and unblock contacts for any user';
$string['site:manageblocks'] = 'Manage blocks on a page';
$string['site:messageanyuser'] = 'Bypass user privacy preferences for messaging any user';
$string['site:managecontextlocks'] = 'Manage locking of site contexts';
$string['site:mnetloginfromremote'] = 'Login from a remote application via MNet';
$string['site:mnetlogintoremote'] = 'Roam to a remote application via MNet';
$string['site:readallmessages'] = 'Read all messages on site';
Expand Down

0 comments on commit 0616f04

Please sign in to comment.