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.
--
Dan Callaghan <dcallagh(a)redhat.com>
Software Engineer, Infrastructure Engineering and Development
Red Hat, Inc.