[WIP]: Implement PolkitQt1 Authorization backend
ClosedPublic

Authored by shubham on Jun 21 2019, 5:48 PM.

Diff Detail

Repository
R16 KPMCore
Branch
auth-polkit-qt1
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 13795
Build 13813: arc lint + arc unit
shubham requested review of this revision.Jun 21 2019, 5:48 PM
shubham created this revision.
shubham edited the summary of this revision. (Show Details)Jun 21 2019, 5:50 PM
shubham added reviewers: stikonas, cjlcarvalho.
shubham added a project: KDE Partition Manager.
shubham edited the test plan for this revision. (Show Details)
shubham added a subscriber: KDE Partition Manager.
shubham updated this revision to Diff 60267.EditedJun 21 2019, 5:52 PM

Correct documentation error.
@stikonas I will be making more changes to it and will implement those Q_SLOTS soon.
(sendProgressStep())

shubham edited the summary of this revision. (Show Details)Jun 21 2019, 5:55 PM
shubham updated this revision to Diff 60291.Jun 22 2019, 9:27 AM

Lay basic outline of executing and revoking actions from inside ExternalCommand

shubham updated this revision to Diff 60293.Jun 22 2019, 9:36 AM

Remove unneeded functions

shubham updated this revision to Diff 60295.Jun 22 2019, 9:41 AM

some more changes

stikonas added inline comments.Jun 22 2019, 9:47 AM
src/util/externalcommand.cpp
385

spelling, executeAction()

src/util/externalcommand_polkitbackend.cpp
93

I'll have to read a bit more about polkit, but this requirement sounds strange.

It shouldn't be necessary to have kde-authentication-agent-1. Some users might be on other desktop environments and use their own polkit authentication agent, e.g. polkit-gnome-authentication-agent-1.

shubham updated this revision to Diff 60381.EditedJun 22 2019, 5:27 PM

More code cleanup.
Remove unnecessary includes.

shubham marked 2 inline comments as done.Jun 22 2019, 5:44 PM
shubham updated this revision to Diff 60386.Jun 22 2019, 5:49 PM

Properly handle reply from Authentication agent

stikonas added inline comments.Jun 24 2019, 8:01 PM
src/util/externalcommand_polkitbackend.h
51

We don't need Q_PLUGIN_METADATA in kpmcore.

I think we'll only support PolkitQt1, so we won't be loading authentication backendslike KAuth.

shubham updated this revision to Diff 60691.EditedJun 26 2019, 2:07 PM
shubham marked an inline comment as done.

Remove Q_PLUGIN_METADATA

This revision was not accepted when it landed; it landed in state Needs Review.Jun 26 2019, 4:37 PM
This revision was automatically updated to reflect the committed changes.
shubham reopened this revision.Jun 26 2019, 4:38 PM
shubham updated this revision to Diff 61193.Jul 5 2019, 8:02 AM

Add function to stop action inside the polkit backend

shubham updated this revision to Diff 61224.Jul 5 2019, 2:59 PM

More cleanup and remove unneded commented code

shubham updated this revision to Diff 61265.Jul 7 2019, 8:00 AM

Remove unneded function

shubham updated this revision to Diff 61305.EditedJul 8 2019, 5:01 AM

Authenticate org.kde.kpmcore.externalcommand.init action inside ExternalCommand::startHelper() using Polkit Backend
@stikonas Below error is troubling me for sometime.

function ‘bool ExternalCommand::startHelper()’:
/home/aryan/kde/src/kpmcore/src/util/externalcommand.cpp:388:14: error: invalid use of incomplete type ‘class PolkitQt1Backend’

m_authJob->initPolkitAgent(QStringLiteral("org.kde.kpmcore.externalcommand.init"), parent);
         ^~

In file included from /home/aryan/kde/src/kpmcore/src/util/externalcommand.cpp:27:0:
/home/aryan/kde/src/kpmcore/src/util/externalcommand.h:41:7: note: forward declaration of ‘class PolkitQt1Backend’
class PolkitQt1Backend;

shubham updated this revision to Diff 61391.Jul 9 2019, 7:42 AM

Now compiles, authorizing using the Polkit backend

shubham updated this revision to Diff 61485.Jul 10 2019, 8:03 AM

Add timer to quit()

shubham updated this revision to Diff 61486.Jul 10 2019, 8:05 AM

Remove unnecessary include

shubham updated this revision to Diff 61571.Jul 11 2019, 8:44 AM

Remove KAuth dependence

shubham added inline comments.Jul 11 2019, 8:58 AM
src/util/externalcommand.cpp
191

these connect gives error and correctly so because of m_authJob. Any suggestion how to tackle? Ditto at line 377

stikonas added inline comments.Jul 11 2019, 8:19 PM
src/util/externalcommand.cpp
191

Well, report progress used KAuth, Now progress will have to be sent via DBus message. So ExternalCommandHelper class will act as DBus client and send messages to ExternalCommand class.

Comment it out for now. It will obviously make kpmcore not fully functional until it is reimplemnted, but I think it might still work (just no progress reporting).

shubham added inline comments.Jul 12 2019, 4:32 AM
src/util/externalcommand.cpp
191

progress() and reportProgress() signals have been reimplemented in the qdbus patch. We are now NOT using KAuth's HelperSupport::reportProgress() function which internally used to emit the signal.

shubham updated this revision to Diff 61620.Jul 12 2019, 6:24 AM

Comment out connects for now

shubham updated this revision to Diff 61621.Jul 12 2019, 6:26 AM

Rebase wrt qdbus patch

shubham marked an inline comment as done.Jul 12 2019, 6:27 AM
This revision was not accepted when it landed; it landed in state Needs Review.Jul 12 2019, 6:32 AM
This revision was automatically updated to reflect the committed changes.
shubham reopened this revision.Jul 12 2019, 7:07 AM
shubham updated this revision to Diff 61624.Jul 12 2019, 8:17 AM

Comment out connects for now

This revision was not accepted when it landed; it landed in state Needs Review.Jul 12 2019, 8:24 AM
This revision was automatically updated to reflect the committed changes.