Created
November 19, 2024 09:07
-
-
Save kharissulistiyo/7c969a3d91d0cf7edf1fafd5b592676a to your computer and use it in GitHub Desktop.
Patch code sample: Sensitive Data Exposure vulnerability
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
register_rest_route($this->namespace . '/v1', '/newsletter', array( | |
array( | |
'methods' => WP_REST_Server::READABLE, | |
'callback' => array($this, 'get_subscribers_callback'), | |
'args' => array( | |
'group_id' => array( | |
'required' => false, | |
) | |
), | |
'permission_callback' => array($this, 'getSubscribersPermission') | |
) | |
)); | |
* Check user permission | |
* | |
* @param $request | |
* | |
* @return bool | |
*/ | |
public function getSubscribersPermission($request) { | |
return current_user_can('wpsms_subscribers'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment