diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 14:17:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 14:17:27 +0000 |
commit | aae1a14ea756102251351d96e2567b4986d30e2b (patch) | |
tree | a1af617672e26aee4c1031a3aa83e8ff08f6a0a5 /t/perms-groups.t | |
parent | Initial commit. (diff) | |
download | gitolite3-upstream.tar.xz gitolite3-upstream.zip |
Adding upstream version 3.6.12.upstream/3.6.12upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-x | t/perms-groups.t | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/t/perms-groups.t b/t/perms-groups.t new file mode 100755 index 0000000..eb51bc7 --- /dev/null +++ b/t/perms-groups.t @@ -0,0 +1,81 @@ +#!/usr/bin/perl +use strict; +use warnings; + +# this is hardcoded; change it if needed +use lib "src/lib"; +use Gitolite::Test; + +# assigning roles to groups instead of users +# ---------------------------------------------------------------------- + +try "plan 31"; + +try "DEF POK = !/DENIED/; !/failed to push/"; + +confreset; confadd ' + @leads = u1 u2 + @devs = u1 u2 u3 u4 + + @gbar = bar/CREATOR/..* + repo @gbar + C = @leads + RW+ = CREATOR + RW = WRITERS + R = READERS +'; + +try "ADMIN_PUSH set1; !/FATAL/" or die text(); + +try " + + # u1 auto-creates a repo + glt ls-remote u1 file:///bar/u1/try1 + /Initialized empty Git repository in .*/bar/u1/try1.git// + # default permissions for u2 and u4 + glt info u1 -lc + /R W *\tbar/u1/try1\tu1/ + glt info u2 -lc + !/R W *\tbar/u1/try1\tu1/ + glt info u4 -lc + !/R W *\tbar/u1/try1\tu1/ + + # \@leads can RW try1 + echo WRITERS \@leads | glt perms u1 -c bar/u1/try1; ok + glt info u1 -lc + /R W *\tbar/u1/try1\tu1/ + glt info u2 -lc + /R W *\tbar/u1/try1\tu1/ + glt info u4 -lc + !/R W *\tbar/u1/try1\tu1/ + + # \@devs can R try1 + echo READERS \@devs | glt perms u1 -c bar/u1/try1; ok + glt perms u1 bar/u1/try1 -l + /READERS \@devs/ + !/WRITERS \@leads/ + + glt info u1 -lc + /R W *\tbar/u1/try1\tu1/ + + glt info u2 -lc + !/R W *\tbar/u1/try1\tu1/ + /R *\tbar/u1/try1\tu1/ + + glt info u4 -lc + !/R W *\tbar/u1/try1\tu1/ + /R *\tbar/u1/try1\tu1/ + +# combo of previous 2 + /usr/bin/printf 'READERS \@devs\\nWRITERS \@leads\\n' | glt perms u1 -c bar/u1/try1; ok + glt perms u1 bar/u1/try1 -l + /READERS \@devs/ + /WRITERS \@leads/ + glt info u1 -lc + /R W *\tbar/u1/try1\tu1/ + glt info u2 -lc + /R W *\tbar/u1/try1\tu1/ + glt info u4 -lc + !/R W *\tbar/u1/try1\tu1/ + /R *\tbar/u1/try1\tu1/ +"; |