[WIP]: Implement Authentication Agent/Listener
Needs ReviewPublic

Authored by shubham on Jun 3 2019, 3:24 PM.

Details

Summary

This is like a PoC patch for Auth agent.

Diff Detail

Repository
R16 KPMCore
Branch
auth_agent
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 12980
Build 12998: arc lint + arc unit
shubham requested review of this revision.Jun 3 2019, 3:24 PM
shubham created this revision.
shubham edited the summary of this revision. (Show Details)Jun 3 2019, 3:25 PM
shubham added reviewers: stikonas, cjlcarvalho.
shubham added a project: KDE Partition Manager.
shubham added a subscriber: KDE Partition Manager.

How do I include that FindPolKitQt1.cmake file so that I can use it in my project?

stikonas requested changes to this revision.Jun 3 2019, 7:34 PM
stikonas added inline comments.
CMakeLists.txt
73

Do this one separately, it's not KF5 frameworks.

find_package(PolkitQt5-1 REQUIRED)

You might also need if compilation fails
include_directories(${POLKITQT-1_INCLUDE_DIR}

src/util/FindPolkitQt-1.cmake
2 ↗(On Diff #59073)

Keep original copyright of the file form where you coppied it. It doesn't look like you changed anything here. And even if you changed, you add your own copyright line in addition to keeping old ones.

src/util/externalcommand_authagent.cpp
123

Minor: probably too many white lines in this function.

This revision now requires changes to proceed.Jun 3 2019, 7:34 PM
stikonas added inline comments.Jun 3 2019, 7:37 PM
src/util/externalcommand_authagent.h
24

#include <PolkitQt1/Agent/Listener>

shubham updated this revision to Diff 59092.Jun 3 2019, 7:52 PM

Made changes as suggested.
Updated version, still does not compile

shubham marked 3 inline comments as done.Jun 3 2019, 7:53 PM
shubham updated this revision to Diff 59097.Jun 3 2019, 9:20 PM

Builds, Compiles, Links

shubham edited the summary of this revision. (Show Details)Jun 3 2019, 9:20 PM
shubham updated this revision to Diff 59107.Jun 4 2019, 7:10 AM

Update my copyright mail id

This revision was not accepted when it landed; it landed in state Needs Review.Jun 4 2019, 7:13 AM
This revision was automatically updated to reflect the committed changes.
shubham reopened this revision.Jun 4 2019, 7:56 AM
shubham updated this revision to Diff 59114.Jun 4 2019, 7:56 AM

Use authority instance to register the listener

shubham updated this revision to Diff 59135.Jun 4 2019, 3:29 PM

Remove extra variable

shubham updated this revision to Diff 59206.Jun 5 2019, 3:52 PM

Move FindPolkitQt1.cmake to cmake/modules/

shubham updated this revision to Diff 59207.Jun 5 2019, 3:55 PM

Proper rebase

shubham updated this revision to Diff 59209.Jun 5 2019, 5:01 PM

Unregistration of the auth agent

shubham updated this revision to Diff 59247.Jun 6 2019, 8:40 AM

Remove unneded includes and use Q_UNUSED() variables

shubham updated this revision to Diff 59248.Jun 6 2019, 8:44 AM

Some more cleanup

stikonas added inline comments.Jun 6 2019, 8:57 PM
CMakeLists.txt
44

move this bwllow line 46:

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

46

We actually already set module path in the line above, so this is redundant. Remove this line.

stikonas added inline comments.Jun 6 2019, 9:01 PM
cmake/modules/FindPolkitQt-1.cmake
1–36 ↗(On Diff #59248)

Ok, I just checked, what I need to do to compile.. Remove this file completely.

And use

find_package(PolkitQt5-1 REQUIRED)

Note that it is Qt5, not Qt.

shubham updated this revision to Diff 59311.Jun 7 2019, 4:17 AM

Made suggested changes

shubham marked 2 inline comments as done.Jun 7 2019, 4:18 AM

So far rest seems alright.

CMakeLists.txt
48

This is no longer necessary after we link to PolkitQt5-1 instead of PolkitQt-1

shubham updated this revision to Diff 59516.Jun 10 2019, 2:51 PM
shubham marked an inline comment as done.

Do not include PolkitQt5 directories

shubham updated this revision to Diff 59523.Jun 10 2019, 4:22 PM

Add more functions

shubham updated this revision to Diff 59666.Jun 12 2019, 4:54 PM

Rebase on master

shubham updated this revision to Diff 59888.EditedJun 15 2019, 7:13 PM
  1. Use synchronous versions of register and unregistering authentication agents
  2. Call authenticationAgentResponseSync() on successfull authentication by the user

@stikonas @cjlcarvalho How can I use QSignalSpy? I tried adding it to target link libraries(Qt5::Widgets) but still it does not works.

I think QSignalSpy is in QtTest, not QtWidgets.

And try to use new signal syntax in QSignalSpy spy(m_authenticationSession, SIGNAL(completed(bool)));

shubham updated this revision to Diff 59955.Jun 16 2019, 7:37 PM

Add documentation

shubham updated this revision to Diff 59957.Jun 16 2019, 7:47 PM

Use correct signal