[Beaker-devel] New sub-command to list access policy for a system
Amit Saha
asaha at redhat.com
Wed Sep 25 06:25:34 UTC 2013
----- Original Message -----
> From: "Dan Callaghan" <dcallagh at redhat.com>
> To: "Amit Saha" <asaha at redhat.com>
> Cc: "Beaker development" <beaker-devel at lists.fedorahosted.org>
> Sent: Wednesday, September 25, 2013 3:42:53 PM
> Subject: Re: [Beaker-devel] New sub-command to list access policy for a system
>
> Excerpts from Amit Saha's message of 2013-09-25 15:24:30 +1000:
> > > > 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
> >
> >
> > Considering that the user/group names can and will most likely vary,
> > I used PrettyTable [1] to print the rules (when invoked with
> > --format=list).
> > Example:
> >
> > +------+-------+--------+----------------+
> > | Rule | User | Group | Permission |
> > +------+-------+--------+----------------+
> > | 1 | user7 | None | edit_system |
> > | 2 | user8 | None | control_system |
> > | 3 | None | group9 | control_system |
> > +------+-------+--------+----------------+
> >
> > The patch is here [2].
>
> PrettyTable sounds nifty, I'd never heard of it before.
>
> I'm not sure a table is a good way to represent the rules though. A rule
> applies either to a particular user, a particular group, or everybody.
> The table view doesn't really make that easy to see (especially for the
> "everybody" case) which is why I had suggested just the plain listing of
> rules.
I am going to push this a little further :-).
I made some changes and now the output is:
+------+----------------+--------+---------+-----------+
| Rule | Permission | User | Group | Everybody |
+------+----------------+--------+---------+-----------+
| 1 | edit_system | user10 | X | X |
| 2 | control_system | user11 | X | X |
| 3 | control_system | X | group12 | X |
+------+----------------+--------+---------+-----------+
How do you find it?
--
Amit Saha <http://echorand.me>
Infrastructure Engineering and Development
Red Hat, Inc.
More information about the Beaker-devel
mailing list