Accepting request 202474 from GNOME:Factory

- Rebase gnome-shell-private-connection.patch (bnc#751211) (forwarded request 202468 from gary_lin)

OBS-URL: https://build.opensuse.org/request/show/202474
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/gnome-shell?expand=0&rev=84
This commit is contained in:
Tomáš Chvátal 2013-10-08 08:48:21 +00:00 committed by Git OBS Bridge
commit bfb313f9a2
3 changed files with 92 additions and 148 deletions

View File

@ -1,4 +1,4 @@
From 53b3dc5944c595e143fb0fb848c566d6aecb4bb9 Mon Sep 17 00:00:00 2001 From 16ef77fd194f2f10ae81f273a5dea2a3c06904b6 Mon Sep 17 00:00:00 2001
From: Giovanni Campagna <gcampagna@src.gnome.org> From: Giovanni Campagna <gcampagna@src.gnome.org>
Date: Thu, 31 Mar 2011 15:56:13 +0200 Date: Thu, 31 Mar 2011 15:56:13 +0200
Subject: [PATCH] NetworkMenu: create private connections if the user is not Subject: [PATCH] NetworkMenu: create private connections if the user is not
@ -11,166 +11,102 @@ if the system administrator decides so.
https://bugzilla.gnome.org/show_bug.cgi?id=646187 https://bugzilla.gnome.org/show_bug.cgi?id=646187
--- ---
js/ui/status/network.js | 59 +++++++++++++++++++++++++++++++++-------------- js/ui/status/network.js | 39 +++++++++++++++++++++++++++++++++++----
1 file changed, 42 insertions(+), 17 deletions(-) 1 file changed, 35 insertions(+), 4 deletions(-)
Index: gnome-shell-3.7.3.1/js/ui/status/network.js diff --git a/js/ui/status/network.js b/js/ui/status/network.js
=================================================================== index b7e6bf9..9367a26 100644
--- gnome-shell-3.7.3.1.orig/js/ui/status/network.js --- a/js/ui/status/network.js
+++ gnome-shell-3.7.3.1/js/ui/status/network.js +++ b/js/ui/status/network.js
@@ -5,8 +5,10 @@ const Gio = imports.gi.Gio; @@ -7,6 +7,7 @@ const Gtk = imports.gi.Gtk;
const Lang = imports.lang; const Lang = imports.lang;
const NetworkManager = imports.gi.NetworkManager; const NetworkManager = imports.gi.NetworkManager;
const NMClient = imports.gi.NMClient; const NMClient = imports.gi.NMClient;
+const Polkit = imports.gi.Polkit; +const Polkit = imports.gi.Polkit;
const NMGtk = imports.gi.NMGtk;
const Signals = imports.signals; const Signals = imports.signals;
const St = imports.gi.St; const St = imports.gi.St;
+const System = imports.system; @@ -477,6 +478,11 @@ const NMDeviceBluetooth = new Lang.Class({
Extends: NMConnectionDevice,
category: NMConnectionCategory.WWAN,
const Main = imports.ui.main; + _init: function(client, device, settings, privateConnections) {
const PanelMenu = imports.ui.panelMenu;
@@ -338,13 +340,14 @@ const NMDevice = new Lang.Class({
Abstract: true,
Extends: NMConnectionBased,
- _init: function(client, device, connections) {
+ _init: function(client, device, connections, privateConnections) {
this.device = device;
this.device._delegate = this;
this._stateChangedId = this.device.connect('state-changed', Lang.bind(this, this._deviceStateChanged));
// protected
this._client = client;
+ this._privateConnections = privateConnections; + this._privateConnections = privateConnections;
this.parent(connections); + this.parent(client, device);
this._activeConnection = null; + },
this._activeConnectionItem = null; +
@@ -691,23 +694,26 @@ const NMDeviceWired = new Lang.Class({ _autoConnect: function() {
Name: 'NMDeviceWired', // FIXME: DUN devices are configured like modems, so
Extends: NMDeviceSimple, // We need to spawn the mobile wizard
@@ -485,6 +491,11 @@ const NMDeviceBluetooth = new Lang.Class({
// that this phone supports PAN
- _init: function(client, device, connections) {
+ _init: function(client, device, connections, privateConnections) {
this._autoConnectionName = _("Auto Ethernet");
this.category = NMConnectionCategory.WIRED;
- this.parent(client, device, connections);
+ this.parent(client, device, connections, privateConnections);
},
_createAutomaticConnection: function() {
let connection = new NetworkManager.Connection(); let connection = new NetworkManager.Connection();
let uuid = NetworkManager.utils_uuid_generate(); + if (this._privateConnections) {
connection.add_setting(new NetworkManager.SettingWired()); + let connectionSetting = new NetworkManager.SettingConnection();
- connection.add_setting(new NetworkManager.SettingConnection({
+ let connectionSetting = new NetworkManager.SettingConnection({
uuid: uuid,
id: this._autoConnectionName,
type: NetworkManager.SETTING_WIRED_SETTING_NAME,
autoconnect: true
- }));
+ });
+ if (this._privateConnections)
+ connectionSetting.add_permission('user', GLib.get_user_name(), null); + connectionSetting.add_permission('user', GLib.get_user_name(), null);
+ connection.add_setting(connectionSetting); + connection.add_setting(connectionSetting);
return connection; + }
} this._client.add_and_activate_connection(connection, this._device, null, null);
}); return true;
@@ -716,7 +722,7 @@ const NMDeviceModem = new Lang.Class({
Name: 'NMDeviceModem',
Extends: NMDevice,
- _init: function(client, device, connections) {
+ _init: function(client, device, connections, privateConnections) {
let is_wwan = false;
this._enabled = true;
@@ -763,7 +769,7 @@ const NMDeviceModem = new Lang.Class({
}));
}
- this.parent(client, device, connections);
+ this.parent(client, device, connections, privateConnections);
}, },
@@ -571,11 +582,12 @@ const NMWirelessDialog = new Lang.Class({
Name: 'NMWirelessDialog',
Extends: ModalDialog.ModalDialog,
setEnabled: function(enabled) { - _init: function(client, device, settings) {
@@ -836,25 +842,28 @@ const NMDeviceBluetooth = new Lang.Class + _init: function(client, device, settings, privateConnections) {
Name: 'NMDeviceBluetooth', this.parent({ styleClass: 'nm-dialog' });
Extends: NMDevice,
- _init: function(client, device, connections) { this._client = client;
+ _init: function(client, device, connections, privateConnections) { this._device = device;
this._autoConnectionName = this._makeConnectionName(device); + this._privateConnections = privateConnections;
device.connect('notify::name', Lang.bind(this, this._updateAutoConnectionName));
this.category = NMConnectionCategory.WWAN; this._networks = [];
this._buildLayout();
- this.parent(client, device, connections); @@ -713,6 +725,11 @@ const NMWirelessDialog = new Lang.Class({
+ this.parent(client, device, connections, privateConnections); this._device.get_path(), accessPoints[0].dbus_path]);
}, } else {
let connection = new NetworkManager.Connection();
_createAutomaticConnection: function() { + if (this._privateConnections) {
let connection = new NetworkManager.Connection; + let connectionSetting = new NetworkManager.SettingConnection();
let uuid = NetworkManager.utils_uuid_generate();
connection.add_setting(new NetworkManager.SettingBluetooth);
- connection.add_setting(new NetworkManager.SettingConnection({
+ let connectionSetting = new NetworkManager.SettingConnection({
uuid: uuid,
id: this._autoConnectionName,
type: NetworkManager.SETTING_BLUETOOTH_SETTING_NAME,
autoconnect: false
- }));
+ });
+ if (this._privateConnections)
+ connectionSetting.add_permission('user', GLib.get_user_name(), null); + connectionSetting.add_permission('user', GLib.get_user_name(), null);
+ connection.add_setting(connectionSetting); + connection.add_setting(connectionSetting);
return connection; + }
}, this._client.add_and_activate_connection(connection, this._device, accessPoints[0].dbus_path, null)
}
@@ -893,7 +902,7 @@ const NMDeviceWireless = new Lang.Class( }
@@ -938,10 +955,11 @@ const NMDeviceWireless = new Lang.Class({
Name: 'NMDeviceWireless', Name: 'NMDeviceWireless',
Extends: NMDevice, category: NMConnectionCategory.WIRELESS,
- _init: function(client, device, connections) { - _init: function(client, device, settings) {
+ _init: function(client, device, connections, privateConnections) { + _init: function(client, device, settings, privateConnections) {
this.category = NMConnectionCategory.WIRELESS; this._client = client;
this._device = device;
this._settings = settings;
+ this._privateConnections = privateConnections;
this._overflowItem = null; this._description = '';
@@ -968,7 +977,7 @@ const NMDeviceWireless = new Lang.Class(
this._apAddedId = device.connect('access-point-added', Lang.bind(this, this._accessPointAdded));
this._apRemovedId = device.connect('access-point-removed', Lang.bind(this, this._accessPointRemoved));
- this.parent(client, device, validConnections); @@ -1000,7 +1018,7 @@ const NMDeviceWireless = new Lang.Class({
+ this.parent(client, device, validConnections, privateConnections);
}, },
destroy: function() { _showDialog: function() {
@@ -1411,12 +1420,15 @@ const NMDeviceWireless = new Lang.Class( - this._dialog = new NMWirelessDialog(this._client, this._device, this._settings);
+ this._dialog = new NMWirelessDialog(this._client, this._device, this._settings, this._privateConnections);
let connection = new NetworkManager.Connection(); this._dialog.connect('closed', Lang.bind(this, this._dialogClosed));
connection.add_setting(new NetworkManager.SettingWireless()); this._dialog.open();
- connection.add_setting(new NetworkManager.SettingConnection({
+ let connectionSetting = new NetworkManager.SettingConnection({
id: name,
autoconnect: true, // NetworkManager will know to ignore this if appropriate
uuid: NetworkManager.utils_uuid_generate(),
type: NetworkManager.SETTING_WIRELESS_SETTING_NAME
- }));
+ });
+ if (this._privateConnections)
+ connectionSetting.add_permission('user', GLib.get_user_name(), null);
+ connection.add_setting(connectionSetting);
return connection;
}, },
@@ -1251,6 +1269,19 @@ const NMApplet = new Lang.Class({
@@ -1647,6 +1659,18 @@ const NMApplet = new Lang.Class({ if (!this._client || !this._settings)
return;
this._client = NMClient.Client.new();
+ // Check if newly created connections should be private or not + // Check if newly created connections should be private or not
+ this._privateConnections = true; + this._privateConnections = true;
+ let authority = Polkit.Authority.get_sync(null); + let authority = Polkit.Authority.get_sync(null);
+ let subject = new Polkit.UnixProcess({ pid: System.getpid(), uid: System.getuid() }); + let credential = new Gio.Credentials();
+ let subject = new Polkit.UnixProcess({ pid: credential.get_unix_pid(), uid: credential.get_unix_user() });
+ let authResult = authority.check_authorization_sync(subject, + let authResult = authority.check_authorization_sync(subject,
+ 'org.freedesktop.NetworkManager.settings.modify.system', + 'org.freedesktop.NetworkManager.settings.modify.system',
+ null /* details */, + null /* details */,
@ -179,15 +115,18 @@ Index: gnome-shell-3.7.3.1/js/ui/status/network.js
+ if (authResult) + if (authResult)
+ this._privateConnections = !authResult.get_is_authorized(); + this._privateConnections = !authResult.get_is_authorized();
+ +
this._statusSection = new PopupMenu.PopupMenuSection(); this._activeConnections = [ ];
this._statusItem = new PopupMenu.PopupMenuItem('', { reactive: false }); this._connections = [ ];
this._statusSection.addMenuItem(this._statusItem);
@@ -1830,7 +1854,7 @@ const NMApplet = new Lang.Class({
},
_makeWrapperDevice: function(wrapperClass, device) { @@ -1366,7 +1397,7 @@ const NMApplet = new Lang.Class({
- let wrapper = new wrapperClass(this._client, device, this._connections);
+ let wrapper = new wrapperClass(this._client, device, this._connections, this._privateConnections); let wrapperClass = this._dtypes[device.get_device_type()];
if (wrapperClass) {
- let wrapper = new wrapperClass(this._client, device, this._settings);
+ let wrapper = new wrapperClass(this._client, device, this._settings, this._privateConnections);
device._delegate = wrapper;
this._addDeviceWrapper(wrapper);
--
1.8.1.4
wrapper._activationFailedId = wrapper.connect('activation-failed',
Lang.bind(this, this._onActivationFailed));

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Oct 2 03:47:39 UTC 2013 - glin@suse.com
- Rebase gnome-shell-private-connection.patch (bnc#751211)
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Sep 24 21:51:33 UTC 2013 - dimstar@opensuse.org Tue Sep 24 21:51:33 UTC 2013 - dimstar@opensuse.org

View File

@ -24,7 +24,7 @@ License: GPL-2.0+
Group: System/GUI/GNOME Group: System/GUI/GNOME
Url: http://live.gnome.org/GnomeShell Url: http://live.gnome.org/GnomeShell
Source: http://download.gnome.org/sources/gnome-shell/3.10/%{name}-%{version}.tar.xz Source: http://download.gnome.org/sources/gnome-shell/3.10/%{name}-%{version}.tar.xz
# PATCH-NEEDS-REBASE PATCH-FIX-UPSTREAM gnome-shell-private-connection.patch bnc#751211 bgo#646187 dimstar@opensuse.org -- create private connections if the user is not authorized # PATCH-FIX-UPSTREAM gnome-shell-private-connection.patch bnc#751211 bgo#646187 dimstar@opensuse.org -- create private connections if the user is not authorized
Patch1: gnome-shell-private-connection.patch Patch1: gnome-shell-private-connection.patch
BuildRequires: docbook-xsl-stylesheets BuildRequires: docbook-xsl-stylesheets
BuildRequires: intltool BuildRequires: intltool
@ -134,7 +134,7 @@ to enable, disable and install them.
%lang_package %lang_package
%prep %prep
%setup -q %setup -q
#patch1 -p1 %patch1 -p1
translation-update-upstream translation-update-upstream
%build %build