[5129] | 1 | #!/usr/bin/perl |
---|
| 2 | # ------------------------------------------------------------------------------ |
---|
| 3 | # Copyright (C) 2006-2021 British Crown (Met Office) & Contributors. |
---|
| 4 | # |
---|
| 5 | # This file is part of FCM, tools for managing and building source code. |
---|
| 6 | # |
---|
| 7 | # FCM is free software: you can redistribute it and/or modify |
---|
| 8 | # it under the terms of the GNU General Public License as published by |
---|
| 9 | # the Free Software Foundation, either version 3 of the License, or |
---|
| 10 | # (at your option) any later version. |
---|
| 11 | # |
---|
| 12 | # FCM is distributed in the hope that it will be useful, |
---|
| 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 15 | # GNU General Public License for more details. |
---|
| 16 | # |
---|
| 17 | # You should have received a copy of the GNU General Public License |
---|
| 18 | # along with FCM. If not, see <http://www.gnu.org/licenses/>. |
---|
| 19 | # ------------------------------------------------------------------------------ |
---|
| 20 | |
---|
| 21 | use strict; |
---|
| 22 | use warnings; |
---|
| 23 | |
---|
| 24 | use FindBin; |
---|
| 25 | use lib "$FindBin::Bin/../lib"; |
---|
| 26 | use FCM::Admin::System qw{ |
---|
| 27 | get_projects_from_trac_live |
---|
| 28 | get_users |
---|
| 29 | manage_users_in_svn_passwd |
---|
| 30 | manage_users_in_trac_passwd |
---|
| 31 | manage_users_in_trac_db_of |
---|
| 32 | }; |
---|
| 33 | use FCM::Admin::Util qw{option2config}; |
---|
| 34 | use Getopt::Long qw{GetOptions}; |
---|
| 35 | use Pod::Usage qw{pod2usage}; |
---|
| 36 | |
---|
| 37 | main(); |
---|
| 38 | |
---|
| 39 | sub main { |
---|
| 40 | my %option; |
---|
| 41 | my $result = GetOptions( |
---|
| 42 | \%option, |
---|
| 43 | q{help|usage|h}, |
---|
| 44 | q{svn-live-dir=s}, |
---|
| 45 | q{svn-passwd-file=s}, |
---|
| 46 | q{trac-live-dir=s}, |
---|
| 47 | q{trac-passwd-file=s}, |
---|
| 48 | ); |
---|
| 49 | if (!$result) { |
---|
| 50 | pod2usage(1); |
---|
| 51 | } |
---|
| 52 | if (exists($option{help})) { |
---|
| 53 | pod2usage(q{-verbose} => 1); |
---|
| 54 | } |
---|
| 55 | if (@ARGV) { |
---|
| 56 | my $message = sprintf("No argument expected, %d given", scalar(@ARGV)); |
---|
| 57 | pod2usage({q{-exitval} => 1, q{-message} => $message}); |
---|
| 58 | } |
---|
| 59 | option2config(\%option); |
---|
| 60 | my $user_ref = get_users(); |
---|
| 61 | manage_users_in_svn_passwd($user_ref); |
---|
| 62 | manage_users_in_trac_passwd($user_ref); |
---|
| 63 | my @projects = get_projects_from_trac_live(); |
---|
| 64 | for my $project (@projects) { |
---|
| 65 | manage_users_in_trac_db_of($project, $user_ref), |
---|
| 66 | } |
---|
| 67 | } |
---|
| 68 | |
---|
| 69 | __END__ |
---|
| 70 | |
---|
| 71 | =head1 NAME |
---|
| 72 | |
---|
| 73 | fcm-manage-users |
---|
| 74 | |
---|
| 75 | =head1 SYNOPSIS |
---|
| 76 | |
---|
| 77 | fcm-manage-users [OPTIONS] |
---|
| 78 | |
---|
| 79 | =head1 OPTIONS |
---|
| 80 | |
---|
| 81 | =over 4 |
---|
| 82 | |
---|
| 83 | =item --help, -h, --usage |
---|
| 84 | |
---|
| 85 | Prints help and exits. |
---|
| 86 | |
---|
| 87 | =item --svn-live-dir=DIR |
---|
| 88 | |
---|
| 89 | Specifies the root location of the live directory of the Subversion |
---|
| 90 | repositories. See L<FCM::Admin::Config|FCM::Admin::Config> for the current |
---|
| 91 | default. |
---|
| 92 | |
---|
| 93 | =item --svn-passwd-file=FILE |
---|
| 94 | |
---|
| 95 | Specifies the base name of the Subversion password file. See |
---|
| 96 | L<FCM::Admin::Config|FCM::Admin::Config> for the current default. |
---|
| 97 | |
---|
| 98 | =item --trac-live-dir=DIR |
---|
| 99 | |
---|
| 100 | Specifies the root location of the live directory of the Trac environments. See |
---|
| 101 | L<FCM::Admin::Config|FCM::Admin::Config> for the current default. |
---|
| 102 | |
---|
| 103 | =item --trac-passwd-file=FILE |
---|
| 104 | |
---|
| 105 | Specifies the base name of the Trac password file. See |
---|
| 106 | L<FCM::Admin::Config|FCM::Admin::Config> for the current default. |
---|
| 107 | |
---|
| 108 | =back |
---|
| 109 | |
---|
| 110 | =head1 DESCRIPTION |
---|
| 111 | |
---|
| 112 | This program manages user (login) information for Subversion repositories and |
---|
| 113 | Trac environments hosted by FCM. |
---|
| 114 | |
---|
| 115 | =head1 COPYRIGHT |
---|
| 116 | |
---|
| 117 | Copyright (C) 2006-2021 British Crown (Met Office) & Contributors. |
---|
| 118 | |
---|
| 119 | =cut |
---|