authority: add support for passing details to polkit
Needs ReviewPublic

Authored by mgerstner on Fri, Feb 8, 10:43 AM.

Details

Reviewers
chinmoyr
fvogt
bruns
Group Reviewers
Frameworks
Summary

Currently polkit-qt-1 doesn't support to pass details during the checkAuthorization() call. Details are for example required to employ runtime generated authorization messages that contain placeholders like "authentication required for accessing $(device)". This feature can be helpful to improve the end user experience and security, since the exact context of a privileged operation can be expressed better. Polkit documentation about this details parameter can be found here.

This change adds alternative versions of checkAuthorization() and checkAuthorizationSync() that accepts an additional QMap<QString, QString> details parameter. In the implementation this map is converted into the required polkit level PolkitDetails type and passed to the according polkit functions as necessary.

To conform with the KDE binary compatibility policy I didn't extend or overload the existing checkAuthorization() and checkAuthorizationSync() functions, but introduced newly named functions.

Diff Detail

Lint
Lint Skipped
Unit
Unit Tests Skipped
mgerstner requested review of this revision.Fri, Feb 8, 10:43 AM
mgerstner created this revision.
bruns added inline comments.Fri, Feb 15, 2:27 AM
core/polkitqt1-authority.cpp
130

nullptr

328

nullptr

332

whitespace

422

nullptr, or just if (pk_details) {

core/polkitqt1-authority.h
226

please add a KF6 TODO, merge with checkAuthorization

mgerstner updated this revision to Diff 51753.Fri, Feb 15, 1:29 PM

Incorporated review comments: replaced NULL by nullptr, removed some extra whitespace within parantheses, added KF6 TODO.

mgerstner added inline comments.Fri, Feb 15, 1:31 PM
core/polkitqt1-authority.cpp
328

I didn't want to mix styles in the source files. It's adjusted now.