[Xfce4-commits] [apps/mousepad] 01/01: Add pkexec policy (Bug #11088)

noreply at xfce.org noreply at xfce.org
Tue Jun 5 01:25:48 CEST 2018


This is an automated email from the git hooks/post-receive script.

a   n   d   r   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/mousepad.

commit 13d1a9541461fe5bcd95f24f230229e56ff7e6d7
Author: Eric Koegel <eric.koegel at gmail.com>
Date:   Sat Aug 30 21:11:04 2014 +0300

    Add pkexec policy (Bug #11088)
    
    This adds a pkexec policy file to mousepad. This way if the user
    of a desktop system wants to use mousepad to edit a file as root
    and has the proper credentials they can.
    pkexec comes from polkit which does about the same thing as
    sudo/gtksu except also supports authentication methods like
    fingerprint or smart card readers.
---
 .gitignore                     |  1 +
 Makefile.am                    | 18 ++++++++++++++++--
 org.xfce.mousepad.policy.in.in | 35 +++++++++++++++++++++++++++++++++++
 po/POTFILES.in                 |  5 +++++
 4 files changed, 57 insertions(+), 2 deletions(-)

diff --git a/.gitignore b/.gitignore
index af552b2..e2234c4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
 *.o
 *.gmo
+*.policy
 Makefile
 Makefile.in
 Makefile.in.in
diff --git a/Makefile.am b/Makefile.am
index 964dd9a..db9d51b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -16,6 +16,17 @@ desktop_in_files = $(desktop_in_in_files:.desktop.in.in=.desktop.in)
 desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
 @INTLTOOL_DESKTOP_RULE@
 
+
+polkit_policydir = $(datadir)/polkit-1/actions
+polkit_in_in_files =			\
+	org.xfce.mousepad.policy.in.in
+polkit_in_files = $(polkit_in_in_files:.policy.in.in=.policy.in)
+%.policy.in: %.policy.in.in
+	sed -e "s,\@bindir\@,$(bindir),g" < $< > $@
+polkit_policy_DATA = $(polkit_in_files:.policy.in=.policy)
+ at INTLTOOL_POLICY_RULE@
+
+
 .PHONY: ChangeLog
 
 ChangeLog: Makefile
@@ -29,13 +40,16 @@ EXTRA_DIST =									\
 	intltool-extract.in							\
 	intltool-merge.in							\
 	intltool-update.in							\
-	$(desktop_in_in_files)
+	$(desktop_in_in_files)						\
+	$(polkit_in_in_files)
 
 DISTCLEANFILES =								\
 	intltool-extract							\
 	intltool-merge								\
 	intltool-update								\
 	$(desktop_in_files)							\
-	$(desktop_DATA)
+	$(desktop_DATA)								\
+	$(polkit_in_files)							\
+	$(polkit_policy_DATA)
 
 # vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
diff --git a/org.xfce.mousepad.policy.in.in b/org.xfce.mousepad.policy.in.in
new file mode 100644
index 0000000..c98ac45
--- /dev/null
+++ b/org.xfce.mousepad.policy.in.in
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE policyconfig PUBLIC
+ "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
+<policyconfig>
+
+  <!--
+ Policy definitions for Mousepad.
+ Copyright (c) 2018 Matthew Brush <mbrush at codebrainz.ca>
+               2018 Andre Miranda <andreldm at xfce.org>
+ -->
+
+ <vendor>Mousepad</vendor>
+ <vendor_url>http://xfce.org/</vendor_url>
+ <icon_name>accessories-text-editor</icon_name>
+
+
+ <action id="org.xfce.mousepad">
+ <!-- SECURITY:
+ - A normal active user can run mousepad without elevated rights. They
+   may wish to modify a file they normally do not have read/write access
+   to. This isn't a good idea, but is common on single user systems.
+ -->
+ <_description>Run Mousepad as root</_description>
+ <_message>Authentication is required to run Mousepad as root.</_message>
+ <defaults>
+ <allow_any>no</allow_any>
+ <allow_inactive>auth_admin</allow_inactive>
+ <allow_active>auth_admin</allow_active>
+ </defaults>
+ <annotate key="org.freedesktop.policykit.exec.path">@bindir@/mousepad</annotate>
+ <annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
+ </action>
+
+</policyconfig>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index e175eb3..d587cca 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -30,3 +30,8 @@ mousepad/mousepad-window.c
 # Desktop Files
 #
 mousepad.desktop.in.in
+
+#
+# Polkit File
+#
+org.xfce.mousepad.policy.in.in

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list