<table><tr><td style="">sitter requested changes to this revision.<br />sitter added a comment.<br />This revision now requires changes to proceed.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D21795">View Revision</a></tr></table><br /><div><div><p>The way details are enumerated needs changing IMO. And this effectively bumps the required polkitqt version through exactly one call, so maybe an #if conditional to not have the forced bump might be good</p></div></div><br /><div><strong>INLINE COMMENTS</strong><div><div style="margin: 6px 0 12px 0;"><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D21795#inline-127682">View Inline</a><span style="color: #4b4d51; font-weight: bold;">AuthBackend.h:61</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; "> <span class="n">virtual</span> <span style="color: #aa4000">bool</span> <span style="color: #004012">isCallerAuthorized</span><span class="p">(</span><span style="color: #aa4000">const</span> <span class="n">QString</span> <span style="color: #aa2211">&</span><span class="n">action</span><span class="p">,</span> <span class="n">QByteArray</span> <span class="n">callerID</span><span class="p">)</span> <span style="color: #aa2211">=</span> <span style="color: #601200">0</span><span class="p">;</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="n">virtual</span> <span style="color: #aa4000">bool</span> <span style="color: #004012">isCallerAuthorized</span><span class="p">(</span><span style="color: #aa4000">const</span> <span class="n">QString</span> <span style="color: #aa2211">&</span><span class="n">action</span><span class="p">,</span> <span style="color: #aa4000">const</span> <span class="n">DetailsMap</span> <span style="color: #aa2211">&</span><span class="n">details</span><span class="p">,</span> <span class="n">QByteArray</span> <span class="n">callerID</span><span class="p">)</span> <span style="color: #aa2211">=</span> <span style="color: #601200">0</span><span class="p">;</span> <span style="color: #74777d">// KF6 TODO Merge</span>
</div><div style="padding: 0 8px; margin: 0 4px; "> <span class="n">virtual</span> <span style="color: #aa4000">bool</span> <span style="color: #004012">actionExists</span><span class="p">(</span><span style="color: #aa4000">const</span> <span class="n">QString</span> <span style="color: #aa2211">&</span><span class="n">action</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">I didn't check super carefully but at a glance the backend api is not public API so we could probably refactor this right now already.</p>
<p style="padding: 0; margin: 8px;">Also, shouldn't the callerID be a const ref?</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D21795#inline-127681">View Inline</a><span style="color: #4b4d51; font-weight: bold;">DBusHelperProxy.cpp:109</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="n">qDebug</span><span class="p">()</span> <span style="color: #aa2211"><<</span> <span class="n">details</span><span class="p">;</span>
</div><div style="padding: 0 8px; margin: 0 4px; "> <span class="n">QList</span><span style="color: #aa2211"><</span><span class="n">QVariant</span><span style="color: #aa2211">></span> <span class="n">args</span><span class="p">;</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">left over debugging? either remove or categorize</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D21795#inline-127687">View Inline</a><span style="color: #4b4d51; font-weight: bold;">Polkit1Backend.cpp:187</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"><span class="bright"> </span><span class="n"><span class="bright">QMap</span></span><span class="bright"></span><span style="color: #aa2211"><span class="bright"><</span></span><span class="bright"></span><span class="n"><span class="bright">QString</span></span><span class="bright"></span><span class="p"><span class="bright">,</span></span><span class="bright"> </span><span class="n"><span class="bright">QString</span></span><span class="bright"></span><span style="color: #aa2211"><span class="bright">></span></span><span class="bright"> </span><span class="n"><span class="bright">polkit1Details</span></span><span class="bright"></span><span class="p"><span class="bright">;</span></span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #aa4000">for</span> <span class="p">(</span><span style="color: #aa4000">auto</span> <span class="n">it</span> <span style="color: #aa2211">=</span> <span class="n">details</span><span class="p">.</span><span class="n">begin</span><span class="p">();</span> <span class="n">it</span> <span style="color: #aa2211">!=</span> <span class="n">details</span><span class="p">.</span><span class="n">end</span><span class="p">();</span> <span style="color: #aa2211">++</span><span class="n">it</span><span class="p">)</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="n">polkit1Details</span><span class="p">.</span><span class="n">insert</span><span class="p">(</span><span class="n">it</span><span class="p">.</span><span class="n">key</span><span class="p">(),</span> <span class="n">it</span><span class="p">.</span><span class="n">value</span><span class="p">().</span><span class="n">toString</span><span class="p">());</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">you want constBegin/End here</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D21795#inline-127689">View Inline</a><span style="color: #4b4d51; font-weight: bold;">Polkit1Backend.cpp:193</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; "> <span style="color: #aa2211">&</span><span class="n">e</span><span class="p">,</span> <span class="n">SLOT</span><span class="p">(</span><span class="n">requestQuit</span><span class="p">(</span><span class="n">PolkitQt1</span><span style="color: #aa2211">::</span><span class="n">Authority</span><span style="color: #aa2211">::</span><span class="n">Result</span><span class="p">)));</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);"> <span class="n">authority</span><span style="color: #aa2211">-></span><span class="n">checkAuthorization</span><span class="p">(</span><span class="n">action</span><span class="p">,</span> <span class="n">subject</span><span class="p">,</span> <span class="n">PolkitQt1</span><span style="color: #aa2211">::</span><span class="n">Authority</span><span style="color: #aa2211">::</span><span class="n">AllowUserInteraction</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="n">authority</span><span style="color: #aa2211">-></span><span class="n">checkAuthorization<span class="bright">WithDetails</span></span><span class="p">(</span><span class="n">action</span><span class="p">,</span> <span class="n">subject</span><span class="p">,</span> <span class="n">PolkitQt1</span><span style="color: #aa2211">::</span><span class="n">Authority</span><span style="color: #aa2211">::</span><span class="n">AllowUserInteraction<span class="bright"></span></span><span class="bright"></span><span class="p"><span class="bright">,</span></span><span class="bright"> </span><span class="n"><span class="bright">polkit1Details</span></span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; "> <span class="n">e</span><span class="p">.</span><span class="n">exec</span><span class="p">();</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">looks to me this was only added 4 months ago. so this would probably require a version bump. seeing as we are fairly conservative with frameworks' requirements it may be better to <tt style="background: #ebebeb; font-size: 13px;">if version>=whatevs</tt> the call.</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D21795#inline-127684">View Inline</a><span style="color: #4b4d51; font-weight: bold;">kauthaction.cpp:77</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; "><span class="n">Action</span><span style="color: #aa2211">::</span><span class="n">Action</span><span class="p">(</span><span style="color: #aa4000">const</span> <span class="n">QString</span> <span style="color: #aa2211">&</span><span class="n">name</span><span class="p">,</span> <span style="color: #aa4000">const</span> <span class="n">QString</span> <span style="color: #aa2211">&</span><span class="n">details</span><span class="p">)</span>
</div><div style="padding: 0 8px; margin: 0 4px; "> <span style="color: #aa2211">:</span> <span class="n">d</span><span class="p">(</span><span style="color: #aa4000">new</span> <span class="n">ActionData</span><span class="p">())</span>
</div><div style="padding: 0 8px; margin: 0 4px; "><span class="p">{</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">you could just delegate to the new constructor here instead of having two code duplicated ctors.</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D21795#inline-127676">View Inline</a><span style="color: #4b4d51; font-weight: bold;">kauthaction.h:236</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"><span style="color: #74777d"> */</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #aa4000">void</span> <span style="color: #004012">setDetails</span><span class="p">(</span><span style="color: #aa4000">const</span> <span class="n">DetailsMap</span> <span style="color: #aa2211">&</span><span class="n">details</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">this seems like super leaky abstraction. you are allowing the caller to set backend specific stuff here. I think it'd be much better to make an enum for detail types, and have this be a QMap of enum,QVariant.</p>
<p style="padding: 0; margin: 8px;">if the caller sets polkit.message then that won't apply to the mac backend even if someone were to implement the relevant functionality there. if it is a general purpose enum key each backend can easily implement or ignore as necessary</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D21795#inline-127683">View Inline</a><span style="color: #4b4d51; font-weight: bold;">kauthaction.h:246</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"><span style="color: #74777d"> */</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="n">QString</span> <span style="color: #004012">details</span><span class="p">()</span> <span style="color: #aa4000">const</span><span class="p">;</span> <span style="color: #74777d">// KF6 TODO: Remove</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Should the old functions maybe be marked deprecated?</p></div></div></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R283 KAuth</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D21795">https://phabricator.kde.org/D21795</a></div></div><br /><div><strong>To: </strong>chinmoyr, apol, bruns, davidedmundson, Frameworks, dfaure, cfeck, sitter<br /><strong>Cc: </strong>sitter, mreeves, kde-frameworks-devel, LeGast00n, sbergeron, michaelh, ngraham, bruns<br /></div>