d7d128194dbf40ae5d1e42ccc2cd44d194580877
[clearscm.git] / clients / Ameriquest / triggers / NoPBLs.pl
1 #!/usr/bin/perl
2 ################################################################################
3 #
4 # File:         NoPBLs.pl
5 # Description:  This trigger stops all users except for vobadm and Steve Lipson
6 #               (userid to be specified) from checking in PBLs which are
7 #               PowerBuilder libraries and should never be checked into a vob.
8 #               Why Steve Lipson would want this capability is unknown.
9 #               
10 # Author:       Andrew@DeFaria.com
11 # Created:      May 18, 2004
12 # Language:     Perl
13 # Modifications:
14 #
15 # (c) Copyright 2004, Andrew@DeFaria.com, all rights reserved
16 #
17 ################################################################################
18 use strict;
19 use warnings;
20 use File::Spec;
21
22 # This will be set in the BEGIN block but by putting them here the become
23 # available for the whole script.
24 my (
25   $abs_path,
26   $me,
27   $bin_path,
28   $triggers_path,
29   $lib_path,
30   $log_path,
31   $windows
32 );
33
34 BEGIN {
35   # Extract relative path and basename from script name.
36   $0 =~ /(.*)[\/\\](.*)/;
37
38   $abs_path     = (!defined $1) ? "." : File::Spec->rel2abs ($1);
39   $me           = (!defined $2) ? $0  : $2;
40
41   # Check to see if we are running on Windows
42   $windows      = ($^O =~ /MSWin/) ? "yes" : "no";
43
44   # Setup paths
45   $bin_path             = "$abs_path";
46   $triggers_path        = "$abs_path/../triggers";
47   $lib_path             = "$abs_path/../lib";
48   $log_path             = "$abs_path/../log";
49
50   # Add the appropriate path to our modules to @INC array.
51   unshift (@INC, "$lib_path");
52 } # BEGIN
53
54 use TriggerUtils;
55
56 my $steve_lipson        = "sl020353";
57 my $user                = $ENV {CLEARCASE_USER};
58 my $pname               = $ENV {CLEARCASE_PN};
59
60 if ($pname =~ /\.pbl$/i and lc ($user) !~ $steve_lipson) {
61   clearmsg "Check in's of pbl's are not allowed except for administrators";
62   exit 1;
63 } # if
64
65 exit 0;