Skip to content

Draft: Try admin backend for file ops when the user does not have sufficient permissions

This patch adds support for performing file operations as administrator seamlessly (i.e. without entering a "mode" such as by typing "admin:///" in the path bar) by using GVfs's admin backend. When a non-administrator user tries to perform certain file operations that require administrator's privileges, the user is first requested permission to perform the operation as an administrator via a UI dialogue. If permission is granted, the admin backend is used internally to perform the file operation.

Use of the admin backend is done seamlessly by translating native file URIs to "admin://" URIs. The special Gvfs "admin:///" location is mounted first to activate the admin backend.

Seamless invocation of the admin backend is implemented via layer of abstraction that sits between the UI code and file-operations. This layer of abstraction is served by the NautilusFileOpHelper class. An instance of the NautilusFileOpHelper is provided to the file-op functions in file-operations which then use the helper object to invoke actual file operations using GFile functions such as g_file_copy(), g_file_delete(), etc.

By implementing this feature using a layer of abstraction served by the helper object I have attempted to minimize changes to file-operations code. I hope that it is relatively straightforward to review and validate the correctness (in terms of equivalence with the original code) for normal file operations. More effort will be needed to review and verify the new code that implements the actual admin operations.

Merge request reports