Review Request 129983: [RFC] PoC patch for polkit support in kio.

Elvis Angelaccio elvis.angelaccio at kde.org
Thu Mar 16 18:47:25 UTC 2017



> On March 13, 2017, 12:10 p.m., Elvis Angelaccio wrote:
> > I'm not sure if we should show the warning dialog at the kio_file level. This would result in a double dialog when deleting files with Shift+Del from file managers. What about making jobuidelegate.cpp smarter? It could show a more "scary" message if the file that's being deleted is write-protected.
> 
> Chinmoy Ranjan Pradhan wrote:
>     In my system when i use Shift+del there is no warning dialog (few months back dolphin used to show the dialog but strangly it doesn't shows now) so this case didn't occured to me. 
>     
>     If I am not wrong jobuidelegate's warning is shown before the job executes and kauth's authentication dialog is shown only after job executes. But its just the opposite we want. So if there's a way for slave to notify the job of starting of a priviledged action then there should be no problem in making jobuidelegate smarter. 
>     (But the thing is at this very moment i can't think of or find any possible way)
> 
> Elvis Angelaccio wrote:
>     You probably checked the "don't show again" checkbox ;) The jobuidelegate's dialog is shown by default, so we must assume the user will see it => we need a way to prevent showing the dialog twice. You are right that jobuidelegate is run before kio_file is involved. I was thinking of checking the permissions from jobuidelegate: can you check if QFileInfo would do the trick? (e.g. QFileInfo::isWritable()?)
> 
> Chinmoy Ranjan Pradhan wrote:
>     >You probably checked the "don't show again" checkbox ;)
>     
>     Completely forgot about that :P
>     
>     >we need a way to prevent showing the dialog twice
>     
>     I hope you mean the warning dialog because if the user is not authorised then there will be two dialogs.
>     
>     >I was thinking of checking the permissions from jobuidelegate: can you check if QFileInfo would do the trick?
>     
>     Checking permissions beforehand and then showing the dangerous warning is definitely a good idea. Now QFileInfo::isWritable will work only when deleteJob is started inside a write-protected location. Suppose if its a regular folder inside some regular location but containing a write-protected subfolder then the check's result will be useless. 
>     One thing we can do is stat the contents and as soon we find a write-protected location we can abort the stat'ing and show our special warning.

Sounds good. Please make sure to include this point in your proposal ;)


- Elvis


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/129983/#review102826
-----------------------------------------------------------


On March 14, 2017, 2:48 p.m., Chinmoy Ranjan Pradhan wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/129983/
> -----------------------------------------------------------
> 
> (Updated March 14, 2017, 2:48 p.m.)
> 
> 
> Review request for KDE Frameworks, David Faure and Elvis Angelaccio.
> 
> 
> Repository: kio
> 
> 
> Description
> -------
> 
> This is regarding the GSOC idea https://community.kde.org/GSoC/2017/Ideas#Project:_Polkit_support_in_KIO.
> 
> This patch intends to demonstrate one possible approach to provide polkit support in kio. Here its only for the delete operation. This is based on the patch in task https://phabricator.kde.org/T5070.
> 
> The approach is as follows;
> 1. Whenever file ioslave gets access denied error it calls the method *execWithRoot* with the action that requires priviledge, the path of items
>    upon which action needs to be performed and a warning ID as arguments.
> 2. *execWithRoot* then executes the KAuth::Action *org.kde.kio.file.execute*. 
> 3. This Kauth::Action has its Persistence set too 'session'. This means that after authentication the restrictions are dropped for a while, for    
>    about 5 minutes. This is similar to the behaviour of sudo command.
> 4. During this time we can perform any action as a privileged user without any authentication. So to prevent any mishap i added a warning box which
>    would popup before performing any action(only during this period).
> 5. After the said time interval the root privileges are droped and calling *execWithRoot* should show the usual authentication dialog.
> 
> 
> Diffs
> -----
> 
>   src/ioslaves/file/CMakeLists.txt b9132ce 
>   src/ioslaves/file/file.h 109ea80 
>   src/ioslaves/file/file.cpp eaf6c88 
>   src/ioslaves/file/file_unix.cpp 82eb11a 
>   src/ioslaves/file/kauth/CMakeLists.txt PRE-CREATION 
>   src/ioslaves/file/kauth/file.actions PRE-CREATION 
>   src/ioslaves/file/kauth/helper.h PRE-CREATION 
>   src/ioslaves/file/kauth/helper.cpp PRE-CREATION 
> 
> Diff: https://git.reviewboard.kde.org/r/129983/diff/
> 
> 
> Testing
> -------
> 
> 
> File Attachments
> ----------------
> 
> warning dialog
>   https://git.reviewboard.kde.org/media/uploaded/files/2017/03/09/d42570e8-aedf-4c02-801e-362a68755c2c__polkit_integration.png
> 
> 
> Thanks,
> 
> Chinmoy Ranjan Pradhan
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20170316/5bf606b8/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list