80 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			80 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| #ifndef SESSION_MANAGER_H
 | |
| #define SESSION_MANAGER_H
 | |
| 
 | |
| #include "conexion.h"
 | |
| 
 | |
| #include <string>
 | |
| #include <list>
 | |
| 
 | |
| class session_manager
 | |
| {
 | |
| public:
 | |
|   /**
 | |
|    * @brief session_manager
 | |
|    * Object that manage the session, and gide on it
 | |
|    * @param con Conexion of the session
 | |
|    */
 | |
|   session_manager(conexion* con);
 | |
|   /**
 | |
|    * @brief loggin
 | |
|    * Loggin function
 | |
|    * @param username Username to try to start session
 | |
|    * @param passwd Password to the user
 | |
|    * @return True if the username have these password, false if not or the user not exists
 | |
|    */
 | |
|   bool loggin(std::string username, std::string passwd);
 | |
|   /**
 | |
|    * @brief admin
 | |
|    * Get user privileges
 | |
|    * @return true if the admin can manage other users, false if not
 | |
|    */
 | |
|   bool admin();
 | |
|   /**
 | |
|    * @brief install_command
 | |
|    * Send name of the package to build
 | |
|    * @param package Name of the package
 | |
|    * @return positive if it is build well, or negative if not
 | |
|    */
 | |
|   int install_command(std::string package);
 | |
|   /**
 | |
|    * @brief remove_command
 | |
|    * Send name of the package to remove
 | |
|    * @param package Name of the package
 | |
|    * @return  positive if it is removed well, or negative if not
 | |
|    */
 | |
|   int remove_command(std::string package);
 | |
|   /**
 | |
|    * @brief get_packages_info
 | |
|    * Get all packages information
 | |
|    * @return List of strings that contains all package information.
 | |
|    * Every package have the information separated with the sepacial character ":"
 | |
|    */
 | |
|   std::list<std::string> get_packages_info();
 | |
|   /**
 | |
|    * @brief get_users_info
 | |
|    * Get all users username and privileges
 | |
|    * @return List of strings that contains all users information.
 | |
|    * Every users have the username first, and after separated with a ":"
 | |
|    * a t or a f, t if they have privileges or f if not
 | |
|    */
 | |
|   std::list<std::string> get_users_info();
 | |
|   /**
 | |
|    * @brief create_user
 | |
|    * Create a new user
 | |
|    * @param username Username for a new user
 | |
|    * @param password Password for a new user
 | |
|    * @param admin Privileges of a new user
 | |
|    */
 | |
|   void create_user(std::string username, std::string password, bool admin);
 | |
|   /**
 | |
|    * @brief remove_user
 | |
|    * Remove a created user
 | |
|    * @param username Name of these
 | |
|    */
 | |
|   void remove_user(std::string username);
 | |
| private:
 | |
|   conexion* con;
 | |
| };
 | |
| 
 | |
| #endif // SESSION_MANAGER_H
 |