ad suport env variable
This commit is contained in:
parent
3eb5197ba5
commit
44bfd7e606
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 4.8.2, 2020-06-01T14:25:31. -->
|
||||
<!-- Written by QtCreator 4.8.2, 2020-06-02T15:21:19. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
|
@ -46,3 +46,6 @@ ssize_t conexion::write_string(std::string entrada){
|
||||
return write(this->fd,entrada.data(),entrada.size());
|
||||
}
|
||||
|
||||
config_reader* conexion::get_conf(){
|
||||
return this->config;
|
||||
}
|
||||
|
@ -26,6 +26,12 @@ public:
|
||||
* @return bytes sended
|
||||
*/
|
||||
virtual ssize_t write_string(std::string output);
|
||||
/**
|
||||
* @brief get_conf
|
||||
* Get the config object
|
||||
* @return Config object
|
||||
*/
|
||||
config_reader* get_conf();
|
||||
protected:
|
||||
config_reader *config;
|
||||
int fd;
|
||||
|
@ -6,6 +6,8 @@ session_manager::session_manager(conexion* con)
|
||||
this->con=con;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool session_manager::loggin(std::string username, std::string passwd){
|
||||
this->con->write_string(username);
|
||||
this->con->write_string(passwd);
|
||||
@ -17,6 +19,12 @@ bool session_manager::loggin(std::string username, std::string passwd){
|
||||
bool session_manager::admin(){
|
||||
std::string result;
|
||||
this->con->read_string(result,5);
|
||||
std::string env;
|
||||
if(this->con->get_conf()->get_param("env", env)){
|
||||
this->con->write_string(env);
|
||||
}else{
|
||||
this->con->write_string("no");
|
||||
}
|
||||
return result=="admin";
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user