[WIP]: Implement PolkitQt1 Authorization backend
ClosedPublic

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

Diff Detail

Repository
R16 KPMCore
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
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
386

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.EditedSat, Jun 22, 5:27 PM

More code cleanup.
Remove unnecessary includes.

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

Properly handle reply from Authentication agent

stikonas added inline comments.Mon, Jun 24, 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.EditedWed, Jun 26, 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.Wed, Jun 26, 4:37 PM
This revision was automatically updated to reflect the committed changes.
shubham reopened this revision.Wed, Jun 26, 4:38 PM
shubham updated this revision to Diff 61193.Fri, Jul 5, 8:02 AM

Add function to stop action inside the polkit backend

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

More cleanup and remove unneded commented code

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

Remove unneded function

shubham updated this revision to Diff 61305.EditedMon, Jul 8, 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.Tue, Jul 9, 7:42 AM

Now compiles, authorizing using the Polkit backend

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

Add timer to quit()

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

Remove unnecessary include

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

Remove KAuth dependence

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

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

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

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.Fri, Jul 12, 4:32 AM
src/util/externalcommand.cpp
183

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.Fri, Jul 12, 6:24 AM

Comment out connects for now

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

Rebase wrt qdbus patch

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

Comment out connects for now

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