Skip to content
Browse files

MDL-34471 libraries: changing strictness of context_XXXX::instance() …

…when needed
  • Loading branch information...
1 parent bf0f06b commit 0d4d49d18aa1f3e9bc780b2249d9d14200ceddcb @ankitagarwal ankitagarwal committed Aug 2, 2012
Showing with 8 additions and 8 deletions.
  1. +7 −7 group/externallib.php
  2. +1 −1 mod/forum/index.php
View
14 group/externallib.php
@@ -89,7 +89,7 @@ public static function create_groups($groups) {
}
// now security checks
- $context = context_course::instance($group->courseid);
+ $context = context_course::instance($group->courseid, IGNORE_MISSING);
try {
self::validate_context($context);
} catch (Exception $e) {
@@ -168,7 +168,7 @@ public static function get_groups($groupids) {
$group = groups_get_group($groupid, 'id, courseid, name, description, descriptionformat, enrolmentkey', MUST_EXIST);
// now security checks
- $context = context_course::instance($group->courseid);
+ $context = context_course::instance($group->courseid, IGNORE_MISSING);
try {
self::validate_context($context);
} catch (Exception $e) {
@@ -235,7 +235,7 @@ public static function get_course_groups($courseid) {
$params = self::validate_parameters(self::get_course_groups_parameters(), array('courseid'=>$courseid));
// now security checks
- $context = context_course::instance($params['courseid']);
+ $context = context_course::instance($params['courseid'], IGNORE_MISSING);
try {
self::validate_context($context);
} catch (Exception $e) {
@@ -318,7 +318,7 @@ public static function delete_groups($groupids) {
}
// now security checks
- $context = context_course::instance($group->courseid);
+ $context = context_course::instance($group->courseid, IGNORE_MISSING);
try {
self::validate_context($context);
} catch (Exception $e) {
@@ -376,7 +376,7 @@ public static function get_group_members($groupids) {
// validate params
$group = groups_get_group($groupid, 'id, courseid, name, enrolmentkey', MUST_EXIST);
// now security checks
- $context = context_course::instance($group->courseid);
+ $context = context_course::instance($group->courseid, IGNORE_MISSING);
try {
self::validate_context($context);
} catch (Exception $e) {
@@ -456,7 +456,7 @@ public static function add_group_members($members) {
$user = $DB->get_record('user', array('id'=>$userid, 'deleted'=>0, 'mnethostid'=>$CFG->mnet_localhost_id), '*', MUST_EXIST);
// now security checks
- $context = context_course::instance($group->courseid);
+ $context = context_course::instance($group->courseid, IGNORE_MISSING);
try {
self::validate_context($context);
} catch (Exception $e) {
@@ -534,7 +534,7 @@ public static function delete_group_members($members) {
$user = $DB->get_record('user', array('id'=>$userid, 'deleted'=>0, 'mnethostid'=>$CFG->mnet_localhost_id), '*', MUST_EXIST);
// now security checks
- $context = context_course::instance($group->courseid);
+ $context = context_course::instance($group->courseid, IGNORE_MISSING);
try {
self::validate_context($context);
} catch (Exception $e) {
View
2 mod/forum/index.php
@@ -129,7 +129,7 @@
$forum = $forums[$forumid];
- if (!$context = context_module::instance($cm->id)) {
+ if (!$context = context_module::instance($cm->id, IGNORE_MISSING)) {
continue; // Shouldn't happen
}

0 comments on commit 0d4d49d

Please sign in to comment.
Something went wrong with that request. Please try again.