PolicyKit and/or pkcheck allow the app to supply multiple key,value detail pairs when checking an action eg pkcheck --process 12345 --actionid org.libvirt.connection.open --detail virt kvm The intent is to allow the administrator to configure policy for actions that varies according to the virtualization type (kvm, lxc, xen, etc). The man page 'polkit' gives info about how to check action id values and subjects in the javascript authority. It provides no information about how to access the 'detail' key,value pairs passed in along with the value.
After looking at the source code I found the following syntax works action._detail_<key> eg if (action.id == "org.libvirt.connection.open" && action._detail_virt == "kvm") { return polkit.Result.YES; } Could some examples of this be added to the man pages. Also given this syntax, I'm guessing there are some restrictions on the format of valid detail key names. eg using a hyphen in the detail key name would appear lead to invalid token names in the javascript action._detail_key-name, as would a period and other kinds of punctuation
> The Action type > The action parameter passed to user functions is an object with > information about the action being checked. It is of type Action and > has the following attribute: ... > string lookup(string key); > > The lookup() method is used to lookup the polkit variables passed from > the mechanism. For example, the pkexec(1) mechanism sets the variable > program which can be obtained in Javascript using the expression > action.lookup("program"). If there is no value for the given key, then > undefined is returned. Could probably be clarified a bit.
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/polkit/polkit/issues/60.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.