mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
MDL-39111 check repository instance context instead of repository usage context (following MDL-34346)
This commit is contained in:
parent
b3661ab272
commit
f6812f575f
@ -1123,7 +1123,7 @@ abstract class repository implements cacheable_object {
|
||||
* Do not use this function to access repository contents, because it
|
||||
* does not set the current context
|
||||
*
|
||||
* @see rpository::get_repository_by_id()
|
||||
* @see repository::get_repository_by_id()
|
||||
*
|
||||
* @static
|
||||
* @param integer $id repository instance id
|
||||
@ -1877,7 +1877,7 @@ abstract class repository implements cacheable_object {
|
||||
|
||||
if ($type->get_visible()) {
|
||||
//if the instance is unique so it's visible, otherwise check if the instance has a enabled context
|
||||
if (empty($instanceoptions) || $type->get_contextvisibility($this->context)) {
|
||||
if (empty($instanceoptions) || $type->get_contextvisibility(context::instance_by_id($this->instance->contextid))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,16 @@ http://docs.moodle.org/dev/Repository_API
|
||||
* can_be_edited_by_user() encapsulates all the tests to make sure that the current user
|
||||
has the rights to edit the instance of this repository.
|
||||
|
||||
* repository::get_instances() (used by filepicker and texteditor to populate the
|
||||
list of available repositories) now calls repository constructor specifying the
|
||||
context where repository will be used.
|
||||
When checking permissions inside repository class use:
|
||||
$this->instance->contextid - to find the context where repository was created;
|
||||
$this->context - to find the current context where repository is used.
|
||||
This also means that the same repository instance may now have different names when
|
||||
called from different contexts.
|
||||
Avoid calling repository::get_instance(), use repository::get_repository_by_id() instead.
|
||||
|
||||
=== 2.4 ===
|
||||
|
||||
* copy_to_area() can receive a new parameter called $areamaxbytes which controls the maximum
|
||||
|
Loading…
x
Reference in New Issue
Block a user