2020-05-08 12:43:46 +02:00
|
|
|
#ifndef DATA_ACCES_H
|
|
|
|
#define DATA_ACCES_H
|
|
|
|
|
|
|
|
#include <iostream>
|
2020-05-13 00:58:32 +02:00
|
|
|
#include <list>
|
2020-05-08 12:43:46 +02:00
|
|
|
|
|
|
|
class data_acces
|
|
|
|
{
|
|
|
|
public:
|
2020-06-01 23:23:23 +02:00
|
|
|
/**
|
|
|
|
* @brief data_acces
|
|
|
|
* Interface to program objects that manage the stored data
|
|
|
|
*/
|
2020-05-08 12:43:46 +02:00
|
|
|
data_acces();
|
2020-06-01 23:23:23 +02:00
|
|
|
/**
|
|
|
|
* @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
|
|
|
|
*/
|
2020-05-08 12:43:46 +02:00
|
|
|
virtual std::string get_passwd(std::string username) = 0;
|
2020-06-01 23:23:23 +02:00
|
|
|
/**
|
|
|
|
* @brief get_admin
|
|
|
|
* Get if the user is a admin or not
|
|
|
|
* @return true if is an admin, false if not
|
|
|
|
*/
|
2020-05-26 18:48:31 +02:00
|
|
|
virtual bool get_admin(std::string)=0;
|
2020-06-01 23:23:23 +02:00
|
|
|
/**
|
|
|
|
* @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
|
|
|
|
*/
|
2020-05-13 00:58:32 +02:00
|
|
|
virtual std::list<std::string> get_pinfo()=0;
|
2020-06-01 23:23:23 +02:00
|
|
|
/**
|
|
|
|
* @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
|
|
|
|
*/
|
2020-05-20 00:10:05 +02:00
|
|
|
virtual std::list<std::string> get_uinfo()=0;
|
2020-06-01 23:23:23 +02:00
|
|
|
/**
|
|
|
|
* @brief write_install
|
|
|
|
* Store information about package generation
|
|
|
|
* @param package Name of the package generated
|
|
|
|
* @param user User that generated te package
|
|
|
|
*/
|
2020-05-15 21:39:23 +02:00
|
|
|
virtual void write_install(std::string package, std::string user)=0;
|
2020-06-01 23:23:23 +02:00
|
|
|
/**
|
|
|
|
* @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
|
|
|
|
*/
|
2020-05-16 20:52:50 +02:00
|
|
|
virtual bool get_package_exists(std::string package)=0;
|
2020-06-01 23:23:23 +02:00
|
|
|
/**
|
|
|
|
* @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
|
|
|
|
*/
|
2020-05-21 20:57:18 +02:00
|
|
|
virtual void create_user(std::string user, std::string pass, bool admin)=0;
|
2020-06-01 23:23:23 +02:00
|
|
|
/**
|
|
|
|
* @brief remove_user
|
|
|
|
* Remove a user
|
|
|
|
* @param user Name of the user to delete
|
|
|
|
*/
|
2020-05-26 01:37:34 +02:00
|
|
|
virtual void remove_user(std::string user)=0;
|
2020-06-01 23:23:23 +02:00
|
|
|
/**
|
|
|
|
* @brief get_hash
|
|
|
|
* Generate a hash with the pased data
|
|
|
|
* @param data Data to hash
|
|
|
|
* @return Data hased
|
|
|
|
*/
|
2020-05-31 19:24:35 +02:00
|
|
|
static char* get_hash(char *data);
|
2020-05-08 12:43:46 +02:00
|
|
|
};
|
|
|
|
#endif // DATA_ACCES_H
|