Forked from djmattyg007/gist:6b5e845ad1140c8a0fa66b64f953bf9a
Created
January 30, 2017 14:20
-
-
Save nvgoldin/c040ec0ebfa143dcf523939e5a8475c9 to your computer and use it in GitHub Desktop.
Example of allowing management of individual systemd units with polkit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
polkit.addRule(function(action, subject) { | |
if (action.id == "org.freedesktop.systemd1.manage-units") { | |
if (action.lookup("unit") == "myservice.service") { | |
var verb = action.lookup("verb"); | |
if (verb == "start" || verb == "stop" || verb == "restart") { | |
return polkit.Result.YES; | |
} | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment