Mozilla/CVSROOT/readonlyusers.pl
justdave%bugzilla.org 6735eead66 Add qabld to readonly
git-svn-id: svn://10.0.0.236/trunk@242779 18797224-902f-48f8-a5cc-f745e15eee43
2008-01-09 23:50:38 +00:00

50 lines
1.7 KiB
Perl
Executable File

#!/usr/bin/perl
#
# This is a simple script that forces specified users to
# have read-only access to the CVS repository when using SSH.
# This must be done in a pre-commit check script, as SSH users
# must have an account on the server with access to the repository.
# Returning "0" means the account is allowed to check-in. Any other
# return type will stop the commit from occurring.
#
# Authors: Reed Loden <reed@mozilla.com>
# Aravind Gottipati <aravind@mozilla.com>
#
# To make it work, you need to add the script name to
# CVSROOT/checkoutlist so that the script is checked out correctly
# on the CVS server.
# Also, you need to add a line to your
# CVSROOT/commitinfo file that says something like:
#
# ALL $CVSROOT/CVSROOT/readonlyusers.pl
use strict;
use warnings;
# Hash of read-only users
my %read_only_users = (
'calbld' => 1,
'caminobld' => 1,
'ffxbld' => 1,
'l10nbld' => 1,
'nobody' => 1,
'seabld' => 1,
'stgbld' => 1,
'tbirdbld' => 1,
'qabld' => 1,
'unittest' => 1,
'trybld' => 1,
'xrbld' => 1
);
my $username = $ENV{'CVS_USER'} || getlogin || (getpwuid($<))[0] || 'nobody';
if (exists $read_only_users{$username}) {
print STDERR "The $username account is not permitted to check-in to this CVS repository.\n";
print STDERR "If you think it should be allowed to do so, please contact\n";
print STDERR "the system administrators at sysadmins\@mozilla.org.\n";
exit 1;
}
exit 0;