[gnome-control-center] common: Add Policykit rules for hostname setting



commit 4d62e05fb088d64c3133912f0995a42157b8e968
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Aug 22 14:15:04 2012 +0100

    common: Add Policykit rules for hostname setting
    
    Allow setting the computer's pretty hostname if the user is an admin.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=679281

 panels/common/Makefile.am                |    5 +++++
 panels/common/gnome-control-center.rules |    8 ++++++++
 2 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/panels/common/Makefile.am b/panels/common/Makefile.am
index 6ed8e6c..b68a82e 100644
--- a/panels/common/Makefile.am
+++ b/panels/common/Makefile.am
@@ -36,4 +36,9 @@ uidir = $(pkgdatadir)/ui
 dist_ui_DATA = \
 	language-chooser.ui
 
+rulesdir = $(datadir)/polkit-1/rules.d/
+rules_DATA = gnome-control-center.rules
+
+EXTRA_DIST = $(rules_DATA)
+
 -include $(top_srcdir)/git.mk
diff --git a/panels/common/gnome-control-center.rules b/panels/common/gnome-control-center.rules
new file mode 100644
index 0000000..b141312
--- /dev/null
+++ b/panels/common/gnome-control-center.rules
@@ -0,0 +1,8 @@
+polkit.addRule(function(action, subject) {
+	if (action.id == "org.freedesktop.hostname1.set-static-hostname" &&
+	    subject.local &&
+	    subject.active &&
+	    subject.isInGroup ("wheel")) {
+		    return polkit.Result.YES;
+	    }
+});



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