repo-specific hooks: fix bug in handling reserved hooks
[gitolite.git] / t / perms-groups.t
blobeb51bc736277a22d2b274bd363f372d33e3d27dc
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 # assigning roles to groups instead of users
10 # ----------------------------------------------------------------------
12 try "plan 31";
14 try "DEF POK = !/DENIED/; !/failed to push/";
16 confreset; confadd '
17 @leads = u1 u2
18 @devs = u1 u2 u3 u4
20 @gbar = bar/CREATOR/..*
21 repo @gbar
22 C = @leads
23 RW+ = CREATOR
24 RW = WRITERS
25 R = READERS
28 try "ADMIN_PUSH set1; !/FATAL/" or die text();
30 try "
32 # u1 auto-creates a repo
33 glt ls-remote u1 file:///bar/u1/try1
34 /Initialized empty Git repository in .*/bar/u1/try1.git//
35 # default permissions for u2 and u4
36 glt info u1 -lc
37 /R W *\tbar/u1/try1\tu1/
38 glt info u2 -lc
39 !/R W *\tbar/u1/try1\tu1/
40 glt info u4 -lc
41 !/R W *\tbar/u1/try1\tu1/
43 # \@leads can RW try1
44 echo WRITERS \@leads | glt perms u1 -c bar/u1/try1; ok
45 glt info u1 -lc
46 /R W *\tbar/u1/try1\tu1/
47 glt info u2 -lc
48 /R W *\tbar/u1/try1\tu1/
49 glt info u4 -lc
50 !/R W *\tbar/u1/try1\tu1/
52 # \@devs can R try1
53 echo READERS \@devs | glt perms u1 -c bar/u1/try1; ok
54 glt perms u1 bar/u1/try1 -l
55 /READERS \@devs/
56 !/WRITERS \@leads/
58 glt info u1 -lc
59 /R W *\tbar/u1/try1\tu1/
61 glt info u2 -lc
62 !/R W *\tbar/u1/try1\tu1/
63 /R *\tbar/u1/try1\tu1/
65 glt info u4 -lc
66 !/R W *\tbar/u1/try1\tu1/
67 /R *\tbar/u1/try1\tu1/
69 # combo of previous 2
70 /usr/bin/printf 'READERS \@devs\\nWRITERS \@leads\\n' | glt perms u1 -c bar/u1/try1; ok
71 glt perms u1 bar/u1/try1 -l
72 /READERS \@devs/
73 /WRITERS \@leads/
74 glt info u1 -lc
75 /R W *\tbar/u1/try1\tu1/
76 glt info u2 -lc
77 /R W *\tbar/u1/try1\tu1/
78 glt info u4 -lc
79 !/R W *\tbar/u1/try1\tu1/
80 /R *\tbar/u1/try1\tu1/