Subject: [PATCH] community/modemmanager: rewrite polkit rules

From: Martijn Braam <[email-masked]>
Date: Sun, 9 Feb 2020 19:16:01 +0100

Rewrite polkit rules to no longer use a regex but use seperate string
comparisons instead. This brings it in line with the
gnome-control-center rules.
---
 community/modemmanager/APKBUILD           | 4 ++--
 community/modemmanager/modemmanager.rules | 5 ++++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/community/modemmanager/APKBUILD b/community/modemmanager/APKBUILD
index f60d08fd7e..0e45787415 100644
--- a/community/modemmanager/APKBUILD
+++ b/community/modemmanager/APKBUILD
@@ -2,7 +2,7 @@
 # Maintainer: Stuart Cardall <[email-masked]>
 pkgname=modemmanager
 pkgver=1.12.4
-pkgrel=0
+pkgrel=1
 pkgdesc="ModemManager library"
 url="http://www.freedesktop.org/wiki/Software/ModemManager"
 arch="all"
@@ -69,5 +69,5 @@ check() {
 }
 
 sha512sums="a0eb87e16ea32b8c0646667787ca8c88bf16a589d858fb134b814d7352ac9c84925ec168eaa49257e79ccd8b5d7cfe6cc5add8369e524ea14d88982a5b00fc8a  ModemManager-1.12.4.tar.xz
-3c76ee577334e25c836857f8e7fef6a249cdd9fcd8f889cb64d9c1667bc6a95c087267a153bddd1a13256c59f8cd578ccb448e6b9cb54b73bb74acb8a0ca1e3f  modemmanager.rules
+8d736f477649e42c05b34ac55391353c7f0c17138d039e049b16b07624d86fd9968ef1aa14672a63decf8b2c0ae984a34a0770322198b326775efba58f566685  modemmanager.rules
 e2769401c52c3fff0b8057c13c6f7f2e5656c2963239ecbd647a01e66a344f6852cf2ba065358248315945bdf6ebbc4976903565b12ace2d15df6586dcc1de5b  modemmanager.initd"
diff --git a/community/modemmanager/modemmanager.rules b/community/modemmanager/modemmanager.rules
index 09e586e642..6b4a95fbc8 100644
--- a/community/modemmanager/modemmanager.rules
+++ b/community/modemmanager/modemmanager.rules
@@ -1,6 +1,9 @@
 // Let users in plugdev group modify ModemManager
 polkit.addRule(function(action, subject) {
-    if (/^org\.freedesktop\.ModemManager1\.(Device\.Control|Contacts|Messaging|Location)$/.test(action.id) &&
+    if ((action.id == "org.freedesktop.ModemManager1.Device.Control" ||
+	action.id == "org.freedesktop.ModemManager1.Contacts" ||
+	action.id == "org.freedesktop.ModemManager1.Messaging" ||
+	action.id == "org.freedesktop.ModemManager1.Location") &&
         subject.isInGroup("plugdev") && subject.active) {
         return "yes";
     }
-- 
2.24.1