Created
April 7, 2016 11:20
-
-
Save djmattyg007/6b5e845ad1140c8a0fa66b64f953bf9a 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