Comment 37 for bug 828850

Revision history for this message
Edward Donovan (edward.donovan) wrote :

Here is a rough-and-ready patch, to SoftwarePropertiesGtk.py, that catches the PermissionDeniedByPolicy exceptions.

It wraps every call to the dbus backend, the operations that require a password, in a try-except block. When it catches the exception, it pops a dialog saying "Software sources can't be changed without permission."

This patch stops the exception problems, for every action in the GUI, that I could think to try. Please test it if you can.

Notes:

- I could not find one place to put the try-except, that would include all the operations. I tried putting it in the files that call this one, and several places here.

- As of this first version, if you cancel the password dialog, the 'Revert' button is activated, even though you were unable to change anything. I'll try to look into that, but want to send this now.

- The module already has a method "on_auth_failed", apparently for use when the dbus backend signals unsuccessful authorization. I haven't been able to integrate this patch with that function. Ideally, this exception catching might be a part of that, and perhaps that function is not quite doing its job, yet, if it isn't handling these exceptions, or managing the state of 'Revert'.

Thanks.