| 1 | /* |
| 2 | * Copyright (C) 2015 Canonical Ltd. |
| 3 | * |
| 4 | * Contact: Alberto Mardegan <[email protected]> |
| 5 | * |
| 6 | * This file is part of lomiri-online-accounts-ui's click hooks |
| 7 | * |
| 8 | * This program is free software: you can redistribute it and/or modify it |
| 9 | * under the terms of the GNU General Public License version 3, as published |
| 10 | * 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 General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License along |
| 18 | * with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | */ |
| 20 | |
| 21 | #include "acl-updater.h"cxx . . $ `<file>/click-hooks/online-accounts-hooks2/acl-updater.h`/ |
| 22 | |
| 23 | #include <QCoreApplication> |
| 24 | #include <QDebug> |
| 25 | #include <QEventLoop> |
| 26 | #include <QObject> |
| 27 | #include <SignOn/Identity> |
| 28 | #include <SignOn/IdentityInfo> |
| 29 | |
| 30 | class AclUpdaterPrivatecxx . . $ AclUpdaterPrivate#: public QObjectcxx . . $ QObject# |
| 31 | { |
| 32 | Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`! |
| 33 | |
| 34 | public: |
| 35 | AclUpdaterPrivatecxx . . $ AclUpdaterPrivate#AclUpdaterPrivate(49f6e7a06ebc5aa8).(); |
| 36 | |
| 37 | public Q_SLOTScxx . . $ `<external>/1208926524888476972/qobjectdefs.h:92:10`!: |
| 38 | void onInfocxx . . $ AclUpdaterPrivate#onInfo(672256099159c8d5).(const SignOncxx . . $ SignOn/::IdentityInfocxx . . $ SignOn/IdentityInfo# &info); |
| 39 | void onStoredcxx . . $ AclUpdaterPrivate#onStored(cb2f890c2fdad230).(const quint32cxx . . $ quint32# id); |
| 40 | void onErrorcxx . . $ AclUpdaterPrivate#onError(e22be6690a8478ff).(const SignOncxx . . $ SignOn/::Errorcxx . . $ SignOn/Error# &error); |
| 41 | |
| 42 | private: |
| 43 | friend class AclUpdatercxx . . $ AclUpdater#; |
| 44 | QEventLoopcxx . . $ QEventLoop# m_loopcxx . . $ AclUpdaterPrivate#m_loop.; |
| 45 | }; |
| 46 | |
| 47 | AclUpdaterPrivatecxx . . $ AclUpdaterPrivate#::AclUpdaterPrivatecxx . . $ AclUpdaterPrivate#AclUpdaterPrivate(49f6e7a06ebc5aa8).(): |
| 48 | QObjectcxx . . $ QObject#QObject(749de1b6ae65bddd).() |
| 49 | { |
| 50 | } |
| 51 | |
| 52 | void AclUpdaterPrivatecxx . . $ AclUpdaterPrivate#::onInfocxx . . $ AclUpdaterPrivate#onInfo(672256099159c8d5).(const SignOncxx . . $ SignOn/::IdentityInfocxx . . $ SignOn/IdentityInfo# &info) |
| 53 | { |
| 54 | SignOncxx . . $ SignOn/::Identitycxx . . $ SignOn/Identity# *identity = qobject_castcxx . . $ qobject_cast(c988cfc0ca08742e).<SignOncxx . . $ SignOn/::Identitycxx . . $ SignOn/Identity#*>(sendercxx . . $ QObject#sender(2dbb680a34285c44).()); |
| 55 | |
| 56 | QStringcxx . . $ QString# shortAppId = identity->propertycxx . . $ QObject#property(950ff6813be46b58).("appToBeRemoved").toStringcxx . . $ QVariant#toString(6ef7b6c27b00b43d).(); |
| 57 | QStringListcxx . . $ QStringList# aclcxx . . $ QStringList#QStringList(ced63f7c635d850d).; |
| 58 | Q_FOREACHcxx . . $ `<external>/15045578679651060896/qglobal.h:1137:9`!(const QString &token, info.accessControlList()) { |
| 59 | if (!token.startsWithcxx . . $ QString#startsWith(8cce4688c16f48f3).(shortAppId)) { |
| 60 | acl.appendcxx . . $ QList#append(77d9f17553126ecb).(token); |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | if (acl !=cxx . . $ QList#`operator!=`(2a7c7e01cfd9c901). info.accessControlListcxx . . $ SignOn/IdentityInfo#accessControlList(e1dbd5c4feadc8f5).()) { |
| 65 | SignOncxx . . $ SignOn/::IdentityInfocxx . . $ SignOn/IdentityInfo# newInfocxx . . $ SignOn/IdentityInfo#IdentityInfo(672256099159c8d5).(info); |
| 66 | newInfo.setAccessControlListcxx . . $ SignOn/IdentityInfo#setAccessControlList(631c0101495f0328).(acl); |
| 67 | identity->storeCredentialscxx . . $ SignOn/Identity#storeCredentials(672256099159c8d5).(newInfo); |
| 68 | } else { |
| 69 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!() <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). shortAppId <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "was not in ACL of" <<cxx . . $ QDebug#`operator<<`(e121dc42ed06808d). info.idcxx . . $ SignOn/IdentityInfo#id(ddd8539a2fcdd4ce).(); |
| 70 | m_loopcxx . . $ AclUpdaterPrivate#m_loop..exitcxx . . $ QEventLoop#exit(d4f767463ce0a6b3).(0); |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | void AclUpdaterPrivatecxx . . $ AclUpdaterPrivate#::onStoredcxx . . $ AclUpdaterPrivate#onStored(cb2f890c2fdad230).(const quint32cxx . . $ quint32# id) |
| 75 | { |
| 76 | Q_UNUSEDcxx . . $ `<external>/15045578679651060896/qglobal.h:117:9`!(id); |
| 77 | m_loopcxx . . $ AclUpdaterPrivate#m_loop..exitcxx . . $ QEventLoop#exit(d4f767463ce0a6b3).(0); |
| 78 | } |
| 79 | |
| 80 | void AclUpdaterPrivatecxx . . $ AclUpdaterPrivate#::onErrorcxx . . $ AclUpdaterPrivate#onError(e22be6690a8478ff).(const SignOncxx . . $ SignOn/::Errorcxx . . $ SignOn/Error# &err) |
| 81 | { |
| 82 | qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Error occurred updating ACL" <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). err.messagecxx . . $ SignOn/Error#message(6ef7b6c27b00b43d).(); |
| 83 | m_loopcxx . . $ AclUpdaterPrivate#m_loop..exitcxx . . $ QEventLoop#exit(d4f767463ce0a6b3).(1); |
| 84 | } |
| 85 | |
| 86 | AclUpdatercxx . . $ AclUpdater#::AclUpdatercxx . . $ AclUpdater#AclUpdater(49f6e7a06ebc5aa8).(): |
| 87 | d_ptrcxx . . $ AclUpdater#d_ptr.(new AclUpdaterPrivatecxx . . $ AclUpdaterPrivate#AclUpdaterPrivate(49f6e7a06ebc5aa8).) |
| 88 | { |
| 89 | } |
| 90 | |
| 91 | AclUpdatercxx . . $ AclUpdater#::~cxx . . $ AclUpdater#`~AclUpdater`(ced63f7c635d850d).AclUpdatercxx . . $ AclUpdater#() |
| 92 | { |
| 93 | delete d_ptrcxx . . $ AclUpdater#d_ptr.; |
| 94 | } |
| 95 | |
| 96 | bool AclUpdatercxx . . $ AclUpdater#::removeAppcxx . . $ AclUpdater#removeApp(ba319f3035cc12a4).(const QStringcxx . . $ QString# &shortAppId, uintcxx . . $ uint# credentialsId) |
| 97 | { |
| 98 | Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(AclUpdater); |
| 99 | |
| 100 | if (credentialsId == 0 || |
| 101 | !shortAppId.containscxx . . $ QString#contains(7cf081d1b6a1defd).('_'cxx . . $ QChar#QChar(f349c77f591a7878).)) return false; |
| 102 | |
| 103 | SignOncxx . . $ SignOn/::Identitycxx . . $ SignOn/Identity# *identity = |
| 104 | SignOncxx . . $ SignOn/::Identitycxx . . $ SignOn/Identity#::existingIdentitycxx . . $ SignOn/Identity#existingIdentity(7e534ccf80011be0).(credentialsId, d); |
| 105 | if (Q_UNLIKELYcxx . . $ `<external>/4507883856836070869/qcompilerdetection.h:247:11`!(!identity)) return false; |
| 106 | |
| 107 | identity->setPropertycxx . . $ QObject#setProperty(395943cdf6cf5058).("appToBeRemoved", shortAppIdcxx . . $ QVariant#QVariant(3520e46b33348bf6).); |
| 108 | QObjectcxx . . $ QObject#::connectcxx . . $ QObject#connect(158df1d9a01a3410).(identity, SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(info(const SignOn::IdentityInfo&)), |
| 109 | d, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(onInfo(const SignOn::IdentityInfo&))); |
| 110 | QObjectcxx . . $ QObject#::connectcxx . . $ QObject#connect(158df1d9a01a3410).(identity, SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(credentialsStored(const quint32)), |
| 111 | d, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(onStored(const quint32))); |
| 112 | QObjectcxx . . $ QObject#::connectcxx . . $ QObject#connect(158df1d9a01a3410).(identity, SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(error(const SignOn::Error &)), |
| 113 | d, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(onError(const SignOn::Error &))); |
| 114 | identity->queryInfocxx . . $ SignOn/Identity#queryInfo(49f6e7a06ebc5aa8).(); |
| 115 | |
| 116 | bool ok = (d->m_loopcxx . . $ AclUpdaterPrivate#m_loop..execcxx . . $ QEventLoop#exec(f981dedee5b32481).() == 0); |
| 117 | delete identity; |
| 118 | return ok; |
| 119 | } |
| 120 | |
| 121 | #include "acl-updater.moc"cxx . . $ `<file>/build/click-hooks/online-accounts-hooks2/lomiri-online-accounts-hooks2_autogen/include/acl-updater.moc`/ |