summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÁlvaro Peña <alvaropg@gmail.com>2021-11-01 18:15:16 +0000
committerZeeshan Ali <zeenix@gmail.com>2021-11-01 18:15:16 +0000
commit49546446a686f37c434d07ea306afa1a853746c8 (patch)
tree42ce410edbf2f634e62ca8180ef1f7453c750f07
parentbaea01c06d62286e06a8befea95036041e857a46 (diff)
downloadgeoclue-49546446a686f37c434d07ea306afa1a853746c8.tar.gz
mode-manager: Add polkit rule allowing GPS access for Geoclue
-rw-r--r--data/meson.build8
-rw-r--r--data/org.freedesktop.GeoClue2.rules.in7
2 files changed, 15 insertions, 0 deletions
diff --git a/data/meson.build b/data/meson.build
index c189753..a1fc61f 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -58,4 +58,12 @@ if get_option('enable-backend')
configuration: conf,
install_dir: systemd_unit_dir)
endif
+
+ if get_option('modem-gps-source')
+ polkit_dir = join_paths(get_option('datadir'), 'polkit-1', 'rules.d')
+ configure_file(output: 'org.freedesktop.GeoClue2.rules',
+ input: 'org.freedesktop.GeoClue2.rules.in',
+ configuration: conf,
+ install_dir: polkit_dir)
+ endif
endif
diff --git a/data/org.freedesktop.GeoClue2.rules.in b/data/org.freedesktop.GeoClue2.rules.in
new file mode 100644
index 0000000..511e46f
--- /dev/null
+++ b/data/org.freedesktop.GeoClue2.rules.in
@@ -0,0 +1,7 @@
+polkit.addRule(function(action, subject) {
+ if ((action.id == "org.freedesktop.ModemManager1.Device.Control" ||
+ action.id == "org.freedesktop.ModemManager1.Location") &&
+ subject.user == "@dbus_srv_user@") {
+ return polkit.Result.YES;
+ }
+});