- Add handling of file:/ protocol

- Change order of checked policies so the PolicyKit asks only for
    "printer-enable" policy when enabling/disabling a printer
- Change order of checked policies so the PolicyKit asks only for
    "printer-set-default" policy when setting default printer
This commit is contained in:
mkasik 2009-01-26 13:24:30 +00:00
parent e26ec72633
commit bac347e1cd
2 changed files with 74 additions and 1 deletions

View File

@ -1,6 +1,6 @@
Name: cups-pk-helper
Version: 0.0.3
Release: 1%{?dist}
Release: 2%{?dist}
Summary: A helper that makes system-config-printer use PolicyKit
Group: System Environment/Base
@ -9,6 +9,7 @@ URL: http://www.vuntz.net/download/cups-pk-helper/
Source0: http://www.vuntz.net/download/cups-pk-helper/cups-pk-helper-%{version}.tar.bz2
Patch0: dependencies.patch
Patch1: pk_order.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -32,6 +33,7 @@ interfaces available under control of PolicyKit.
%setup -q
%patch0 -p0 -b .dependencies
%patch1 -p0 -b .pk-order
%build
%configure
@ -58,6 +60,12 @@ rm -rf $RPM_BUILD_ROOT
%changelog
* Tue Jan 26 2009 Marek Kasik <mkasik@redhat.com> 0.0.3-2
- Add handling of file:/ protocol
- Change order of checked policies so the PolicyKit asks only for
"printer-enable" policy when enabling/disabling a printer
- Change order of checked policies so the PolicyKit asks only for
"printer-set-default" policy when setting default printer
* Tue Jan 13 2009 Marek Kasik <mkasik@redhat.com> 0.0.3-1
- Initial spec file.

65
pk_order.patch Normal file
View File

@ -0,0 +1,65 @@
--- src/cups.c 2008-11-21 07:04:28.000000000 +0100
+++ src/cups.c 2009-01-23 16:28:07.000000000 +0100
@@ -1606,6 +1606,7 @@ cph_cups_is_printer_uri_local (const cha
g_str_has_prefix (lower_uri, "beh:") ||
g_str_has_prefix (lower_uri, "scsi:") ||
g_str_has_prefix (lower_uri, "serial:") ||
+ g_str_has_prefix (lower_uri, "file:") ||
g_str_has_prefix (lower_uri, "pipe:")) {
g_free (lower_uri);
return TRUE;
--- src/cups-pk-helper-mechanism.c 2008-11-21 07:28:20.000000000 +0100
+++ src/cups-pk-helper-mechanism.c 2009-01-26 13:54:44.000000000 +0100
@@ -901,21 +901,18 @@ cph_mechanism_printer_set_default (CphMe
DBusGMethodInvocation *context)
{
gboolean ret;
- const char *last_action;
+ const char *action;
reset_killtimer (mechanism);
- last_action = _cph_mechanism_get_action_for_name (mechanism, name);
+ action = _cph_mechanism_get_action_for_name (mechanism, name);
if (!_check_polkit_for_action_v (mechanism, context,
"printeraddremove",
- /* this is not the last check because
- * it's likely most useful to the user
- * to give "printer-X-edit" powers */
- "printer-default",
/* quite important, since it's
* automatically called after adding a
* printer */
- last_action,
+ action,
+ "printer-set-default",
NULL))
return FALSE;
@@ -932,21 +929,19 @@ cph_mechanism_printer_set_enabled (CphMe
DBusGMethodInvocation *context)
{
gboolean ret;
- const char *last_action;
+ const char *action;
reset_killtimer (mechanism);
- last_action = _cph_mechanism_get_action_for_name (mechanism, name);
+ action = _cph_mechanism_get_action_for_name (mechanism, name);
+
if (!_check_polkit_for_action_v (mechanism, context,
"printeraddremove",
- /* this is not the last check because
- * it's likely most useful to the user
- * to give "printer-X-edit" powers */
- "printer-enable",
/* quite important, since it's
* automatically called after adding a
* printer */
- last_action,
+ action,
+ "printer-enable",
NULL))
return FALSE;