Merge branch 'MDL-49821-master-master' of git://github.com/jleyva/moodle
[moodle.git] / notes / externallib.php
index 8f23cae..944b2fb 100644 (file)
@@ -526,7 +526,8 @@ class core_notes_external extends external_api {
         }
         $user = null;
         if (!empty($params['userid'])) {
-            $user = core_user::get_user($params['userid'], 'id', MUST_EXIST);
+            $user = core_user::get_user($params['userid'], '*', MUST_EXIST);
+            core_user::require_active_user($user);
         }
 
         $course = get_course($params['courseid']);
@@ -680,15 +681,8 @@ class core_notes_external extends external_api {
         require_capability('moodle/notes:view', $context);
 
         if (!empty($params['userid'])) {
-            $user = core_user::get_user($params['userid'], 'id, deleted', MUST_EXIST);
-
-            if ($user->deleted) {
-                throw new moodle_exception('userdeleted');
-            }
-
-            if (isguestuser($user)) {
-                throw new moodle_exception('invaliduserid');
-            }
+            $user = core_user::get_user($params['userid'], '*', MUST_EXIST);
+            core_user::require_active_user($user);
 
             if ($course->id != SITEID and !can_access_course($course, $user, '', true)) {
                 throw new moodle_exception('notenrolledprofile');