| @@ -446,18 +446,12 @@ | ||
| 446 | 446 | * |
| 447 | 447 | * @return WP_REST_Response |
| 448 | 448 | */ |
| 449 | 449 | public function get_all_users_sessions( WP_REST_Request $request ): WP_REST_Response { |
| 450 | - global $wpdb; | |
| 451 | - | |
| 452 | 450 | $auth_service = AuthService::instance(); |
| 453 | 451 | |
| 454 | 452 | // Get all users who have refresh tokens. |
| 455 | - $user_ids = $wpdb->get_col( | |
| 456 | - "SELECT DISTINCT user_id | |
| 457 | - FROM {$wpdb->usermeta} | |
| 458 | - WHERE meta_key = '_woocommerce_pos_refresh_tokens'" | |
| 459 | - ); | |
| 453 | + $user_ids = $auth_service->sessions()->users_with_sessions(); | |
| 460 | 454 | |
| 461 | 455 | $users_data = array(); |
| 462 | 456 | |
| 463 | 457 | // Get current JTI if available from the request token. |