1 | #!/usr/bin/perl |
---|
2 | # ------------------------------------------------------------------------------ |
---|
3 | # (C) Crown copyright Met Office. All rights reserved. |
---|
4 | # For further details please refer to the file COPYRIGHT.txt |
---|
5 | # which you should have received as part of this distribution. |
---|
6 | # ------------------------------------------------------------------------------ |
---|
7 | |
---|
8 | use strict; |
---|
9 | use warnings; |
---|
10 | |
---|
11 | use FindBin; |
---|
12 | use lib "$FindBin::Bin/../lib"; |
---|
13 | use FCM::Admin::System qw{ |
---|
14 | get_projects_from_trac_live |
---|
15 | get_users |
---|
16 | manage_users_in_svn_passwd |
---|
17 | manage_users_in_trac_passwd |
---|
18 | manage_users_in_trac_db_of |
---|
19 | }; |
---|
20 | use FCM::Admin::Util qw{option2config}; |
---|
21 | use Getopt::Long qw{GetOptions}; |
---|
22 | use Pod::Usage qw{pod2usage}; |
---|
23 | |
---|
24 | main(); |
---|
25 | |
---|
26 | sub main { |
---|
27 | my %option; |
---|
28 | my $result = GetOptions( |
---|
29 | \%option, |
---|
30 | q{help|usage|h}, |
---|
31 | q{svn-live-dir=s}, |
---|
32 | q{svn-passwd-file=s}, |
---|
33 | q{trac-live-dir=s}, |
---|
34 | q{trac-passwd-file=s}, |
---|
35 | ); |
---|
36 | if (!$result) { |
---|
37 | pod2usage(1); |
---|
38 | } |
---|
39 | if (exists($option{help})) { |
---|
40 | pod2usage(q{-verbose} => 1); |
---|
41 | } |
---|
42 | if (@ARGV) { |
---|
43 | my $message = sprintf("No argument expected, %d given", scalar(@ARGV)); |
---|
44 | pod2usage({q{-exitval} => 1, q{-message} => $message}); |
---|
45 | } |
---|
46 | option2config(\%option); |
---|
47 | my $user_ref = get_users(); |
---|
48 | manage_users_in_svn_passwd($user_ref); |
---|
49 | manage_users_in_trac_passwd($user_ref); |
---|
50 | my @projects = get_projects_from_trac_live(); |
---|
51 | for my $project (@projects) { |
---|
52 | manage_users_in_trac_db_of($project, $user_ref), |
---|
53 | } |
---|
54 | } |
---|
55 | |
---|
56 | __END__ |
---|
57 | |
---|
58 | =head1 NAME |
---|
59 | |
---|
60 | fcm-manage-users |
---|
61 | |
---|
62 | =head1 SYNOPSIS |
---|
63 | |
---|
64 | fcm-manage-users [OPTIONS] |
---|
65 | |
---|
66 | =head1 OPTIONS |
---|
67 | |
---|
68 | =over 4 |
---|
69 | |
---|
70 | =item --help, -h, --usage |
---|
71 | |
---|
72 | Prints help and exits. |
---|
73 | |
---|
74 | =item --svn-live-dir=DIR |
---|
75 | |
---|
76 | Specifies the root location of the live directory of the Subversion |
---|
77 | repositories. See L<FCM::Admin::Config|FCM::Admin::Config> for the current |
---|
78 | default. |
---|
79 | |
---|
80 | =item --svn-passwd-file=FILE |
---|
81 | |
---|
82 | Specifies the base name of the Subversion password file. See |
---|
83 | L<FCM::Admin::Config|FCM::Admin::Config> for the current default. |
---|
84 | |
---|
85 | =item --trac-live-dir=DIR |
---|
86 | |
---|
87 | Specifies the root location of the live directory of the Trac environments. See |
---|
88 | L<FCM::Admin::Config|FCM::Admin::Config> for the current default. |
---|
89 | |
---|
90 | =item --trac-passwd-file=FILE |
---|
91 | |
---|
92 | Specifies the base name of the Trac password file. See |
---|
93 | L<FCM::Admin::Config|FCM::Admin::Config> for the current default. |
---|
94 | |
---|
95 | =back |
---|
96 | |
---|
97 | =head1 DESCRIPTION |
---|
98 | |
---|
99 | This program manages user (login) information for Subversion repositories and |
---|
100 | Trac environments hosted by FCM. |
---|
101 | |
---|
102 | =head1 COPYRIGHT |
---|
103 | |
---|
104 | E<169> Crown copyright Met Office. All rights reserved. |
---|
105 | |
---|
106 | =cut |
---|