Last change
on this file since 2274 was
1311,
checked in by nanardon, 9 years ago
|
Add an irev column to SQL log
|
-
Property svn:executable set to
*
|
File size:
1.2 KB
|
Line | |
---|
1 | #!/usr/bin/perl |
---|
2 | |
---|
3 | use strict; |
---|
4 | use warnings; |
---|
5 | use LATMOS::Accounts; |
---|
6 | use Getopt::Long; |
---|
7 | use Pod::Usage; |
---|
8 | |
---|
9 | =head1 NAME |
---|
10 | |
---|
11 | la-sql-log - Dislay objects log |
---|
12 | |
---|
13 | =head1 SYNOPSIS |
---|
14 | |
---|
15 | la-edit [options] [obj_id] |
---|
16 | |
---|
17 | =cut |
---|
18 | |
---|
19 | GetOptions( |
---|
20 | 'c|config=s' => \my $config, |
---|
21 | 'b|base=s' => \my $base, |
---|
22 | 'o|object=s' => \my $otype, |
---|
23 | 'help' => sub { pod2usage(0) }, |
---|
24 | ) or pod2usage(); |
---|
25 | |
---|
26 | $otype ||= 'user'; |
---|
27 | |
---|
28 | =head1 OPTIONS |
---|
29 | |
---|
30 | =over 4 |
---|
31 | |
---|
32 | =item -c|--config configdir |
---|
33 | |
---|
34 | Use this configuration directory instead of the default one. |
---|
35 | |
---|
36 | =item -b|--base basename |
---|
37 | |
---|
38 | Query this specific base instead of the default one. |
---|
39 | |
---|
40 | =item -o|object object_type |
---|
41 | |
---|
42 | Query will be performed on this object. Default is the 'User' object. |
---|
43 | |
---|
44 | =back |
---|
45 | |
---|
46 | =cut |
---|
47 | |
---|
48 | my $LA = LATMOS::Accounts->new($config, noacl => 1); |
---|
49 | my $labase = $LA->base($base); |
---|
50 | $labase && $labase->load or die "Cannot load base"; |
---|
51 | $labase->wexported(1); |
---|
52 | |
---|
53 | my @logs = $ARGV[0] |
---|
54 | ? $labase->getobjectlogs($otype, $ARGV[0]) |
---|
55 | : $labase->getlogs(); |
---|
56 | |
---|
57 | foreach(@logs) { |
---|
58 | printf("%s (%d), %s: %s/%s (%d) %s\n", |
---|
59 | $_->{logdate}, |
---|
60 | $_->{irev} || -1, |
---|
61 | $_->{username}, |
---|
62 | $_->{otype}, |
---|
63 | $_->{name}, |
---|
64 | $_->{ikey}, |
---|
65 | $_->{message}, |
---|
66 | ); |
---|
67 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.