| @@ -24,14 +24,15 @@ | ||
| 24 | 24 | /** |
| 25 | 25 | * Controller constructor. |
| 26 | 26 | * |
| 27 | 27 | * Register endpoints on 'rest_api_init'. |
| 28 | + * | |
| 28 | 29 | */ |
| 29 | 30 | public function __construct() { |
| 30 | 31 | // TODO: Controllers and endpoints can have common interface. |
| 31 | 32 | |
| 32 | 33 | // TODO: Uncomment when native 3rd plugins uses V2. |
| 33 | - // $this->deprecated(); | |
| 34 | + //$this->deprecated(); | |
| 34 | 35 | |
| 35 | 36 | $this->namespace = Manager::ROOT_NAMESPACE . '/v' . Manager::VERSION; |
| 36 | 37 | $this->rest_base = Manager::REST_BASE . $this->get_name(); |
| 37 | 38 | |
| @@ -188,9 +189,9 @@ | ||
| 188 | 189 | protected function register_internal_endpoints() { |
| 189 | 190 | register_rest_route( $this->get_namespace(), '/' . $this->get_rest_base(), [ |
| 190 | 191 | [ |
| 191 | 192 | 'methods' => WP_REST_Server::READABLE, |
| 192 | - 'callback' => [ $this, 'get_items' ], | |
| 193 | + 'callback' => array( $this, 'get_items' ), | |
| 193 | 194 | 'args' => [], |
| 194 | 195 | 'permission_callback' => function ( $request ) { |
| 195 | 196 | return $this->get_permission_callback( $request ); |
| 196 | 197 | }, |
| @@ -303,9 +304,9 @@ | ||
| 303 | 304 | * Get permission callback. |
| 304 | 305 | * |
| 305 | 306 | * Default controller permission callback. |
| 306 | 307 | * By default endpoint will inherit the permission callback from the controller. |
| 307 | - * By default permission is `current_user_can( 'manage_options' );`. | |
| 308 | + * By default permission is `current_user_can( 'administrator' );`. | |
| 308 | 309 | * |
| 309 | 310 | * @param \WP_REST_Request $request |
| 310 | 311 | * |
| 311 | 312 | * @return bool |
| @@ -318,9 +319,9 @@ | ||
| 318 | 319 | case 'UPDATE': |
| 319 | 320 | case 'PUT': |
| 320 | 321 | case 'DELETE': |
| 321 | 322 | case 'PATCH': |
| 322 | - return current_user_can( 'manage_options' ); | |
| 323 | + return current_user_can( 'administrator' ); | |
| 323 | 324 | } |
| 324 | 325 | |
| 325 | 326 | return false; |
| 326 | 327 | } |