Skip to content

Commit 7ccd6fe

Browse files
fix: restrict database query action to admins
1 parent 1e71786 commit 7ccd6fe

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

classes/Visualizer/Module/AIBuilder.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,12 @@ public function uploadData(): void {
365365

366366
// ── Database query ────────────────────────────────────────────────
367367
case 'db_query':
368+
if ( ! current_user_can( 'administrator' ) ) {
369+
wp_send_json_error( array( 'message' => __( 'Action not allowed for this user.', 'visualizer' ) ) );
370+
}
371+
if ( ! is_super_admin() ) {
372+
wp_send_json_error( array( 'message' => __( 'Action not allowed for this user.', 'visualizer' ) ) );
373+
}
368374
if ( empty( $_POST['db_query'] ) ) {
369375
wp_send_json_error( array( 'message' => __( 'No query provided.', 'visualizer' ) ) );
370376
}

0 commit comments

Comments
 (0)