| 1 | /* |
| 2 | * This file is part of OnlineAccountsDaemon |
| 3 | * |
| 4 | * Copyright (C) 2015 Canonical Ltd. |
| 5 | * |
| 6 | * Contact: Alberto Mardegan <[email protected]> |
| 7 | * |
| 8 | * This program is free software: you can redistribute it and/or modify it |
| 9 | * under the terms of the GNU Lesser General Public License version 3, as |
| 10 | * published by the Free Software Foundation. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranties of |
| 14 | * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
| 15 | * PURPOSE. See the GNU Lesser General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU Lesser General Public License |
| 18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | */ |
| 20 | |
| 21 | #include "access_request.h"cxx . . $ `<file>/online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/access_request.h`/ |
| 22 | |
| 23 | #include <Accounts/AuthData> |
| 24 | #include <LomiriOnlineAccountsClient/Setup>cxx . . $ `<file>/online-accounts-client/lib/LomiriOnlineAccountsClient/Setup`/ |
| 25 | #include <QDBusArgument> |
| 26 | #include <QDebug> |
| 27 | #include "account_info.h"cxx . . $ `<file>/online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/account_info.h`/ |
| 28 | #include "authenticator.h"cxx . . $ `<file>/online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/authenticator.h`/ |
| 29 | |
| 30 | using namespace OnlineAccountsDaemon; |
| 31 | |
| 32 | namespace OnlineAccountsDaemoncxx . . $ OnlineAccountsDaemon/ { |
| 33 | |
| 34 | class AccessRequestPrivatecxx . . $ OnlineAccountsDaemon/AccessRequestPrivate#: public QObjectcxx . . $ QObject# |
| 35 | { |
| 36 | Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`! |
| 37 | Q_DECLARE_PUBLICcxx . . $ `<external>/15045578679651060896/qglobal.h:1172:9`!(AccessRequest) |
| 38 | |
| 39 | public: |
| 40 | AccessRequestPrivatecxx . . $ OnlineAccountsDaemon/AccessRequestPrivate#AccessRequestPrivate(c6812502dbd95264).(AccessRequestcxx . . $ OnlineAccountsDaemon/AccessRequest# *q); |
| 41 | |
| 42 | void requestAccesscxx . . $ OnlineAccountsDaemon/AccessRequestPrivate#requestAccess(975eff540a211c77).(const QStringcxx . . $ QString# &applicationId, |
| 43 | const QStringcxx . . $ QString# &serviceId, |
| 44 | const QVariantMapcxx . . $ QVariantMap# ¶meters, |
| 45 | pid_t clientPid); |
| 46 | |
| 47 | private Q_SLOTScxx . . $ `<external>/1208926524888476972/qobjectdefs.h:92:10`!: |
| 48 | void onSetupFinishedcxx . . $ OnlineAccountsDaemon/AccessRequestPrivate#onSetupFinished(74e937dbdebc0ff5).(QVariantMapcxx . . $ QVariantMap# reply); |
| 49 | void onAuthenticationFinishedcxx . . $ OnlineAccountsDaemon/AccessRequestPrivate#onAuthenticationFinished(49f6e7a06ebc5aa8).(); |
| 50 | |
| 51 | private: |
| 52 | OnlineAccountsClientcxx . . $ OnlineAccountsClient/::Setupcxx . . $ OnlineAccountsClient/Setup# m_setupcxx . . $ OnlineAccountsDaemon/AccessRequestPrivate#m_setup.; |
| 53 | Authenticatorcxx . . $ OnlineAccountsDaemon/Authenticator# m_authenticatorcxx . . $ OnlineAccountsDaemon/AccessRequestPrivate#m_authenticator.; |
| 54 | QVariantMapcxx . . $ QVariantMap# m_parameterscxx . . $ OnlineAccountsDaemon/AccessRequestPrivate#m_parameters.; |
| 55 | AccountInfocxx . . $ OnlineAccountsDaemon/AccountInfo# m_accountInfocxx . . $ OnlineAccountsDaemon/AccessRequestPrivate#m_accountInfo.; |
| 56 | AccessRequestcxx . . $ OnlineAccountsDaemon/AccessRequest# *q_ptrcxx . . $ OnlineAccountsDaemon/AccessRequestPrivate#q_ptr.; |
| 57 | }; |
| 58 | |
| 59 | } // namespace |
| 60 | |
| 61 | AccessRequestPrivatecxx . . $ OnlineAccountsDaemon/AccessRequestPrivate#::AccessRequestPrivatecxx . . $ OnlineAccountsDaemon/AccessRequestPrivate#AccessRequestPrivate(c6812502dbd95264).(AccessRequestcxx . . $ OnlineAccountsDaemon/AccessRequest# *q): |
| 62 | QObjectcxx . . $ QObject#QObject(749de1b6ae65bddd).(q), |
| 63 | q_ptrcxx . . $ OnlineAccountsDaemon/AccessRequestPrivate#q_ptr.(q) |
| 64 | { |
| 65 | QObjectcxx . . $ QObject#::connectcxx . . $ QObject#connect(158df1d9a01a3410).(&m_setupcxx . . $ OnlineAccountsDaemon/AccessRequestPrivate#m_setup., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(finished(QVariantMap)), |
| 66 | this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(onSetupFinished(QVariantMap))); |
| 67 | QObjectcxx . . $ QObject#::connectcxx . . $ QObject#connect(158df1d9a01a3410).(&m_authenticatorcxx . . $ OnlineAccountsDaemon/AccessRequestPrivate#m_authenticator., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(finished()), |
| 68 | this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(onAuthenticationFinished())); |
| 69 | } |
| 70 | |
| 71 | void AccessRequestPrivatecxx . . $ OnlineAccountsDaemon/AccessRequestPrivate#::requestAccesscxx . . $ OnlineAccountsDaemon/AccessRequestPrivate#requestAccess(975eff540a211c77).(const QStringcxx . . $ QString# &applicationId, |
| 72 | const QStringcxx . . $ QString# &serviceId, |
| 73 | const QVariantMapcxx . . $ QVariantMap# ¶meters, |
| 74 | pid_t clientPid) |
| 75 | { |
| 76 | m_parameterscxx . . $ OnlineAccountsDaemon/AccessRequestPrivate#m_parameters. =cxx . . $ QMap#`operator=`(9a30e17cbbb0999d). parameters; |
| 77 | |
| 78 | m_setupcxx . . $ OnlineAccountsDaemon/AccessRequestPrivate#m_setup..setApplicationIdcxx . . $ OnlineAccountsClient/Setup#setApplicationId(3520e46b33348bf6).(applicationId); |
| 79 | m_setupcxx . . $ OnlineAccountsDaemon/AccessRequestPrivate#m_setup..setServiceIdcxx . . $ OnlineAccountsClient/Setup#setServiceId(3520e46b33348bf6).(serviceId); |
| 80 | m_setupcxx . . $ OnlineAccountsDaemon/AccessRequestPrivate#m_setup..setClientPidcxx . . $ OnlineAccountsClient/Setup#setClientPid(d4f767463ce0a6b3).(clientPid); |
| 81 | m_setupcxx . . $ OnlineAccountsDaemon/AccessRequestPrivate#m_setup..execcxx . . $ OnlineAccountsClient/Setup#exec(49f6e7a06ebc5aa8).(); |
| 82 | } |
| 83 | |
| 84 | void AccessRequestPrivatecxx . . $ OnlineAccountsDaemon/AccessRequestPrivate#::onSetupFinishedcxx . . $ OnlineAccountsDaemon/AccessRequestPrivate#onSetupFinished(74e937dbdebc0ff5).(QVariantMapcxx . . $ QVariantMap# reply) |
| 85 | { |
| 86 | Q_Qcxx . . $ `<external>/15045578679651060896/qglobal.h:1178:9`!(AccessRequest); |
| 87 | uintcxx . . $ uint# accountId = reply[cxx . . $ QMap#`operator[]`(bbd415b616967878).QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("accountId")].toUIntcxx . . $ QVariant#toUInt(870b63f89c7fb98).(); |
| 88 | if (accountId == 0) { |
| 89 | q->setErrorcxx . . $ OnlineAccountsDaemon/AsyncOperation#setError(c1427772cd1877b0).(ONLINE_ACCOUNTS_ERROR_PERMISSION_DENIEDcxx . . $ `online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/dbus_constants.h:54:9`!, |
| 90 | "Authorization was not granted"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 91 | } else { |
| 92 | Q_EMITcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:95:10`! q->loadRequestcxx . . $ OnlineAccountsDaemon/AccessRequest#loadRequest(5d434d7a62a8e37).(accountId, m_setupcxx . . $ OnlineAccountsDaemon/AccessRequestPrivate#m_setup..serviceIdcxx . . $ OnlineAccountsClient/Setup#serviceId(6ef7b6c27b00b43d).()); |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | void AccessRequestPrivatecxx . . $ OnlineAccountsDaemon/AccessRequestPrivate#::onAuthenticationFinishedcxx . . $ OnlineAccountsDaemon/AccessRequestPrivate#onAuthenticationFinished(49f6e7a06ebc5aa8).() |
| 97 | { |
| 98 | Q_Qcxx . . $ `<external>/15045578679651060896/qglobal.h:1178:9`!(AccessRequest); |
| 99 | |
| 100 | /* We don't check for authentication errors here. Even if an error |
| 101 | * occurred, we still have to return the account info to the client. |
| 102 | * So, if an error occurred, we'll just return empty authentication data to |
| 103 | * the client. |
| 104 | */ |
| 105 | QListcxx . . $ QList#<QVariantcxx . . $ QVariant#> argscxx . . $ QList#QList(ced63f7c635d850d).; |
| 106 | QDBusArgumentcxx . . $ QDBusArgument# infoArgcxx . . $ QDBusArgument#QDBusArgument(49f6e7a06ebc5aa8).; |
| 107 | infoArg <<cxx . . $ `operator<<`(4fadde01c4030318). m_accountInfocxx . . $ OnlineAccountsDaemon/AccessRequestPrivate#m_accountInfo.; |
| 108 | args <<cxx . . $ QList#`operator<<`(309d1580d8f5dc58). QVariantcxx . . $ QVariant#::fromValuecxx . . $ QVariant#fromValue(28ec88ac519b76da).(infoArg); |
| 109 | args <<cxx . . $ QList#`operator<<`(309d1580d8f5dc58). m_authenticatorcxx . . $ QVariant#QVariant(3e95df3e31f2cce8)..replycxx . . $ OnlineAccountsDaemon/Authenticator#reply(87f780dbe64191c4).(); |
| 110 | q->setReplycxx . . $ OnlineAccountsDaemon/AsyncOperation#setReply(2f4009bfc0c7e161).(args); |
| 111 | } |
| 112 | |
| 113 | AccessRequestcxx . . $ OnlineAccountsDaemon/AccessRequest#::AccessRequestcxx . . $ OnlineAccountsDaemon/AccessRequest#AccessRequest(fd99699e6e8f0995).(const CallContextcxx . . $ OnlineAccountsDaemon/CallContext# &context, QObjectcxx . . $ QObject# *parent): |
| 114 | AsyncOperationcxx . . $ OnlineAccountsDaemon/AsyncOperation#(context, parent), |
| 115 | d_ptrcxx . . $ OnlineAccountsDaemon/AccessRequest#d_ptr.(new AccessRequestPrivatecxx . . $ OnlineAccountsDaemon/AccessRequestPrivate#AccessRequestPrivate(c6812502dbd95264).(this)) |
| 116 | { |
| 117 | } |
| 118 | |
| 119 | AccessRequestcxx . . $ OnlineAccountsDaemon/AccessRequest#::~cxx . . $ OnlineAccountsDaemon/AccessRequest#`~AccessRequest`(ced63f7c635d850d).AccessRequestcxx . . $ OnlineAccountsDaemon/AccessRequest#() |
| 120 | { |
| 121 | delete d_ptrcxx . . $ OnlineAccountsDaemon/AccessRequest#d_ptr.; |
| 122 | } |
| 123 | |
| 124 | void AccessRequestcxx . . $ OnlineAccountsDaemon/AccessRequest#::requestAccesscxx . . $ OnlineAccountsDaemon/AccessRequest#requestAccess(975eff540a211c77).(const QStringcxx . . $ QString# &applicationId, |
| 125 | const QStringcxx . . $ QString# &serviceId, |
| 126 | const QVariantMapcxx . . $ QVariantMap# ¶meters, |
| 127 | pid_t clientPid) |
| 128 | { |
| 129 | Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(AccessRequest); |
| 130 | d->requestAccesscxx . . $ OnlineAccountsDaemon/AccessRequestPrivate#requestAccess(975eff540a211c77).(applicationId, serviceId, parameters, clientPid); |
| 131 | } |
| 132 | |
| 133 | void AccessRequestcxx . . $ OnlineAccountsDaemon/AccessRequest#::setAccountInfocxx . . $ OnlineAccountsDaemon/AccessRequest#setAccountInfo(8ad97fe17c736290).(const AccountInfocxx . . $ OnlineAccountsDaemon/AccountInfo# &accountInfo, |
| 134 | const Accountscxx . . $ Accounts/::AuthDatacxx . . $ Accounts/AuthData# &authData) |
| 135 | { |
| 136 | Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(AccessRequest); |
| 137 | d->m_accountInfocxx . . $ OnlineAccountsDaemon/AccessRequestPrivate#m_accountInfo. =cxx . . $ OnlineAccountsDaemon/AccountInfo#`operator=`(6af5833895cab367). accountInfo; |
| 138 | d->m_authenticatorcxx . . $ OnlineAccountsDaemon/AccessRequestPrivate#m_authenticator..authenticatecxx . . $ OnlineAccountsDaemon/Authenticator#authenticate(65dd63f57efcf987).(authData, d->m_parameterscxx . . $ OnlineAccountsDaemon/AccessRequestPrivate#m_parameters.); |
| 139 | } |
| 140 | |
| 141 | #include "access_request.moc"cxx . . $ `<file>/build/online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/lomiri-online-accounts-daemon_autogen/include/access_request.moc`/ |