Wittyshare  0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
WsUserSession.h
Go to the documentation of this file.
1 /*
2  *
3  * Filename: WsUserSession.h
4  *
5  * Description:
6  *
7  * Created: 03/21/2013 01:47:11 AM
8  * Revision: none
9  *
10  * Author: Benoit Daccache (BD), ben.daccache@gmail.com
11  * Company:
12  *
13  */
14 
15 #ifndef WS_USER_SESSION_H__
16 #define WS_USER_SESSION__H__
17 
18 #include <iostream>
19 #include <set>
20 
21 
28 
29 public:
36  WsUserSession(const std::string& uid, const std::string& pass = "", const std::string& ip = "");
37 
42  const std::set<std::string>& getGroups();
43 
47  const std::string& getName();
48 
52  const std::string& getSurname();
53 
57  const std::string& getEmail();
58 
63  void setGroups(const std::set<std::string>& groups);
64 
69  void setName(const std::string& name);
70 
75  void setSurname(const std::string& surname);
76 
81  void setEmail(const std::string& email);
82 
90  bool isValidSession(const std::string& uid, const std::string& pass, const std::string& ip);
91 
92 protected:
93  std::string m_uid;
94  std::string m_pass;
95  std::string m_ip;
96  std::string m_name;
97  std::string m_surname;
98  std::string m_email;
99  std::set<std::string> m_groups;
101 
102 private:
106  long getNowTimestamp();
107 
108 
109 
110 
111 
112 
113 
114 
115 
116 };
117 
118 
119 #endif
Reprensents a User session.
Definition: WsUserSession.h:27
void setSurname(const std::string &surname)
set the surname of the user
std::string m_name
Definition: WsUserSession.h:96
void setName(const std::string &name)
set the name of the user
const std::string & getName()
void setGroups(const std::set< std::string > &groups)
sets the groups of a user
std::set< std::string > m_groups
Definition: WsUserSession.h:99
WsUserSession(const std::string &uid, const std::string &pass="", const std::string &ip="")
Constructor.
const std::string & getEmail()
std::string m_surname
Definition: WsUserSession.h:97
void setEmail(const std::string &email)
set the email of the user
std::string m_uid
Definition: WsUserSession.h:93
std::string m_ip
Definition: WsUserSession.h:95
std::string m_email
Definition: WsUserSession.h:98
const std::set< std::string > & getGroups()
get the groups belonging to the user
const std::string & getSurname()
long getNowTimestamp()
returns the time.now()
std::string m_pass
Definition: WsUserSession.h:94
bool isValidSession(const std::string &uid, const std::string &pass, const std::string &ip)
returns true or false whether the session is valid