New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
fcm-manage-trac-env-session in vendors/sbin – NEMO

source: vendors/sbin/fcm-manage-trac-env-session @ 10669

Last change on this file since 10669 was 10669, checked in by nicolasmartin, 5 years ago

Import latest FCM release from Github into the repository for testing

File size: 2.4 KB
Line 
1#!/usr/bin/perl
2# ------------------------------------------------------------------------------
3# (C) British Crown Copyright 2006-17 Met Office.
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    filter_projects
28    get_projects_from_trac_live
29    get_users
30    manage_users_in_trac_db_of
31};
32use FCM::Admin::Util qw{option2config};
33use Getopt::Long qw{GetOptions};
34use Pod::Usage qw{pod2usage};
35
36if (!caller()) {
37    main(@ARGV);
38}
39
40sub main {
41    local(@ARGV) = @_;
42    my %option;
43    my $result = GetOptions(
44        \%option,
45        q{help|usage|h},
46        q{trac-live-dir=s},
47    );
48    if (!$result) {
49        pod2usage(1);
50    }
51    if (exists($option{help})) {
52        pod2usage(q{-verbose} => 1);
53    }
54    option2config(\%option);
55    my $user_ref = get_users();
56    for my $project (filter_projects([get_projects_from_trac_live()], \@ARGV)) {
57        manage_users_in_trac_db_of($project, $user_ref),
58    }
59}
60
61__END__
62
63=head1 NAME
64
65fcm-manage-trac-env-session
66
67=head1 SYNOPSIS
68
69    fcm-manage-trac-env-session [OPTIONS] [PROJECT ...]
70
71=head1 OPTIONS
72
73=over 4
74
75=item --help, -h, --usage
76
77Prints help and exits.
78
79=item --trac-live-dir=DIR
80
81Specifies the root location of the live directory of the Trac environments. See
82L<FCM::Admin::Config|FCM::Admin::Config> for the current default.
83
84=back
85
86=head1 DESCRIPTION
87
88This program manages session and session attributes for authenticated users in
89Trac environments. If no PROJECT is specified, the program acts on all trac
90environments in the live directory.
91
92=head1 COPYRIGHT
93
94E<169> Crown copyright Met Office. All rights reserved.
95
96=cut
Note: See TracBrowser for help on using the repository browser.