commit:     7724be2064e7f967ff1678165c514a698d8c526c
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Jun  4 18:02:04 2016 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Jun  4 18:11:15 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7724be20

net-wireless/blueman: include polkit rules for network setup, #584300

Add a set of polkit rules that allow active users belonging to
the plugdev group to perform network setup actions via blueman. This
resembles the rules used by NetworkManager.

Bug: https://bugs.gentoo.org/show_bug.cgi?id=584300

 net-wireless/blueman/blueman-9999.ebuild        |  6 ++++++
 net-wireless/blueman/files/01-org.blueman.rules | 11 +++++++++++
 2 files changed, 17 insertions(+)

diff --git a/net-wireless/blueman/blueman-9999.ebuild 
b/net-wireless/blueman/blueman-9999.ebuild
index 011f2ef..69c82c7 100644
--- a/net-wireless/blueman/blueman-9999.ebuild
+++ b/net-wireless/blueman/blueman-9999.ebuild
@@ -97,6 +97,12 @@ src_configure() {
 src_install() {
        default
 
+       if use policykit; then
+               # Allow users in plugdev group to modify connections
+               insinto /usr/share/polkit-1/rules.d
+               doins "${FILESDIR}/01-org.blueman.rules"
+       fi
+
        python_fix_shebang "${D}"
        rm "${D}"/$(python_get_sitedir)/*.la || die
 }

diff --git a/net-wireless/blueman/files/01-org.blueman.rules 
b/net-wireless/blueman/files/01-org.blueman.rules
new file mode 100644
index 0000000..2f1a2bd
--- /dev/null
+++ b/net-wireless/blueman/files/01-org.blueman.rules
@@ -0,0 +1,11 @@
+// Let users in plugdev group modify network connections using blueman
+polkit.addRule(function(action, subject) {
+    if ((action.id == "org.blueman.network.setup" ||
+         action.id == "org.blueman.dhcp.client" ||
+         action.id == "org.blueman.rfkill.setstate" ||
+         action.id == "org.blueman.pppd.pppconnect") &&
+        subject.isInGroup("plugdev") && subject.active) {
+
+        return polkit.Result.YES;
+    }
+});

Reply via email to