2019-04-18 13:50:39 +00:00
|
|
|
From 342795440012a216d4abb9cfb04d2c3bd0fe8f4d Mon Sep 17 00:00:00 2001
|
2012-06-29 08:51:24 +00:00
|
|
|
From: Giovanni Campagna <gcampagna@src.gnome.org>
|
|
|
|
Date: Thu, 31 Mar 2011 15:56:13 +0200
|
2019-10-04 15:46:38 +00:00
|
|
|
Subject: [PATCH] NetworkMenu: create private connections if the user is not authorized
|
2012-06-29 08:51:24 +00:00
|
|
|
|
|
|
|
Check polkit setting at startup and add, if needed, the "permissions"
|
|
|
|
setting to the connections we create, so that polkit authentication is
|
|
|
|
never needed. The connection is thus only available to other users
|
|
|
|
if the system administrator decides so.
|
|
|
|
|
|
|
|
https://bugzilla.gnome.org/show_bug.cgi?id=646187
|
|
|
|
---
|
2019-04-18 13:50:39 +00:00
|
|
|
js/ui/status/network.js | 38 ++++++++++++++++++++++++++++++++------
|
|
|
|
1 file changed, 32 insertions(+), 6 deletions(-)
|
2012-06-29 08:51:24 +00:00
|
|
|
|
2019-10-04 15:46:38 +00:00
|
|
|
Index: gnome-shell-3.34.0+94/js/ui/status/network.js
|
|
|
|
===================================================================
|
|
|
|
--- gnome-shell-3.34.0+94.orig/js/ui/status/network.js
|
|
|
|
+++ gnome-shell-3.34.0+94/js/ui/status/network.js
|
|
|
|
@@ -1,6 +1,6 @@
|
2019-04-18 13:50:39 +00:00
|
|
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
2019-10-04 15:46:38 +00:00
|
|
|
/* exported NMApplet */
|
2019-04-18 13:50:39 +00:00
|
|
|
-const { Clutter, Gio, GLib, GObject, NM, St } = imports.gi;
|
|
|
|
+const { Clutter, Gio, GLib, GObject, NM, St, Polkit } = imports.gi;
|
2012-06-29 08:51:24 +00:00
|
|
|
const Signals = imports.signals;
|
2019-04-18 13:50:39 +00:00
|
|
|
|
2019-10-04 15:46:38 +00:00
|
|
|
const Animation = imports.ui.animation;
|
|
|
|
@@ -326,6 +326,11 @@ var NMConnectionDevice = class NMConnect
|
2014-10-05 17:36:35 +00:00
|
|
|
|
2018-03-09 10:05:57 +00:00
|
|
|
_autoConnect() {
|
|
|
|
let connection = new NM.SimpleConnection();
|
|
|
|
+ if (this._privateConnections) {
|
|
|
|
+ let connectionSetting = new NM.SettingConnection();
|
|
|
|
+ connectionSetting.add_permission('user', GLib.get_user_name(), null);
|
|
|
|
+ connection.add_setting(connectionSetting);
|
2019-10-04 15:46:38 +00:00
|
|
|
+ }
|
2018-03-09 10:05:57 +00:00
|
|
|
this._client.add_and_activate_connection_async(connection, this._device, null, null, null);
|
2019-04-18 13:50:39 +00:00
|
|
|
}
|
2014-10-05 17:36:35 +00:00
|
|
|
|
2019-10-04 15:46:38 +00:00
|
|
|
@@ -462,10 +467,11 @@ var NMConnectionDevice = class NMConnect
|
2019-04-18 13:50:39 +00:00
|
|
|
};
|
2013-10-07 08:46:47 +00:00
|
|
|
|
2019-04-18 13:50:39 +00:00
|
|
|
var NMDeviceWired = class extends NMConnectionDevice {
|
|
|
|
- constructor(client, device) {
|
|
|
|
+ constructor(client, device, privateConnections) {
|
|
|
|
super(client, device);
|
2013-10-17 10:31:42 +00:00
|
|
|
|
2018-03-09 10:05:57 +00:00
|
|
|
this.item.menu.addSettingsAction(_("Wired Settings"), 'gnome-network-panel.desktop');
|
2013-10-07 08:46:47 +00:00
|
|
|
+ this._privateConnections = privateConnections;
|
2019-04-18 13:50:39 +00:00
|
|
|
}
|
2013-10-17 10:31:42 +00:00
|
|
|
|
2019-04-18 13:50:39 +00:00
|
|
|
get category() {
|
2019-10-04 15:46:38 +00:00
|
|
|
@@ -682,11 +688,12 @@ var NMWirelessDialogItem = GObject.regis
|
2012-06-29 08:51:24 +00:00
|
|
|
|
2019-10-04 15:46:38 +00:00
|
|
|
var NMWirelessDialog = GObject.registerClass(
|
|
|
|
class NMWirelessDialog extends ModalDialog.ModalDialog {
|
|
|
|
- _init(client, device) {
|
|
|
|
+ _init(client, device, privateConnections) {
|
|
|
|
super._init({ styleClass: 'nm-dialog' });
|
2012-06-29 08:51:24 +00:00
|
|
|
|
2013-10-07 08:46:47 +00:00
|
|
|
this._client = client;
|
|
|
|
this._device = device;
|
2017-11-06 10:52:56 +00:00
|
|
|
+ this._privateConnections = privateConnections;
|
2012-06-29 08:51:24 +00:00
|
|
|
|
2014-10-05 17:36:35 +00:00
|
|
|
this._wirelessEnabledChangedId = this._client.connect('notify::wireless-enabled',
|
2018-03-09 10:05:57 +00:00
|
|
|
this._syncView.bind(this));
|
2019-10-04 15:46:38 +00:00
|
|
|
@@ -917,6 +924,11 @@ class NMWirelessDialog extends ModalDial
|
Accepting request 643026 from GNOME:Next
- Update to version 3.30.1:
+ Cancel search on overview hiding (glgo#GNOME/gnome-shell!205).
+ Fix disappearing network icon (glgo#GNOME/gnome-shell#140).
+ Improve switch-monitor shortcut handling
(glgo#GNOME/gnome-shell!208).
+ Fix missing key information in keyring dialog
(glgo#GNOME/gnome-shell#574).
+ De-duplicate all entries in run command history
(glgo#GNOME/gnome-shell#524).
+ Fix frozen disk unlock dialogs (glgo#GNOME/gnome-shell#565).
+ Fix unresponsive-app dialog blocking input in other windows
(glgo#GNOME/gnome-shell#273).
+ Fix handling of forward-key-event input method signal
(glgo#GNOME/gnome-shell#531).
+ Misc. bug fixes: glgo#GNOME/gnome-shell#520, bgo#791233,
glgo#GNOME/gnome-shell!188, glgo#GNOME/gnome-shell#539,
glgo#GNOME/gnome-shell!217, glgo#GNOME/gnome-shell#536,
glgo#GNOME/gnome-shell#537, glgo#GNOME/gnome-shell#578,
glgo#GNOME/gnome-shell!236, glgo#GNOME/gnome-shell#579,
glgo#GNOME/gnome-shell!228, glgo#GNOME/gnome-shell#618,
glgo#GNOME/gnome-shell#471, glgo#GNOME/gnome-shell!255.
+ Updated translations.
- Rebase patches with quilt.
OBS-URL: https://build.opensuse.org/request/show/643026
OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gnome-shell?expand=0&rev=374
2018-10-22 13:22:55 +00:00
|
|
|
this._device.get_path(), accessPoints[0].get_path()]);
|
2013-10-07 08:46:47 +00:00
|
|
|
} else {
|
2018-03-09 10:05:57 +00:00
|
|
|
let connection = new NM.SimpleConnection();
|
2013-10-07 08:46:47 +00:00
|
|
|
+ if (this._privateConnections) {
|
2018-03-09 10:05:57 +00:00
|
|
|
+ let connectionSetting = new NM.SettingConnection();
|
2013-10-07 08:46:47 +00:00
|
|
|
+ connectionSetting.add_permission('user', GLib.get_user_name(), null);
|
|
|
|
+ connection.add_setting(connectionSetting);
|
|
|
|
+ }
|
2019-10-04 15:46:38 +00:00
|
|
|
this._client.add_and_activate_connection_async(connection, this._device, accessPoints[0].get_path(), null, null);
|
2013-10-07 08:46:47 +00:00
|
|
|
}
|
|
|
|
}
|
2019-10-04 15:46:38 +00:00
|
|
|
@@ -1153,9 +1165,10 @@ class NMWirelessDialog extends ModalDial
|
|
|
|
});
|
2018-10-23 05:48:40 +00:00
|
|
|
|
2019-04-18 13:50:39 +00:00
|
|
|
var NMDeviceWireless = class {
|
|
|
|
- constructor(client, device) {
|
|
|
|
+ constructor(client, device, privateConnections) {
|
2018-10-23 05:48:40 +00:00
|
|
|
this._client = client;
|
|
|
|
this._device = device;
|
|
|
|
+ this._privateConnections = privateConnections;
|
|
|
|
|
|
|
|
this._description = '';
|
|
|
|
|
2019-10-04 15:46:38 +00:00
|
|
|
@@ -1241,7 +1254,7 @@ var NMDeviceWireless = class {
|
2019-04-18 13:50:39 +00:00
|
|
|
}
|
2018-10-23 05:48:40 +00:00
|
|
|
|
|
|
|
_showDialog() {
|
|
|
|
- this._dialog = new NMWirelessDialog(this._client, this._device);
|
|
|
|
+ this._dialog = new NMWirelessDialog(this._client, this._device, this._privateConnections);
|
|
|
|
this._dialog.connect('closed', this._dialogClosed.bind(this));
|
|
|
|
this._dialog.open();
|
2019-04-18 13:50:39 +00:00
|
|
|
}
|
2019-10-04 15:46:38 +00:00
|
|
|
@@ -1616,6 +1629,19 @@ var NMApplet = class extends PanelMenu.S
|
|
|
|
|
2018-10-23 05:48:40 +00:00
|
|
|
_clientGot(obj, result) {
|
|
|
|
this._client = NM.Client.new_finish(result);
|
2019-10-04 15:46:38 +00:00
|
|
|
+
|
2018-10-23 05:48:40 +00:00
|
|
|
+ // Check if newly created connections should be private or not
|
|
|
|
+ this._privateConnections = true;
|
|
|
|
+ let authority = Polkit.Authority.get_sync(null);
|
|
|
|
+ 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,
|
|
|
|
+ 'org.freedesktop.NetworkManager.settings.modify.system',
|
|
|
|
+ null /* details */,
|
|
|
|
+ Polkit.CheckAuthorizationFlags.NONE,
|
|
|
|
+ null /* cancellable */);
|
|
|
|
+ if (authResult)
|
|
|
|
+ this._privateConnections = !authResult.get_is_authorized();
|
2019-10-04 15:46:38 +00:00
|
|
|
|
|
|
|
this._activeConnections = [];
|
|
|
|
this._connections = [];
|
|
|
|
@@ -1736,7 +1762,7 @@ var NMApplet = class extends PanelMenu.S
|
2018-10-23 05:48:40 +00:00
|
|
|
|
|
|
|
let wrapperClass = this._dtypes[device.get_device_type()];
|
|
|
|
if (wrapperClass) {
|
|
|
|
- let wrapper = new wrapperClass(this._client, device);
|
|
|
|
+ let wrapper = new wrapperClass(this._client, device, this._privateConnections);
|
|
|
|
device._delegate = wrapper;
|
|
|
|
this._addDeviceWrapper(wrapper);
|
2019-10-04 15:46:38 +00:00
|
|
|
|