| 11 | using namespace hyperhdr; |
| 12 | |
| 13 | AccessManager::AccessManager(QObject* parent) |
| 14 | : QObject(parent) |
| 15 | , _authTable(new AuthTable()) |
| 16 | , _metaTable(new MetaTable()) |
| 17 | , _pendingRequests() |
| 18 | , _authRequired(true) |
| 19 | , _timer(new QTimer(this)) |
| 20 | , _authBlockTimer(new QTimer(this)) |
| 21 | { |
| 22 | // get uuid |
| 23 | _uuid = _metaTable->getUUID(); |
| 24 | |
| 25 | // Register meta |
| 26 | qRegisterMetaType<QVector<AccessManager::AuthDefinition>>("QVector<AccessManager::AuthDefinition>"); |
| 27 | |
| 28 | // setup timer |
| 29 | _timer->setInterval(1000); |
| 30 | connect(_timer, &QTimer::timeout, this, &AccessManager::checkTimeout); |
| 31 | |
| 32 | // setup authBlockTimer |
| 33 | _authBlockTimer->setInterval(60000); |
| 34 | connect(_authBlockTimer, &QTimer::timeout, this, &AccessManager::checkAuthBlockTimeout); |
| 35 | |
| 36 | // init with default user and password |
| 37 | if (!_authTable->userExist(DEFAULT_CONFIG_USER)) |
| 38 | { |
| 39 | _authTable->createUser(DEFAULT_CONFIG_USER, DEFAULT_CONFIG_PASSWORD); |
| 40 | } |
| 41 | |
| 42 | // update HyperHDR user token on startup |
| 43 | _authTable->setUserToken(DEFAULT_CONFIG_USER); |
| 44 | } |
| 45 | |
| 46 | AccessManager::~AccessManager() |
| 47 | { |
nothing calls this directly
no test coverage detected