1 package Girocco
::ProjPerm
;
3 # This is base class for various permission models; these control updating
4 # permissions of appropriate files in push-enabled repositories.
5 # The /etc/group file is maintained by Girocco::Project itself.
7 # The chosen subclass of this class is used as base class of Girocco::Project.
15 our @interesting = qw(refs info objects);
24 my ($proj, $username, $uid) = @_;
29 my ($proj, $username, $uid) = @_;
35 # The --shared= argument for git init
42 package Girocco
::ProjPerm
::Group
;
44 # This is the naive permission model: on init, we just chgrp the relevant
45 # pieces to our group and make them group-writable. But oh, we cannot do that
46 # since we are not root; so we just sit happily and do nothing else.
47 # Then, we can just sit happily and do nothing else either.
53 use base
qw(Girocco::ProjPerm);
59 # adjust group and other permissions
60 system("chmod", "-R", "ug+rw,o+r", $proj->{path
}) == 0 or die "Running chmod failed: $!";
66 my ($proj, $username, $uid) = @_;
71 my ($proj, $username, $uid) = @_;
81 my ($proj, $username) = @_;
82 grep { $_ eq $username } @
{$proj->{users
}};
88 package Girocco
::ProjPerm
::Hooks
;
90 # This is the "soft-security" permission model: we keep the repository
91 # world-writable and check if the user is allowed to push only within
92 # the update hook that will call our can_user_push() method.
98 use base
qw(Girocco::ProjPerm);
101 sub perm_initialize
{
107 my ($proj, $username, $uid) = @_;
112 my ($proj, $username, $uid) = @_;
122 my ($proj, $username) = @_;
123 grep { $_ eq $username } @
{$proj->{users
}};