ServidorTFG/data_acces.h
2020-06-01 23:23:23 +02:00

83 lines
2.3 KiB
C++

#ifndef DATA_ACCES_H
#define DATA_ACCES_H
#include <iostream>
#include <list>
class data_acces
{
public:
/**
* @brief data_acces
* Interface to program objects that manage the stored data
*/
data_acces();
/**
* @brief get_passwd
* Get the hash of the password that use the user
* @param username User whose password you want to know
* @return The hash of the password
*/
virtual std::string get_passwd(std::string username) = 0;
/**
* @brief get_admin
* Get if the user is a admin or not
* @return true if is an admin, false if not
*/
virtual bool get_admin(std::string)=0;
/**
* @brief get_pinfo
* Get a list of the generated packages and the information about that
* @return A list of the generated packages and the information about that
*/
virtual std::list<std::string> get_pinfo()=0;
/**
* @brief get_uinfo
* Get a list of the users and if they are admins or not
* @return A list of the users and if they are admins or not
*/
virtual std::list<std::string> get_uinfo()=0;
/**
* @brief write_install
* Store information about package generation
* @param package Name of the package generated
* @param user User that generated te package
*/
virtual void write_install(std::string package, std::string user)=0;
/**
* @brief write_remove
* Remove the information about generated package
* @param package Name of the package generated
*/
virtual void write_remove(std::string package)=0;
/**
* @brief get_package_exists
* Search if the package exists
* @param package Name of the package to search
* @return True if the package exists, false if not
*/
virtual bool get_package_exists(std::string package)=0;
/**
* @brief create_user
* Create a new user with the passed data
* @param user Name of the passed user
* @param pass Password of the new user
* @param admin Admin status of a new user
*/
virtual void create_user(std::string user, std::string pass, bool admin)=0;
/**
* @brief remove_user
* Remove a user
* @param user Name of the user to delete
*/
virtual void remove_user(std::string user)=0;
/**
* @brief get_hash
* Generate a hash with the pased data
* @param data Data to hash
* @return Data hased
*/
static char* get_hash(char *data);
};
#endif // DATA_ACCES_H