do not allow get user and task properties w\o auth

This commit is contained in:
2017-11-26 15:30:59 +03:00
parent bb0a3c43be
commit 9dd63fc77e
26 changed files with 241 additions and 107 deletions

View File

@ -102,6 +102,12 @@ QString QueuedEmailNotifyHelper::server() const
}
QString QueuedEmailNotifyHelper::token() const
{
return m_token;
}
QString QueuedEmailNotifyHelper::username() const
{
return m_username;
@ -156,6 +162,12 @@ void QueuedEmailNotifyHelper::setSslEnabled(const bool _sslEnabled)
}
void QueuedEmailNotifyHelper::setToken(const QString &_token)
{
m_token = _token;
}
void QueuedEmailNotifyHelper::setUsername(const QString &_username)
{
qCDebug(LOG_PL) << "Set username" << _username;
@ -215,14 +227,14 @@ QString QueuedEmailNotifyHelper::getEmail(const long long _id) const
{
qCDebug(LOG_PL) << "Get email for task ID" << _id;
auto task = QueuedCoreAdaptor::getTask(_id, "user");
auto task = QueuedCoreAdaptor::getTask(_id, "user", token());
if (task.type() != Result::Content::Value) {
qCWarning(LOG_LIB) << "Could not get task information" << _id;
return "";
}
auto userId = task.get().toLongLong();
auto user = QueuedCoreAdaptor::getUser(userId, "email");
auto user = QueuedCoreAdaptor::getUser(userId, "email", token());
if (user.type() != Result::Content::Value) {
qCWarning(LOG_LIB) << "Could not get user information" << userId;
return "";