| 1 |
<?php |
| 2 |
namespace JFB_Components\Rest_Api; |
| 3 |
|
| 4 |
// If this file is called directly, abort. |
| 5 |
if ( ! defined( 'WPINC' ) ) { |
| 6 |
die; |
| 7 |
} |
| 8 |
|
| 9 |
/** |
| 10 |
* Base class for REST API endpoints that require authentication |
| 11 |
* and form editing permissions. |
| 12 |
* |
| 13 |
* This class extends Rest_Api_Endpoint_Base and implements |
| 14 |
* permission checking to ensure only users with proper |
| 15 |
* capabilities can access these endpoints. |
| 16 |
* |
| 17 |
* @since 3.5.3 |
| 18 |
*/ |
| 19 |
abstract class Rest_Api_Private_Endpoint_Base extends Rest_Api_Endpoint_Base { |
| 20 |
|
| 21 |
/** |
| 22 |
* Check if the current user has permission to access this endpoint. |
| 23 |
* |
| 24 |
* Verifies that the user has the capability to edit JetFormBuilder forms. |
| 25 |
* Non-authenticated users automatically fail this check. |
| 26 |
* |
| 27 |
* @return bool True if user has permission, false otherwise. |
| 28 |
*/ |
| 29 |
public function check_permission(): bool { |
| 30 |
return current_user_can( 'edit_jet_fb_forms' ); |
| 31 |
} |
| 32 |
|
| 33 |
} |
| 34 |
|