INSTALL: Add a note about cloned.pl
[girocco/mytab.git] / Girocco / ProjPerm.pm
bloba8c88c669bc79f88b60a0bfcf4aa9aa3e4a77413
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.
9 use strict;
10 use warnings;
12 use Girocco::Config;
14 BEGIN {
15 our @interesting = qw(refs info objects);
18 sub perm_initialize {
19 my ($proj) = @_;
20 die "unimplemented";
23 sub perm_user_add {
24 my ($proj, $username, $uid) = @_;
25 die "unimplemented";
28 sub perm_user_del {
29 my ($proj, $username, $uid) = @_;
30 die "unimplemented";
33 sub shared_mode {
34 my ($proj) = @_;
35 # The --shared= argument for git init
36 die "unimplemented";
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.
49 use strict;
50 use warnings;
52 BEGIN {
53 use base qw(Girocco::ProjPerm);
56 sub perm_initialize {
57 my ($proj) = @_;
61 sub perm_user_add {
62 my ($proj, $username, $uid) = @_;
66 sub perm_user_del {
67 my ($proj, $username, $uid) = @_;
71 sub shared_mode {
72 my ($proj) = @_;
73 "group";
79 package Girocco::ProjPerm::Hooks;
81 # This is the "soft-security" permission model: we keep the repository
82 # world-writable and check if the user is allowed to push only within
83 # the update hook that will call our can_user_push() method.
85 use strict;
86 use warnings;
88 BEGIN {
89 use base qw(Girocco::ProjPerm);
92 sub perm_initialize {
93 my ($proj) = @_;
97 sub perm_user_add {
98 my ($proj, $username, $uid) = @_;
102 sub perm_user_del {
103 my ($proj, $username, $uid) = @_;
107 sub shared_mode {
108 my ($proj) = @_;
109 "0777";
112 sub can_user_push {
113 my ($proj, $username) = @_;
114 grep { $_ eq $username } @{$proj->{users}};