diff --git a/ClienteTFG.pro.user b/ClienteTFG.pro.user index d0e3c07..10ad5f3 100644 --- a/ClienteTFG.pro.user +++ b/ClienteTFG.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/controller_user_info.cpp b/controller_user_info.cpp index dd368b4..af0086b 100644 --- a/controller_user_info.cpp +++ b/controller_user_info.cpp @@ -38,8 +38,12 @@ void controller_user_info::on_button_clicked_add(){ void controller_user_info::on_button_clicked_remove(){ Gtk::TreeModel::Row row = *this->view->tree.get_selection()->get_selected(); - //row.get_value(this->view->m_Columns.r_user); - std::cout << row.get_value(this->view->m_Columns.r_user) << std::endl; + std::string name=row.get_value(this->view->m_Columns.r_user); + if(name.find("Gtk-CRITICAL **:")==std::string::npos){ + this->sesion->remove_user(name); + } + this->view->restart_table(); + this->load_info(); } std::string controller_user_info::get_first(std::string &info){ diff --git a/session_manager.cpp b/session_manager.cpp index 4e3eedf..d045ce5 100644 --- a/session_manager.cpp +++ b/session_manager.cpp @@ -67,3 +67,8 @@ void session_manager::create_user(std::string username, std::string password, bo this->con->write_string(password); this->con->write_string(admin?"t":"f"); } + +void session_manager::remove_user(std::string username){ + this->con->write_string("rusr"); + this->con->write_string(username); +} diff --git a/session_manager.h b/session_manager.h index fb50b2d..6628bd3 100644 --- a/session_manager.h +++ b/session_manager.h @@ -17,6 +17,7 @@ public: std::list get_packages_info(); std::list get_users_info(); void create_user(std::string username, std::string password, bool admin); + void remove_user(std::string username); }; #endif // SESSION_MANAGER_H