Skip to content

Commit

Permalink
feat[close #33]: Add polkit rules for Apx (dbox and podman)
Browse files Browse the repository at this point in the history
  • Loading branch information
mirkobrombin committed Jan 2, 2024
1 parent 2cd4f19 commit ab0a06e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<vendor>Vanilla OS</vendor>
<vendor_url>https://www.vanillaos.org/</vendor_url>
<icon_name>package-x-generic</icon_name>

<action id="org.vanillaos.vso.sys-upgrade">
<description>Check for system package updates</description>
<message>Authentication is required to check for updates</message>
Expand All @@ -19,4 +18,26 @@
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/vso</annotate>
<annotate key="org.freedesktop.policykit.exec.argv1">sys-upgrade</annotate>
</action>
</policyconfig>
<action id="org.vanillaos.vso.distrobox">
<description>Manager privileged containers</description>
<message>Authentication is required to manage privileged containers</message>
<icon_name>package-x-generic</icon_name>
<defaults>
<allow_any>auth_admin</allow_any>
<allow_inactive>auth_admin</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/usr/share/apx/distrobox/distrobox</annotate>
</action>
<action id="org.vanillaos.vso.podman">
<description>Manager privileged containers</description>
<message>Authentication is required to manage privileged containers</message>
<icon_name>package-x-generic</icon_name>
<defaults>
<allow_any>auth_admin</allow_any>
<allow_inactive>auth_admin</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/podman</annotate>
</action>
</policyconfig>
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
polkit.addRule(function (action, subject) {
if (
action.id == "org.vanillaos.vso.sys-upgrade" &&
(
action.id == "org.vanillaos.vso.sys-upgrade" ||
action.id == "org.vanillaos.vso.distrobox" ||
action.id == "org.vanillaos.vso.podman"
) &&
subject.isInGroup("sudo")
) {
polkit.log("action=" + action);
Expand Down

0 comments on commit ab0a06e

Please sign in to comment.