2012-03-19 17:29:01 +01:00
|
|
|
#!/usr/bin/perl
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
|
|
|
|
# this is hardcoded; change it if needed
|
2012-04-06 16:59:05 +02:00
|
|
|
use lib "src/lib";
|
2012-03-19 17:29:01 +01:00
|
|
|
use Gitolite::Test;
|
|
|
|
|
|
|
|
# uhh, seems to be another rule sequence test
|
|
|
|
# ----------------------------------------------------------------------
|
|
|
|
|
2012-06-01 06:22:12 +02:00
|
|
|
try "plan 48";
|
2012-03-19 17:29:01 +01:00
|
|
|
|
|
|
|
confreset;confadd '
|
|
|
|
@staff = u1 u2 u3
|
|
|
|
@gfoo = foo/CREATOR/..*
|
|
|
|
repo @gfoo
|
|
|
|
C = u1
|
|
|
|
RW+ = CREATOR
|
|
|
|
RW = WRITERS
|
|
|
|
- = @staff
|
|
|
|
';
|
|
|
|
|
|
|
|
try "ADMIN_PUSH set1; !/FATAL/" or die text();
|
|
|
|
|
|
|
|
try "
|
|
|
|
cd ..
|
|
|
|
glt clone u1 file:///foo/u1/bar; ok
|
|
|
|
/Initialized empty Git repository in .*/foo/u1/bar.git//
|
|
|
|
|
|
|
|
cd bar
|
|
|
|
tc p-906
|
|
|
|
glt push u1 origin master
|
|
|
|
/To file:///foo/u1/bar/
|
|
|
|
/\\[new branch\\] master -> master/
|
|
|
|
echo WRITERS u2 | glt perms u1 foo/u1/bar
|
|
|
|
glt perms u1 -l foo/u1/bar
|
|
|
|
/WRITERS u2/
|
|
|
|
# expand
|
2012-03-29 03:34:46 +02:00
|
|
|
glt info u2
|
2012-03-20 03:13:20 +01:00
|
|
|
/R W *\tfoo/u1/bar/
|
|
|
|
/R W *\ttesting/
|
2012-03-19 17:29:01 +01:00
|
|
|
|
|
|
|
# push
|
|
|
|
cd ..
|
|
|
|
glt clone u2 file:///foo/u1/bar u2bar
|
|
|
|
/Cloning into 'u2bar'.../
|
|
|
|
cd u2bar
|
|
|
|
tc p-222
|
|
|
|
glt push u2
|
|
|
|
/master -> master/
|
|
|
|
!/DENIED/
|
|
|
|
!/failed to push/
|
|
|
|
";
|
|
|
|
|
|
|
|
confreset;confadd '
|
|
|
|
@staff = u1 u2 u3
|
2012-11-14 10:42:30 +01:00
|
|
|
@gfoo = foo/CREATOR/..*
|
2012-03-19 17:29:01 +01:00
|
|
|
repo @gfoo
|
|
|
|
C = u1
|
|
|
|
RW+ = CREATOR
|
|
|
|
- = @staff
|
|
|
|
RW = WRITERS
|
2012-06-01 06:22:12 +02:00
|
|
|
R = READERS
|
2012-03-19 17:29:01 +01:00
|
|
|
';
|
|
|
|
|
|
|
|
try "ADMIN_PUSH set1; !/FATAL/" or die text();
|
|
|
|
|
|
|
|
try "
|
|
|
|
cd ..
|
|
|
|
rm -rf bar u2bar
|
|
|
|
glt clone u1 file:///foo/u1/bar; ok
|
|
|
|
/Initialized empty Git repository in .*/foo/u1/bar.git//
|
|
|
|
|
|
|
|
cd bar
|
|
|
|
tc p-906
|
|
|
|
glt push u1 origin master
|
|
|
|
/To file:///foo/u1/bar/
|
|
|
|
/\\[new branch\\] master -> master/
|
|
|
|
echo WRITERS u2 | glt perms u1 foo/u1/bar
|
|
|
|
glt perms u1 -l foo/u1/bar
|
|
|
|
/WRITERS u2/
|
|
|
|
# expand
|
2012-03-29 03:34:46 +02:00
|
|
|
glt info u2
|
2012-06-01 06:22:12 +02:00
|
|
|
!/R W *\tfoo/u1/baz/
|
2012-03-20 03:13:20 +01:00
|
|
|
/R W *\tfoo/u1/bar/
|
|
|
|
/R W *\ttesting/
|
2012-03-19 17:29:01 +01:00
|
|
|
|
|
|
|
# push
|
|
|
|
cd ..
|
|
|
|
glt clone u2 file:///foo/u1/bar u2bar
|
|
|
|
/Cloning into 'u2bar'.../
|
|
|
|
cd u2bar
|
|
|
|
tc p-222
|
|
|
|
glt push u2
|
|
|
|
!ok
|
|
|
|
reject
|
|
|
|
/W refs/heads/master foo/u1/bar u2 DENIED by refs/\\.\\*/
|
2012-06-01 06:22:12 +02:00
|
|
|
|
|
|
|
# auto-create using perms fail
|
|
|
|
echo READERS u5 | glt perms u4 -c foo/u4/baz
|
|
|
|
!/Initialized empty Git repository in .*/foo/u4/baz.git/
|
2012-12-29 07:08:13 +01:00
|
|
|
/FATAL: repo does not exist, or you are not authorised/
|
2012-06-01 06:22:12 +02:00
|
|
|
|
|
|
|
# auto-create using perms
|
|
|
|
echo READERS u2 | glt perms u1 -c foo/u1/baz
|
|
|
|
/Initialized empty Git repository in .*/foo/u1/baz.git/
|
|
|
|
|
|
|
|
glt perms u1 -l foo/u1/baz
|
|
|
|
/READERS u2/
|
|
|
|
# expand
|
|
|
|
glt info u2
|
|
|
|
/R *\tfoo/u1/baz/
|
|
|
|
/R W *\tfoo/u1/bar/
|
|
|
|
/R W *\ttesting/
|
2012-03-19 17:29:01 +01:00
|
|
|
";
|