Excerpts from Amit Saha's message of 2013-09-24 17:17:22 +1000:
I noticed that there is no sub-command to list the existing policy
for a system, so
tried writing one [1]. My primary objective is to of course having it as a sub-command,
unless there was another reason other than time that it wasn't added earlier.
The second objective is to use it as the second example in our developer guide
to show how you expose controller methods and write a client to access it.
Example usage:
# bkr policy-list --system beaker-test-vm1 --hub
http://localhost/bkr --username admin
--password foobar
{
"rules": [
{
"everybody": true,
"permission": "control_system",
"group": null,
"id": 1,
"user": null
},
{
"everybody": true,
"permission": "reserve",
"group": null,
"id": 4,
"user": null
}
],
"possible_permissions": [
{
"value": "edit_policy",
. ..
. ..
I like it, my only suggestion would be to accept a --format option like
the other commands. It would have --format=json for machine parsing, and
a tabular/linear format that is friendlier for humans and grepping.
Perhaps --format=text which spits out just a list of rules, one per
line:
Group beakerdevs has permission edit_policy
User asaha has permission reserve
Everybody has permission control_system
The authentication bit is not required I suspect.
Not sure what you mean... No reason to require authentication on the
server side, no.
--
Dan Callaghan <dcallagh(a)redhat.com>
Software Engineer, Infrastructure Engineering and Development
Red Hat, Inc.