original_string: public static function get_linked_logins($userid = false) {
          global $USER;
  
          if ($userid === false) {
              $userid = $USER->id;
          }
  
          if (\core\session\manager::is_loggedinas()) {
              throw new moodle_exception('notwhileloggedinas', 'auth_oauth2');
          }
  
          $context = context_user::instance($userid);
          require_capability('auth/oauth2:managelinkedlogins', $context);
  
          return linked_login::get_records(['userid' => $userid, 'confirmtoken' => '']);
      }
code: public static function get_linked_logins($userid = false) {
          global $USER;
  
          if ($userid === false) {
              $userid = $USER->id;
          }
  
          if (\core\session\manager::is_loggedinas()) {
              throw new moodle_exception('notwhileloggedinas', 'auth_oauth2');
          }
  
          $context = context_user::instance($userid);
          require_capability('auth/oauth2:managelinkedlogins', $context);
  
          return linked_login::get_records(['userid' => $userid, 'confirmtoken' => '']);
      }
code_tokens: public static function get_linked_logins ( $ userid = false ) { global $ USER ; if ( $ userid === false ) { $ userid = $ USER -> id ; } if ( \ core \ session \ manager :: is_loggedinas ( ) ) { throw new moodle_exception ( 'notwhileloggedinas' , 'auth_oauth2' ) ; } $ context = context_user :: instance ( $ userid ) ; require_capability ( 'auth/oauth2:managelinkedlogins' , $ context ) ; return linked_login :: get_records ( [ 'userid' => $ userid , 'confirmtoken' => '' ] ) ; }
docstring: List linked logins
  
  Requires auth/oauth2:managelinkedlogins capability at the user context.
  
  @param int $userid (defaults to $USER->id)
  @return boolean
docstring_tokens: List linked logins