Finish remove user implementation

This commit is contained in:
Guillermo Roche 2020-05-26 01:37:11 +02:00
parent 03f2c31989
commit c4e2ec96dd
4 changed files with 13 additions and 3 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.8.2, 2020-05-23T19:59:00. -->
<!-- Written by QtCreator 4.8.2, 2020-05-26T01:36:37. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>

View File

@ -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){

View File

@ -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);
}

View File

@ -17,6 +17,7 @@ public:
std::list<std::string> get_packages_info();
std::list<std::string> get_users_info();
void create_user(std::string username, std::string password, bool admin);
void remove_user(std::string username);
};
#endif // SESSION_MANAGER_H