aboutsummaryrefslogtreecommitdiff
path: root/data/50-org.Arctica-Project.arctica-greeter.rules
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2024-06-11 17:25:15 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2024-06-11 17:25:17 +0200
commitc14dee80912b7c1a75bc18b2e5fa83469928a323 (patch)
treea77de3328525d9a4bce4f8215aceda3a31bfa583 /data/50-org.Arctica-Project.arctica-greeter.rules
parentf6ae4a30dc67f473dad62f13df5950c672451913 (diff)
downloadarctica-greeter-c14dee80912b7c1a75bc18b2e5fa83469928a323.tar.gz
arctica-greeter-c14dee80912b7c1a75bc18b2e5fa83469928a323.tar.bz2
arctica-greeter-c14dee80912b7c1a75bc18b2e5fa83469928a323.zip
data/50-org.Arctica-Project.arctica-greeter.rules: Make file better readable.
Ported from unity-greeter on Launchpad.
Diffstat (limited to 'data/50-org.Arctica-Project.arctica-greeter.rules')
-rw-r--r--data/50-org.Arctica-Project.arctica-greeter.rules95
1 files changed, 64 insertions, 31 deletions
diff --git a/data/50-org.Arctica-Project.arctica-greeter.rules b/data/50-org.Arctica-Project.arctica-greeter.rules
index b194628..fff4af1 100644
--- a/data/50-org.Arctica-Project.arctica-greeter.rules
+++ b/data/50-org.Arctica-Project.arctica-greeter.rules
@@ -1,33 +1,66 @@
-polkit.addRule (function (action, subject) {
- if (subject.user == "lightdm") {
- switch (action.id) {
- // Disable Controlling of Network Devices
- case 'org.freedesktop.NetworkManager.enable-disable-network':
- case 'org.freedesktop.NetworkManager.enable-disable-wifi':
- case 'org.freedesktop.NetworkManager.enable-disable-wwan':
- case 'org.freedesktop.NetworkManager.enable-disable-wimax':
- // Disable Sleep and Wake
- case 'org.freedesktop.NetworkManager.sleep-wake':
- // Disable WiFi Sharing
- case 'org.freedesktop.NetworkManager.wifi.share.protected':
- case 'org.freedesktop.NetworkManager.wifi.share.open':
- // Disable Settings Modifications
- case 'org.freedesktop.NetworkManager.settings.modify.own':
- case 'org.freedesktop.NetworkManager.settings.modify.system':
- case 'org.freedesktop.NetworkManager.settings.modify.hostname':
- // Disable User Connections
- case 'org.freedesktop.NetworkManager.use-user-connections':
- // Enable Controlling of Network Connections
- case 'org.freedesktop.NetworkManager.network-control':
- return polkit.Result.NO;
- break;
- default:
- /*
- * Do nothing... for now.
- *
- * This means that polkit will continue scanning for other rules.
- */
- break;
+// Disable Controlling of Network Devices
+polkit.addRule(function(action, subject) {
+ if (subject.user !== 'lightdm')
+ return undefined;
+
+ if (action.id == "org.freedesktop.NetworkManager.enable-disable-network" ||
+ action.id == "org.freedesktop.NetworkManager.enable-disable-wifi" ||
+ action.id == "org.freedesktop.NetworkManager.enable-disable-wwan" ||
+ action.id == "org.freedesktop.NetworkManager.enable-disable-wimax") {
+ return polkit.Result.NO;
+ }
+});
+
+// Disable Sleep and Wake
+polkit.addRule(function(action, subject) {
+ if (subject.user !== 'lightdm')
+ return undefined;
+
+ if (action.id == "org.freedesktop.NetworkManager.sleep-wake") {
+ return polkit.Result.NO;
+ }
+});
+
+// Disable WiFi Sharing
+polkit.addRule(function(action, subject) {
+ if (subject.user !== 'lightdm')
+ return undefined;
+
+ if ((action.id == "org.freedesktop.NetworkManager.wifi.share.protected" ||
+ action.id == "org.freedesktop.NetworkManager.wifi.share.open")) {
+ return polkit.Result.NO;
+ }
+});
+
+// Disable Settings Modifications
+polkit.addRule(function(action, subject) {
+ if (subject.user !== 'lightdm')
+ return undefined;
+
+ if (action.id == "org.freedesktop.NetworkManager.settings.modify.own" ||
+ action.id == "org.freedesktop.NetworkManager.settings.modify.system" ||
+ action.id == "org.freedesktop.NetworkManager.settings.modify.hostname") {
+ return polkit.Result.NO;
+ }
+});
+
+// Disable User Connections
+polkit.addRule(function(action, subject) {
+ if (subject.user !== 'lightdm')
+ return undefined;
+
+ if (action.id == "org.freedesktop.NetworkManager.use-user-connections") {
+ return polkit.Result.NO;
+ }
+});
+
+// Enable Controlling of Network Connections
+polkit.addRule(function(action, subject) {
+ if (subject.user !== 'lightdm')
+ return undefined;
+
+ if (action.id.match("org.freedesktop.NetworkManager.network-control") &&
+ subject.active == true) {
+ return polkit.Result.YES;
}
- }
});