* 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
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;
}
}
* 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