| 1 |
<?php |
| 2 |
/** |
| 3 |
* Our API calls responsible for handling requests from admins requesting a refresh for the site. |
| 4 |
* |
| 5 |
* @package ForceRefresh |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace JordanLeven\Plugins\ForceRefresh\Api; |
| 9 |
|
| 10 |
use JordanLeven\Plugins\ForceRefresh\Api\Api_Handler; |
| 11 |
|
| 12 |
/** |
| 13 |
* Main class controller. |
| 14 |
*/ |
| 15 |
abstract class Api_Handler_Admin extends Api_Handler { |
| 16 |
|
| 17 |
/** |
| 18 |
* Returns the shared admin permission callback for admin endpoints. |
| 19 |
* |
| 20 |
* @return array |
| 21 |
*/ |
| 22 |
protected function get_admin_permission_callback(): array { |
| 23 |
return array( $this, 'user_is_able_to_admin_force_refresh' ); |
| 24 |
} |
| 25 |
|
| 26 |
/** |
| 27 |
* Method for checking if a user can make changes to Force Refresh. |
| 28 |
* |
| 29 |
* @return bool True if use can modify Force Refresh settings. |
| 30 |
*/ |
| 31 |
public function user_is_able_to_admin_force_refresh(): bool { |
| 32 |
return current_user_can( WP_FORCE_REFRESH_CAPABILITY ); |
| 33 |
} |
| 34 |
} |
| 35 |
|