Patchwork [meta-gnome/meta-oe/meta-xfce/V2,14/20] polkit-group-rule-network: initial add

login
register
mail settings
Submitter Andreas Müller
Date June 19, 2013, 5:29 p.m.
Message ID <1371662967-31734-15-git-send-email-schnitzeltony@googlemail.com>
Download mbox | patch
Permalink /patch/52059/
State Accepted
Commit 2ae8dbddf8385850a1526289b256c545736d4d8b
Headers show

Comments

Andreas Müller - June 19, 2013, 5:29 p.m.
add user-group 'network' allowing memebers to change networkmanager settings

Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
---
 .../files/50-org.freedesktop.NetworkManager.rules  |    8 ++++++++
 .../polkit/polkit-group-rule-network.bb            |   14 ++++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)
 create mode 100644 meta-oe/recipes-extended/polkit/files/50-org.freedesktop.NetworkManager.rules
 create mode 100644 meta-oe/recipes-extended/polkit/polkit-group-rule-network.bb

Patch

diff --git a/meta-oe/recipes-extended/polkit/files/50-org.freedesktop.NetworkManager.rules b/meta-oe/recipes-extended/polkit/files/50-org.freedesktop.NetworkManager.rules
new file mode 100644
index 0000000..4b50cf8
--- /dev/null
+++ b/meta-oe/recipes-extended/polkit/files/50-org.freedesktop.NetworkManager.rules
@@ -0,0 +1,8 @@ 
+/* give group 'network' rights to change settings */
+/* taken from https://wiki.archlinux.org/index.php/NetworkManager#Set_up_PolicyKit_permissions */
+
+polkit.addRule(function(action, subject) {
+  if (action.id.indexOf("org.freedesktop.NetworkManager.") == 0 && subject.isInGroup("network")) {
+    return polkit.Result.YES;
+  }
+});
diff --git a/meta-oe/recipes-extended/polkit/polkit-group-rule-network.bb b/meta-oe/recipes-extended/polkit/polkit-group-rule-network.bb
new file mode 100644
index 0000000..bba1136
--- /dev/null
+++ b/meta-oe/recipes-extended/polkit/polkit-group-rule-network.bb
@@ -0,0 +1,14 @@ 
+DESCRIPTION = "Create usergroup network. All members off this group are allowed to modify networkmanager settings"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58"
+
+require polkit-group-rule.inc
+
+SRC_URI = "file://50-org.freedesktop.NetworkManager.rules"
+
+do_install() {
+        install -m 0755 ${WORKDIR}/50-org.freedesktop.NetworkManager.rules ${D}${sysconfdir}/polkit-1/rules.d
+}
+
+USERADD_PACKAGES = "${PN}"
+GROUPADD_PARAM_${PN} = "--system network"