~ubuntu-branches/ubuntu/utopic/gitolite3/utopic-proposed

« back to all changes in this revision

Viewing changes to t/deny-rules-2.t

  • Committer: Package Import Robot
  • Author(s): David Bremner
  • Date: 2013-05-18 17:59:21 UTC
  • Revision ID: package-import@ubuntu.com-20130518175921-ac4xe6vd0jtxvjot
Tags: upstream-3.5.1+4
ImportĀ upstreamĀ versionĀ 3.5.1+4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl
 
2
use strict;
 
3
use warnings;
 
4
 
 
5
# this is hardcoded; change it if needed
 
6
use lib "src/lib";
 
7
use Gitolite::Test;
 
8
 
 
9
# more on deny-rules
 
10
# ----------------------------------------------------------------------
 
11
 
 
12
try "plan 126";
 
13
 
 
14
try "
 
15
    DEF GOOD    = /refs/\\.\\*/
 
16
    DEF BAD     = /DENIED/
 
17
 
 
18
    DEF Ryes    = gitolite access %1 %2 R any;  ok; GOOD
 
19
    DEF Rno     = gitolite access %1 %2 R any;  !ok; BAD
 
20
 
 
21
    DEF Wyes    = gitolite access %1 %2 W any;  ok; GOOD
 
22
    DEF Wno     = gitolite access %1 %2 W any;  !ok; BAD
 
23
 
 
24
    DEF GWyes   = Ryes %1 gitweb
 
25
    DEF GWno    = Rno  %1 gitweb
 
26
 
 
27
    DEF GDyes   = Ryes %1 daemon
 
28
    DEF GDno    = Rno  %1 daemon
 
29
";
 
30
 
 
31
confreset;confadd '
 
32
    repo one
 
33
        RW+ =   u1
 
34
        R   =   u2
 
35
        -   =   u2 u3
 
36
        R   =   @all
 
37
';
 
38
 
 
39
try "ADMIN_PUSH set1; !/FATAL/" or die text();
 
40
 
 
41
try "
 
42
    Wyes one u1
 
43
 
 
44
    Ryes one u2
 
45
    Wno  one u2
 
46
 
 
47
    Ryes one u3
 
48
    Wno  one u3
 
49
 
 
50
    Ryes one u6
 
51
    Wno  one u6
 
52
 
 
53
    GDyes one
 
54
    GWyes one
 
55
";
 
56
 
 
57
confadd '
 
58
    option deny-rules = 1
 
59
';
 
60
 
 
61
try "ADMIN_PUSH set1; !/FATAL/" or die text();
 
62
 
 
63
try "
 
64
    Wyes one u1
 
65
 
 
66
    Ryes one u2
 
67
    Wno  one u2
 
68
 
 
69
    Rno  one u3
 
70
 
 
71
    Ryes one u6
 
72
    Wno  one u6
 
73
 
 
74
    GDyes one
 
75
    GWyes one
 
76
";
 
77
 
 
78
confadd '
 
79
    repo two
 
80
        RW+ =   u1
 
81
        R   =   u2
 
82
        -   =   u2 u3 gitweb daemon
 
83
        R   =   @all
 
84
';
 
85
 
 
86
try "ADMIN_PUSH set1; !/FATAL/" or die text();
 
87
 
 
88
try "
 
89
    GWyes two
 
90
    GDyes two
 
91
";
 
92
 
 
93
confadd '
 
94
    option deny-rules = 1
 
95
';
 
96
 
 
97
try "ADMIN_PUSH set1; !/FATAL/" or die text();
 
98
 
 
99
try "
 
100
    GWno  two
 
101
    GDno  two
 
102
";
 
103
 
 
104
# set 3 -- allow gitweb to all but admin repo
 
105
 
 
106
confadd '
 
107
    repo gitolite-admin
 
108
        -   =   gitweb daemon
 
109
    option deny-rules = 1
 
110
 
 
111
    repo three
 
112
        RW+ =   u3
 
113
        R   =   gitweb daemon
 
114
';
 
115
 
 
116
try "ADMIN_PUSH set1; !/FATAL/" or die text();
 
117
 
 
118
try "
 
119
    GDyes   three
 
120
    GWyes   three
 
121
    GDno    gitolite-admin
 
122
    GWno    gitolite-admin
 
123
";
 
124
 
 
125
# set 4 -- allow gitweb to all but admin repo
 
126
 
 
127
confadd '
 
128
    repo four
 
129
        RW+ =   u4
 
130
        -   =   gitweb daemon
 
131
 
 
132
    repo @all
 
133
        R   =   @all
 
134
';
 
135
try "ADMIN_PUSH set1; !/FATAL/" or die text();
 
136
 
 
137
try "
 
138
    GDyes   four
 
139
    GWyes   four
 
140
    GDno    gitolite-admin
 
141
    GWno    gitolite-admin
 
142
";
 
143
 
 
144
# set 5 -- go wild
 
145
 
 
146
confreset; confadd '
 
147
    repo foo/..*
 
148
        C   =   u1
 
149
        RW+ =   CREATOR
 
150
        -   =   gitweb daemon
 
151
        R   =   @all
 
152
 
 
153
    repo bar/..*
 
154
        C   =   u2
 
155
        RW+ =   CREATOR
 
156
        -   =   gitweb daemon
 
157
        R   =   @all
 
158
    option deny-rules = 1
 
159
';
 
160
try "ADMIN_PUSH set1; !/FATAL/" or die text();
 
161
 
 
162
try "
 
163
    glt ls-remote u1 file:///foo/one
 
164
    glt ls-remote u2 file:///bar/two
 
165
    Wyes foo/one u1
 
166
    Wyes bar/two u2
 
167
 
 
168
    GDyes foo/one
 
169
    GDyes foo/one
 
170
    GWno  bar/two
 
171
    GWno  bar/two
 
172
";