diff --git a/ServidorTFG.pro.user b/ServidorTFG.pro.user index 67a19e5..40226cc 100644 --- a/ServidorTFG.pro.user +++ b/ServidorTFG.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/conexion.cpp b/conexion.cpp index b4024ab..76c03c6 100644 --- a/conexion.cpp +++ b/conexion.cpp @@ -61,10 +61,6 @@ void conexion::start_server(){ close(sock); } -bool conexion::check_pass(std::string username, std::string passwd){ - return passwd==this->data->get_passwd(username); -} - void conexion_client(int client){ char buf [256]; diff --git a/conexion.h b/conexion.h index d2ad5cf..8ba79d3 100644 --- a/conexion.h +++ b/conexion.h @@ -9,7 +9,6 @@ class conexion public: conexion(config_reader &conf); virtual void start_server(); - bool check_pass(std::string username, std::string passwd); protected: data_acces* data; int create_socket(int port); diff --git a/installDB.sql b/installDB.sql index 98f8a23..cc0625c 100644 --- a/installDB.sql +++ b/installDB.sql @@ -4,7 +4,7 @@ use bin_database; create table users( id int key not null auto_increment, username varchar(30), -passwd varchar(30), +passwd varchar(200), admin bool ); diff --git a/session_manager.cpp b/session_manager.cpp index 7ad0507..c870743 100644 --- a/session_manager.cpp +++ b/session_manager.cpp @@ -29,8 +29,10 @@ bool session_manager::validate_pass(){ this->write_data("pass"); if(this->data->get_admin(user)){ this->write_data("admin"); + this->admin=true; }else{ this->write_data("norma"); + this->admin=false; } this->user=user; return true; @@ -50,11 +52,11 @@ void session_manager::start_dialog(){ this->send_information(); }else if(strcmp(buffer, "remv")==0){ this->remove(); - }else if(strcmp(buffer,"uinf")==0){ + }else if((strcmp(buffer,"uinf")==0)&&this->admin){ this->send_user_info(); - }else if(strcmp(buffer,"cusr")==0){ + }else if((strcmp(buffer,"cusr")==0)&&this->admin){ this->create_user(); - }else if(strcmp(buffer,"rusr")==0){ + }else if((strcmp(buffer,"rusr")==0)&&this->admin){ this->remove_user(); }else if((strcmp(buffer,"exit")==0)||(n_read==0)){ break; diff --git a/session_manager.h b/session_manager.h index 9559e96..93aef53 100644 --- a/session_manager.h +++ b/session_manager.h @@ -22,6 +22,7 @@ public: data_acces* data; char** args; std::string user; + bool admin; }; #endif // LAUNCHER_H