| @@ -169,8 +169,12 @@ | ||
| 169 | 169 | */ |
| 170 | 170 | public function getJsonRoots() { |
| 171 | 171 | check_ajax_referer( Visualizer_Plugin::ACTION_JSON_GET_ROOTS . Visualizer_Plugin::VERSION, 'security' ); |
| 172 | 172 | |
| 173 | + if ( ! current_user_can( 'edit_posts' ) ) { | |
| 174 | + wp_send_json_error( array( 'msg' => esc_html__( 'You do not have permission to perform this action.', 'visualizer' ) ) ); | |
| 175 | + } | |
| 176 | + | |
| 173 | 177 | $params = wp_parse_args( $_POST['params'] ); |
| 174 | 178 | |
| 175 | 179 | $source = new Visualizer_Source_Json( $params ); |
| 176 | 180 | |
| @@ -190,8 +194,12 @@ | ||
| 190 | 194 | * @access public |
| 191 | 195 | */ |
| 192 | 196 | public function getJsonData() { |
| 193 | 197 | check_ajax_referer( Visualizer_Plugin::ACTION_JSON_GET_DATA . Visualizer_Plugin::VERSION, 'security' ); |
| 198 | + | |
| 199 | + if ( ! current_user_can( 'edit_posts' ) ) { | |
| 200 | + wp_send_json_error( array( 'msg' => esc_html__( 'You do not have permission to perform this action.', 'visualizer' ) ) ); | |
| 201 | + } | |
| 194 | 202 | |
| 195 | 203 | $params = wp_parse_args( $_POST['params'] ); |
| 196 | 204 | |
| 197 | 205 | $chart_id = $params['chart']; |