mirror of
https://github.com/arcan1s/queued.git
synced 2025-07-04 09:25:50 +00:00
do not allow get user and task properties w\o auth
This commit is contained in:
@ -39,6 +39,7 @@ void QueuedEmailNotify::init(const QVariantHash &_settings)
|
||||
void QueuedEmailNotify::setToken(const QString &_token)
|
||||
{
|
||||
m_token = _token;
|
||||
m_helper->setToken(_token);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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 "";
|
||||
|
@ -29,6 +29,7 @@ class QueuedEmailNotifyHelper : public QObject
|
||||
Q_PROPERTY(int port READ port WRITE setPort)
|
||||
Q_PROPERTY(QString server READ server WRITE setServer)
|
||||
Q_PROPERTY(bool ssl READ isSslEnabled WRITE setSslEnabled)
|
||||
Q_PROPERTY(QString token READ token WRITE setToken)
|
||||
Q_PROPERTY(QString username READ username WRITE setUsername)
|
||||
|
||||
public:
|
||||
@ -50,6 +51,7 @@ public:
|
||||
QString password() const;
|
||||
int port() const;
|
||||
QString server() const;
|
||||
QString token() const;
|
||||
QString username() const;
|
||||
void setFrom(const QString &_from);
|
||||
void setInsecureCurl(const bool _insecureCurl);
|
||||
@ -57,6 +59,7 @@ public:
|
||||
void setPort(const int &_port);
|
||||
void setServer(const QString &_server);
|
||||
void setSslEnabled(const bool _sslEnabled);
|
||||
void setToken(const QString &_token);
|
||||
void setUsername(const QString &_username);
|
||||
|
||||
public slots:
|
||||
@ -71,6 +74,7 @@ private:
|
||||
int m_port = 0;
|
||||
QString m_server;
|
||||
bool m_ssl = false;
|
||||
QString m_token;
|
||||
QString m_username;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user