source: LMDZ6/branches/Amaury_dev/tools/fcm/sbin/fcm-manage-users @ 5110

Last change on this file since 5110 was 5095, checked in by abarral, 4 months ago

Revert cosp*/ from the trunk, as it's external code
Add missing bits from FCM2 source

  • Property svn:executable set to *
File size: 3.1 KB
Line 
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
21use strict;
22use warnings;
23
24use FindBin;
25use lib "$FindBin::Bin/../lib";
26use 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};
33use FCM::Admin::Util qw{option2config};
34use Getopt::Long qw{GetOptions};
35use Pod::Usage qw{pod2usage};
36
37main();
38
39sub 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
73fcm-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
85Prints help and exits.
86
87=item --svn-live-dir=DIR
88
89Specifies the root location of the live directory of the Subversion
90repositories. See L<FCM::Admin::Config|FCM::Admin::Config> for the current
91default.
92
93=item --svn-passwd-file=FILE
94
95Specifies the base name of the Subversion password file. See
96L<FCM::Admin::Config|FCM::Admin::Config> for the current default.
97
98=item --trac-live-dir=DIR
99
100Specifies the root location of the live directory of the Trac environments. See
101L<FCM::Admin::Config|FCM::Admin::Config> for the current default.
102
103=item --trac-passwd-file=FILE
104
105Specifies the base name of the Trac password file. See
106L<FCM::Admin::Config|FCM::Admin::Config> for the current default.
107
108=back
109
110=head1 DESCRIPTION
111
112This program manages user (login) information for Subversion repositories and
113Trac environments hosted by FCM.
114
115=head1 COPYRIGHT
116
117Copyright (C) 2006-2021 British Crown (Met Office) & Contributors.
118
119=cut
Note: See TracBrowser for help on using the repository browser.