----- Original Message -----
From: "Dan Callaghan" <dcallagh(a)redhat.com>
To: "Amit Saha" <asaha(a)redhat.com>
Cc: "Beaker development" <beaker-devel(a)lists.fedorahosted.org>
Sent: Tuesday, September 24, 2013 5:32:52 PM
Subject: Re: [Beaker-devel] New sub-command to list access policy for a system
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
Thanks. Yes, I will try to add that along with a test.
> The authentication bit is not required I suspect.
Not sure what you mean... No reason to require authentication on the
server side, no.
Yes, that's what I meant. The command line arguments --username and --password
are superfluous.
Best,
Amit.
--
Amit Saha <
http://echorand.me>
Infrastructure Engineering and Development
Red Hat, Inc.