File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
classes/Visualizer/Gutenberg Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -192,6 +192,10 @@ public function register_rest_endpoints() {
192
192
* Get Post Meta Fields
193
193
*/
194
194
public function get_visualizer_data ( $ post ) {
195
+ if ( ! current_user_can ( 'edit_posts ' ) ) {
196
+ return false ;
197
+ }
198
+
195
199
$ data = array ();
196
200
$ post_id = $ post ['id ' ];
197
201
@@ -239,6 +243,10 @@ public function get_visualizer_data( $post ) {
239
243
* Rest Callback Method
240
244
*/
241
245
public function update_chart_data ( $ data ) {
246
+ if ( ! current_user_can ( 'edit_posts ' ) ) {
247
+ return false ;
248
+ }
249
+
242
250
if ( $ data ['id ' ] && ! is_wp_error ( $ data ['id ' ] ) ) {
243
251
244
252
update_post_meta ( $ data ['id ' ], Visualizer_Plugin::CF_CHART_TYPE , $ data ['visualizer-chart-type ' ] );
@@ -352,6 +360,10 @@ public function toUTF8( $datum ) {
352
360
* Handle remote CSV data
353
361
*/
354
362
public function upload_csv_data ( $ data ) {
363
+ if ( ! current_user_can ( 'edit_posts ' ) ) {
364
+ return false ;
365
+ }
366
+
355
367
if ( $ data ['url ' ] && ! is_wp_error ( $ data ['url ' ] ) && filter_var ( $ data ['url ' ], FILTER_VALIDATE_URL ) ) {
356
368
$ source = new Visualizer_Source_Csv_Remote ( $ data ['url ' ] );
357
369
if ( $ source ->fetch () ) {
@@ -375,6 +387,10 @@ public function upload_csv_data( $data ) {
375
387
* Get permission data
376
388
*/
377
389
public function get_permission_data ( $ data ) {
390
+ if ( ! current_user_can ( 'edit_posts ' ) ) {
391
+ return false ;
392
+ }
393
+
378
394
$ options = array ();
379
395
switch ( $ data ['type ' ] ) {
380
396
case 'users ' :
You can’t perform that action at this time.
0 commit comments