Torc  0.1
torcuser.h
Go to the documentation of this file.
1 #ifndef TORCUSER_H
2 #define TORCUSER_H
3 
4 // Qt
5 #include <QObject>
6 
7 // Torc
8 #include "torcsetting.h"
9 #include "torchttpservice.h"
10 
11 class TorcUser : public QObject, public TorcHTTPService
12 {
13  Q_OBJECT
14  Q_CLASSINFO("Version", "1.0.0")
15  Q_CLASSINFO("RestartTorc", "methods=PUT")
16  Q_CLASSINFO("StopTorc", "methods=PUT")
17  Q_PROPERTY(bool canRestartTorc MEMBER m_canRestartTorc READ GetCanRestartTorc CONSTANT)
18  Q_PROPERTY(bool canStopTorc MEMBER m_canStopTorc READ GetCanStopTorc CONSTANT)
19  Q_PROPERTY(QString userName MEMBER m_userName READ GetUserName CONSTANT)
20 
21  friend class TorcHTTPServer;
22 
23  public:
24  TorcUser();
25  ~TorcUser();
26 
27  static QByteArray GetCredentials (void);
28  static QString GetName (void);
29 
30  protected slots:
31  void UpdateUserName (QString &Name);
32  void UpdateCredentials (QString &Credentials);
33 
34  public slots:
35  // TorcHTTPService
36  void SubscriberDeleted (QObject *Subscriber);
37 
38  QString GetUserName (void);
39  bool SetUserCredentials (const QString &Name, const QString &Credentials);
40  bool GetCanRestartTorc (void);
41  void RestartTorc (void);
42  void StopTorc (void);
43  bool GetCanStopTorc (void);
44 
45  public:
46  static QString gUserName;
47  static QByteArray gUserCredentials;
48  static QMutex gUserCredentialsLock;
49 
50  private:
51  Q_DISABLE_COPY(TorcUser)
52 
53  QString m_userName;
54  TorcSetting *m_userNameSetting;
55  TorcSetting *m_userCredentials;
56  bool m_canRestartTorc;
57  bool m_canStopTorc;
58 };
59 
60 #endif // TORCUSER_H
void StopTorc(void)
Definition: torcuser.cpp:141
A wrapper around a database setting.
Definition: torcsetting.h:15
bool GetCanRestartTorc(void)
Definition: torcuser.cpp:158
void RestartTorc(void)
Definition: torcuser.cpp:152
QString GetUserName(void)
Definition: torcuser.cpp:75
static QMutex gUserCredentialsLock
Definition: torcuser.h:48
QString userName
Definition: torcuser.h:19
static QByteArray GetCredentials(void)
Definition: torcuser.cpp:81
bool GetCanStopTorc(void)
Definition: torcuser.cpp:146
QString Name(void) const
bool SetUserCredentials(const QString &Name, const QString &Credentials)
Definition: torcuser.cpp:100
static QString GetName(void)
Definition: torcuser.cpp:69
static QString gUserName
Definition: torcuser.h:46
static QByteArray gUserCredentials
Definition: torcuser.h:47
bool canStopTorc
Definition: torcuser.h:18
void UpdateUserName(QString &Name)
Definition: torcuser.cpp:87
void UpdateCredentials(QString &Credentials)
Definition: torcuser.cpp:94
void SubscriberDeleted(QObject *Subscriber)
Definition: torcuser.cpp:136
An HTTP server.
bool canRestartTorc
Definition: torcuser.h:17