gnome-shell/gnome-shell-private-connection.patch
Dominique Leuenberger e5e7c4b3a2 - Update to version 47.2:
+ Fix graphical artifacts in partially-rounded buttons
  + Fix caret tracking in magnifier
  + Improve accessibility of keyboard backlight quick settings
    toggle
  + Fix resetting non-caps shift key in on-screen keyboard
  + Misc. bug fixes and cleanups
  + Updated translations.

OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gnome-shell?expand=0&rev=596
2024-11-26 13:02:35 +00:00

40 lines
1.9 KiB
Diff

diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index e3b9a5d..3296e1d 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -940,6 +940,11 @@ const WirelessNetwork = GObject.registerClass({
this._getDeviceDBusPath(), ap.get_path());
} else {
conn = new NM.SimpleConnection();
+ if (this._IsPrivateConnections()) {
+ let connectionSetting = new NM.SettingConnection();
+ connectionSetting.add_permission('user', GLib.get_user_name(), null);
+ conn.add_setting(connectionSetting);
+ }
this._device.client.add_and_activate_connection_async(
conn, this._device, ap.get_path(), null, null);
}
@@ -949,6 +954,22 @@ const WirelessNetwork = GObject.registerClass({
this.emit('destroy');
}
+ _IsPrivateConnections() {
+ let 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)
+ privateConnections = !authResult.get_is_authorized();
+
+ return privateConnections;
+ }
+
_getDeviceDBusPath() {
// nm_object_get_path() is shadowed by nm_device_get_path()
return NM.Object.prototype.get_path.call(this._device);