1 Description: Set new wireless connections as user-owned
2 Set connections and passwords as user-owned, following matching changes in
3 nm-applet and gnome-control-center. The logic is
4 - Wired connections: always system-owned.
5 - Modem (GSM/UMTS) connections are created by the control center.
6 - Bluetooth PAN connections are now always user-owned.
7 - Wireless connections are system-owned if the user has
8 permissions (in Debian this means group sudo or netdev). Otherwise,
9 it is user-owned, with the password in the keyring only for WPA.
10 - 802.1x (wired or wireless) is always handled by the control center.
11 Author: Josselin Mouette <joss@debian.org>
14 Last-Update: 2013-05-16
16 --- a/files/usr/share/cinnamon/applets/network@cinnamon.org/applet.js
17 +++ b/files/usr/share/cinnamon/applets/network@cinnamon.org/applet.js
19 this._init.apply(this, arguments);
22 +function default_to_private_connections(client) {
23 + let perms = client.get_permission_result (NMClient.ClientPermission.SETTINGS_MODIFY_SYSTEM);
24 + return (perms != NMClient.ClientPermissionResult.YES);
27 NMNetworkMenuItem.prototype = {
28 __proto__: PopupMenu.PopupBaseMenuItem.prototype,
31 let connection = new NetworkManager.Connection;
32 connection._uuid = NetworkManager.utils_uuid_generate();
33 connection.add_setting(new NetworkManager.SettingBluetooth);
34 - connection.add_setting(new NetworkManager.SettingConnection({
35 + let setting_conn = new NetworkManager.SettingConnection({
36 uuid: connection._uuid,
37 id: this._autoConnectionName,
38 type: NetworkManager.SETTING_BLUETOOTH_SETTING_NAME,
42 + setting_conn.add_permission('user', GLib.get_user_name(), null);
43 + connection.add_setting(setting_conn);
48 this._overflowItem = null;
51 + this._client = client;
53 // breaking the layers with this, but cannot call
54 // this.connectionValid until I have a device
56 @@ -1520,12 +1529,27 @@
58 let connection = new NetworkManager.Connection();
59 connection.add_setting(new NetworkManager.SettingWireless());
60 - connection.add_setting(new NetworkManager.SettingConnection({
61 + let setting_conn = new NetworkManager.SettingConnection({
63 autoconnect: true, // NetworkManager will know to ignore this if appropriate
64 uuid: NetworkManager.utils_uuid_generate(),
65 type: NetworkManager.SETTING_WIRELESS_SETTING_NAME
68 + if (default_to_private_connections(this._client)) {
69 + setting_conn.add_permission('user', GLib.get_user_name(), null);
70 + if (apObj.security == NMAccessPointSecurity.WPA2_PSK ||
71 + apObj.security == NMAccessPointSecurity.WPA_PSK) {
72 + connection.add_setting(new NetworkManager.SettingWirelessSecurity({
73 + psk_flags: NetworkManager.SettingSecretFlags.AGENT_OWNED
76 + if (apObj.security == NMAccessPointSecurity.WEP) {
77 + connection.add_setting(new NetworkManager.SettingWirelessSecurity({
78 + wep_key_flags: NetworkManager.SettingSecretFlags.AGENT_OWNED
82 + connection.add_setting(setting_conn);