| @@ -152,8 +152,14 @@ | ||
| 152 | 152 | * @param bool $redirect_to_dashboard Redirect to dashboard. |
| 153 | 153 | * @return bool|void |
| 154 | 154 | */ |
| 155 | 155 | public function dismissWizard( $redirect_to_dashboard = true ) { |
| 156 | + if ( ! current_user_can( 'manage_options' ) ) { | |
| 157 | + wp_die( esc_html__( 'You do not have permission to perform this action.', 'visualizer' ), '', array( 'response' => 403 ) ); | |
| 158 | + } | |
| 159 | + if ( false !== $redirect_to_dashboard ) { | |
| 160 | + check_admin_referer( 'visualizer_dismiss_wizard' ); | |
| 161 | + } | |
| 156 | 162 | // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 157 | 163 | $status = isset( $_REQUEST['status'] ) ? (int) $_REQUEST['status'] : 0; |
| 158 | 164 | update_option( 'visualizer_fresh_install', $status ); |
| 159 | 165 | delete_option( 'visualizer_wizard_data' ); |
| @@ -168,8 +174,11 @@ | ||
| 168 | 174 | * Setup wizard process. |
| 169 | 175 | */ |
| 170 | 176 | public function visualizer_wizard_step_process() { |
| 171 | 177 | check_ajax_referer( VISUALIZER_ABSPATH, 'security' ); |
| 178 | + if ( ! current_user_can( 'manage_options' ) ) { | |
| 179 | + wp_send_json( array( 'status' => 0 ), 403 ); | |
| 180 | + } | |
| 172 | 181 | $step = ! empty( $_POST['step'] ) ? sanitize_text_field( wp_unslash( $_POST['step'] ) ) : 1; |
| 173 | 182 | switch ( $step ) { |
| 174 | 183 | case 'step_2': |
| 175 | 184 | $this->setup_wizard_import_chart(); |