32 Security(
const std::string& key_name,
const std::string& description);
54 bool operator()()
const;
59 operator bool()
const;
71 std::string getKeyName()
const;
76 std::string getDescription()
const;
81 static std::string getUsername();
91 static std::string getPassword();
110 static bool isLoggedIn();
115 void setData(uint64_t data);
120 uint64_t getData()
const;
146 typedef bool (*ServerCallBack)(
ERequestCall request, std::string s1, std::string s2);
159 static bool login(std::string username, std::string password);
194 void set(
const std::string& key_name,
const std::string& description);
219 static int _checkCountMaster;
227 static ServerCallBack _serverFunc;
235 static std::string _username;
239 static std::string _password;
243 static bool _loggedInFlag;
247 static bool _allAccessFlag;
255inline Security::operator bool()
const
257 return isAccessible();
293 return _loggedInFlag;
Interface for regulating user access to parts of the code. This class is commonly declared as static....
Definition Security.h:25
bool isAccessible() const
Checks if access is allowed.
static std::string getPassword()
Gets the password of the current user.
Definition Security.h:285
static void logout()
Logs the current user out.
static bool isLoggedIn()
Checks if a user is logged in.
Definition Security.h:290
static bool setPassword(const std::string &password)
Sets the password on the current user.
void set(const std::string &key_name, const std::string &description)
Initializer method.
ERequestCall
List of request call to make.
Definition Security.h:126
@ rcAccess
Definition Security.h:132
@ rcLogin
Definition Security.h:130
@ rcGrant
Definition Security.h:134
@ rcDialog
Definition Security.h:140
@ rcPassword
Definition Security.h:138
@ rcLogout
Definition Security.h:128
@ rcRevoke
Definition Security.h:136
bool operator()() const
Constant boolean operator returning true when access is given.
Definition Security.h:250
static unsigned getCount()
Gets the current total of items in the list of locks.
static bool isAvailable()
Checks if a security server is available.
static void setUsername(const std::string &name)
Sets the username of the current logged on user.
Security(const std::string &key_name, const std::string &description)
Constructor passing the lock key name and its description.
static bool setPassword()
Same as above but the server shows a dialog to allow entering the password.
static std::string getUsername()
Gets the username of the current logged on user.
Definition Security.h:280
bool setAccess(bool grant)
Grants the current user access to this entry.
void setData(uint64_t data)
To link secondary data.
Definition Security.h:260
bool isDatabaseAccessible() const
Checks at the server if it is accessible for a certain name. Only used for management not to be used ...
std::string _description
Holds the description of this security entry.
Definition Security.h:204
std::string getDescription() const
Gets the at the constructor given description.
Definition Security.h:275
uint64_t getData() const
Gets the linked secondary data.
Definition Security.h:265
std::string _keyName
Holds the key for this security entry.
Definition Security.h:199
static bool login(std::string username, std::string password)
Logs a user in.
static void setAccessToAll(bool grant)
Grants all access temporarily to be able to set and test no access behavior.
std::string getKeyName() const
Gets the at the constructor given key name.
Definition Security.h:270
static void setServerCallBack(ServerCallBack func)
Sets the call back function for a security server.
uint64_t _data
Holds the data linked to this instance.
Definition Security.h:209
static Security * getEntry(unsigned index)
Gets the entry at the given index from the list of entries.
Counted vector having additional methods and operators for ease of usage. This template class extends...
Definition TVector.h:20
#define _MISC_CLASS
Definition misc/global.h:40
Definition Application.h:10