| @@ -1,5 +1,5 @@ | ||
| 1 | -<?php // phpcs:ignore Standard.Category.SniffName.ErrorCode | |
| 1 | +<?php | |
| 2 | 2 | |
| 3 | 3 | /** |
| 4 | 4 | * JSON REST API. |
| 5 | 5 | */ |
| @@ -26,10 +26,9 @@ | ||
| 26 | 26 | : ''; |
| 27 | 27 | |
| 28 | 28 | if ( |
| 29 | 29 | '/' . self::WPDA_NAMESPACE === $rest_route && |
| 30 | - ! current_user_can( 'manage_options' ) && | |
| 31 | - ! current_user_can( 'manage_sites' ) | |
| 30 | + ! WPDA::current_user_is_admin() | |
| 32 | 31 | ) { |
| 33 | 32 | return new \WP_Error( |
| 34 | 33 | 'rest_cannot_access', |
| 35 | 34 | __( 'Only authenticated admin users can access the REST API.', 'wp-data-access' ), |
| @@ -74,8 +73,20 @@ | ||
| 74 | 73 | |
| 75 | 74 | // Settings |
| 76 | 75 | $settings = new WPDA_Settings(); |
| 77 | 76 | $settings->register_rest_routes(); |
| 77 | + | |
| 78 | + // Query Builder | |
| 79 | + $qb = new WPDA_QB(); | |
| 80 | + $qb->register_rest_routes(); | |
| 81 | + | |
| 82 | + // AI Assistant | |
| 83 | + $ai = new WPDA_AI(); | |
| 84 | + $ai->register_rest_routes(); | |
| 85 | + | |
| 86 | + // Scheduled Exports | |
| 87 | + $export = new WPDA_Export(); | |
| 88 | + $export->register_rest_routes(); | |
| 78 | 89 | |
| 79 | 90 | } |
| 80 | 91 | |
| 81 | 92 | } |