fix 'C' and 'M' tests in 'gitolite access'...
[gitolite.git] / t / deny-create.t
bloba4b7e4f57c01f7653bf2896285579aa36b89d6d1
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
5 # this is hardcoded; change it if needed
6 use lib "src/lib";
7 use Gitolite::Test;
9 # deny-create, the RW.*C flag
10 # ----------------------------------------------------------------------
12 try "plan 72";
14 try "DEF POK = !/DENIED/; !/failed to push/";
16 # test "C" permissions
18 confreset; confadd '
19 @leads = u1 u2
20 @devs = u1 u2 u3 u4
22 @gfoo = foo
23 repo @gfoo
24 RW+C = @leads
25 RW+C personal/USER/ = @devs
26 RW = @devs
29 try "ADMIN_PUSH set1; !/FATAL/" or die text();
31 try "
32 cd ..
33 glt clone u1 file:///foo
35 cd foo
36 tc t-413 t-414 t-415 t-416 t-417
38 # u1 can push/rewind master on foo
39 glt push u1 origin master
40 POK; /master -> master/
41 glt push u1 -f origin master^^:master
42 POK; /master\\^\\^ -> master/
44 # u2 can create newbr1 on foo
45 glt push u2 file:///foo master:newbr1
46 POK; /master -> newbr1/
48 # u2 can create newtag on foo
49 git tag newtag
50 glt push u2 file:///foo newtag
51 POK; /newtag -> newtag/
53 # u3 can push newbr1 on foo
54 tc u-962 u-963 u-964 u-965 u-966
55 glt push u3 file:///foo master:newbr1
56 POK; /master -> newbr1/
58 # u4 canNOT create newbr2 on foo
59 tc e-615 e-616 e-617 e-618 e-619
60 glt push u3 file:///foo master:newbr2
61 /C refs/heads/newbr2 foo u3 DENIED by fallthru/
62 reject
64 # u4 canNOT create newtag2 on foo
65 git tag newtag2
66 glt push u3 file:///foo newtag2
67 /C refs/tags/newtag2 foo u3 DENIED by fallthru/
68 reject
70 # u4 can create/rewind personal/u4/newbr3 on foo
71 tc f-664 f-665 f-666 f-667 f-668
72 glt push u4 file:///foo master:personal/u4/newbr3
73 POK; /master -> personal/u4/newbr3/
74 glt push u4 -f origin master^^:personal/u4/newbr3
75 POK; /master\\^\\^ -> personal/u4/newbr3/
78 # bar, without "C" permissions, should behave like old
80 confadd '
81 @leads = u1 u2
82 @devs = u1 u2 u3 u4
84 @gbar = bar
85 repo @gbar
86 RW+ = @leads
87 RW+ personal/USER/ = @devs
88 RW = @devs
91 try "ADMIN_PUSH set1; !/FATAL/" or die text();
93 try "
94 cd ..
95 glt clone u1 file:///bar
97 cd bar
98 tc u-907 u-908 u-909 u-910 u-911
100 # u1 can push/rewind master on bar
101 glt push u1 origin master
102 POK; /master -> master/
103 glt push u1 -f origin master^^:master
104 POK; /master\\^\\^ -> master/
106 # u2 can create newbr1 on bar
107 glt push u2 file:///bar master:newbr1
108 POK; /master -> newbr1/
110 # u2 can create newtag on bar
111 git tag newtag
112 glt push u2 file:///bar newtag
113 POK; /newtag -> newtag/
115 # u3 can push newbr1 on bar
116 tc y-862 y-863 y-864 y-865 y-866
117 glt push u3 file:///bar master:newbr1
118 POK; /master -> newbr1/
120 # u4 can create newbr2 on bar
121 tc q-417 q-418 q-419 q-420 q-421
122 glt push u3 file:///bar master:newbr2
123 POK; /master -> newbr2/
125 # u4 can create newtag2 on bar
126 git tag newtag2
127 glt push u3 file:///bar newtag2
128 POK; /newtag2 -> newtag2/
130 # u4 can create/rewind personal/u4/newbr3 on bar
131 tc v-605 v-606 v-607 v-608 v-609
132 glt push u4 file:///bar master:personal/u4/newbr3
133 POK; /master -> personal/u4/newbr3/
134 glt push u4 -f origin master^^:personal/u4/newbr3
135 POK; /master\\^\\^ -> personal/u4/newbr3/