[gnome-control-center] common: Make the privileged group configurable (i.e. wheel vs sudo)



commit 43761401833b887818f902c022917a7667064ccd
Author: Robert Ancell <robert ancell canonical com>
Date:   Thu Sep 26 12:31:16 2019 +1200

    common: Make the privileged group configurable (i.e. wheel vs sudo)
    
    Fixes #559

 meson_options.txt                                                 | 1 +
 .../{gnome-control-center.rules => gnome-control-center.rules.in} | 2 +-
 panels/common/meson.build                                         | 8 ++++++--
 3 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/meson_options.txt b/meson_options.txt
index 78efb5885..a899033b0 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -2,6 +2,7 @@ option('cheese', type: 'boolean', value: true, description: 'build with cheese w
 option('documentation', type: 'boolean', value: false, description: 'build documentation')
 option('gnome_session_libexecdir', type: 'string', value: '', description: 'Directory for gnome-session\'s 
libexecdir')
 option('ibus', type: 'boolean', value: true, description: 'build with IBus support')
+option('privileged_group', type: 'string', value: 'wheel', description: 'name of group that has elevated 
permissions')
 option('tests', type: 'boolean', value: true, description: 'build tests')
 option('tracing', type: 'boolean', value: false, description: 'add extra debugging information')
 option('wayland', type: 'boolean', value: true, description: 'build with Wayland support')
diff --git a/panels/common/gnome-control-center.rules b/panels/common/gnome-control-center.rules.in
similarity index 90%
rename from panels/common/gnome-control-center.rules
rename to panels/common/gnome-control-center.rules.in
index 5b3da5db3..971ffac63 100644
--- a/panels/common/gnome-control-center.rules
+++ b/panels/common/gnome-control-center.rules.in
@@ -6,7 +6,7 @@ polkit.addRule(function(action, subject) {
             action.id == "org.gnome.controlcenter.datetime.configure") &&
            subject.local &&
            subject.active &&
-           subject.isInGroup ("wheel")) {
+           subject.isInGroup ("@PRIVILEGED_GROUP@")) {
                    return polkit.Result.YES;
            }
 });
diff --git a/panels/common/meson.build b/panels/common/meson.build
index e0c74d305..fc254b1df 100644
--- a/panels/common/meson.build
+++ b/panels/common/meson.build
@@ -105,8 +105,12 @@ libdevice_dep = declare_dependency(
   link_with: libdevice
 )
 
-install_data(
-  'gnome-control-center.rules',
+polkit_conf = configuration_data()
+polkit_conf.set('PRIVILEGED_GROUP', get_option('privileged_group'))
+configure_file(
+  input: 'gnome-control-center.rules.in',
+  output: 'gnome-control-center.rules',
+  configuration: polkit_conf,
   install_dir: join_paths(control_center_datadir, 'polkit-1', 'rules.d')
 )
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]