1
0

Accepting request 122383 from home:vuntz:branches:GNOME:Factory

Don't require auth to change timezone

OBS-URL: https://build.opensuse.org/request/show/122383
OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gnome-control-center?expand=0&rev=147
This commit is contained in:
Dominique Leuenberger 2012-06-04 17:38:14 +00:00 committed by Git OBS Bridge
parent a15cb0653a
commit d842c1cb53
3 changed files with 108 additions and 0 deletions

View File

@ -0,0 +1,97 @@
commit 4300867b7bfc4f67a0e8b273aa7d2d13973ea7ac
Author: Vincent Untz <vuntz@gnome.org>
Date: Mon Mar 12 15:31:40 2012 +0100
datetime: Allow changing timezone without auth if action is allowed
As changing the time can have security implications, while changing the
timezone doesn't, it's not unusual to have a setup where
org.freedesktop.timedate1.set-timezone is allowed while other
time-related actions aren't.
Therefore, if org.freedesktop.timedate1.set-timezone is allowed, there's
no reason to require that the user unlocks the panel to enable him to
change the timezone.
https://bugzilla.gnome.org/show_bug.cgi?id=646185
diff --git a/panels/datetime/cc-datetime-panel.c b/panels/datetime/cc-datetime-panel.c
index d229e94..378e0cb 100644
--- a/panels/datetime/cc-datetime-panel.c
+++ b/panels/datetime/cc-datetime-panel.c
@@ -86,6 +86,7 @@ struct _CcDateTimePanelPrivate
GCancellable *cancellable;
GPermission *permission;
+ GPermission *permission_tz;
};
static void update_time (CcDateTimePanel *self);
@@ -164,6 +165,12 @@ cc_date_time_panel_dispose (GObject *object)
priv->permission = NULL;
}
+ if (priv->permission_tz)
+ {
+ g_object_unref (priv->permission_tz);
+ priv->permission_tz = NULL;
+ }
+
G_OBJECT_CLASS (cc_date_time_panel_parent_class)->dispose (object);
}
@@ -806,19 +813,33 @@ on_permission_changed (GPermission *permission,
gpointer data)
{
CcDateTimePanelPrivate *priv = CC_DATE_TIME_PANEL (data)->priv;
- gboolean allowed, using_ntp;
+ gboolean allowed, allowed_tz, using_ntp;
allowed = g_permission_get_allowed (permission);
+ allowed_tz = priv->permission_tz && g_permission_get_allowed (priv->permission_tz);
using_ntp = gtk_switch_get_active (GTK_SWITCH (W("network_time_switch")));
/* All the widgets but the lock button and the 24h setting */
- gtk_widget_set_sensitive (W("map-vbox"), allowed);
+ gtk_widget_set_sensitive (W("map-vbox"), allowed || allowed_tz);
gtk_widget_set_sensitive (W("hbox2"), allowed);
gtk_widget_set_sensitive (W("alignment2"), allowed);
update_widget_state_for_ntp (data, using_ntp);
}
static void
+on_permission_tz_changed (GPermission *permission,
+ GParamSpec *pspec,
+ gpointer data)
+{
+ CcDateTimePanelPrivate *priv = CC_DATE_TIME_PANEL (data)->priv;
+ gboolean allowed;
+
+ allowed = g_permission_get_allowed (permission) || g_permission_get_allowed (priv->permission);
+
+ gtk_widget_set_sensitive (W("map-vbox"), allowed);
+}
+
+static void
update_ntp_switch_from_system (CcDateTimePanel *self)
{
CcDateTimePanelPrivate *priv = self->priv;
@@ -1103,6 +1124,18 @@ cc_date_time_panel_init (CcDateTimePanel *self)
g_signal_connect (priv->permission, "notify",
G_CALLBACK (on_permission_changed), self);
on_permission_changed (priv->permission, NULL, self);
+
+ priv->permission_tz = polkit_permission_new_sync ("org.freedesktop.timedate1.set-timezone", NULL, NULL, NULL);
+ if (priv->permission_tz == NULL)
+ {
+ g_warning ("Your system does not have the '%s' PolicyKit files installed. Please check your installation",
+ "org.freedesktop.timedate1.set-timezone");
+ return;
+ }
+
+ g_signal_connect (priv->permission_tz, "notify",
+ G_CALLBACK (on_permission_tz_changed), self);
+ on_permission_tz_changed (priv->permission_tz, NULL, self);
}
void

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Fri May 25 12:20:40 UTC 2012 - vuntz@opensuse.org
- Add gnome-control-center-fine-grained-tz-polkit.patch: do not
require the privilege to change the time to change the timezone.
In the default configuration, this makes it possible to change
the timezone without authentication. Fix bnc#749453.
-------------------------------------------------------------------
Tue May 15 13:59:35 UTC 2012 - vuntz@opensuse.org

View File

@ -33,6 +33,8 @@ Source: http://download.gnome.org/sources/gnome-control-center/3.4/%{nam
Patch0: gnome-control-center-allow-yast-in-shell.patch
# PATCH-HACK-OPENSUSE gnome-control-center-hide-region-system-tab.patch vuntz@opensuse.org -- Hide system tab in region panel until we really use the right files for system settings (see bnc#703833)
Patch2: gnome-control-center-hide-region-system-tab.patch
# PATCH-FIX-UPSTREAM gnome-control-center-fine-grained-tz-polkit.patch bgo#646185 bnc#749453 vuntz@opensuse.org -- Allow changing timezone without requiring privileges to change time
Patch3: gnome-control-center-fine-grained-tz-polkit.patch
# PATCH-NEEDS-REBASE gnome-control-center-system-proxy-configuration.patch -- this needs to be reimplemented to be more distro-generic before submitting upstream - docs at http://en.opensuse.org/GNOME/Proxy_configuration (was PATCH-FEATURE-OPENSUSE)
Patch14: gnome-control-center-system-proxy-configuration.patch
BuildRequires: cups-devel
@ -155,6 +157,7 @@ various aspects of your desktop.
translation-update-upstream
%patch0 -p1
%patch2 -p1
%patch3 -p1
#NEEDS-REBASE
#%patch14 -p1