request = $request; $this->flash = $flash; } /** * @inheritDoc */ public function handle() { if ( ! current_user_can( Capabilities::ADMIN ) ) { $message = Notification::get( 'forbidden' ); if ( $this->request->is_ajax() ) { return $this->json( [ 'error' => $message, ], Code::FORBIDDEN ); } $this->flash->add_message( 'error', $message ); return $this->redirect( new Action_URL( Action_Index::TWOFAS_PERSONAL_SETTINGS ) ); } return $this->next->handle(); } }