Git

From
Revision as of 12:03, 31 October 2012 by U9786 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Code für GitWeb

 our $export_auth_hook = export_auth_hook;
 sub export_auth_hook {
   my $dir = $_;
   $numParameters = @_;
   if (!$dir) {
       $dir = @_[0];
       my $laenge = length $projectroot;
       $laenge +=1;
       $dir =  substr $dir, $laenge;
   }
   open my $ACCESSCONF, '<', "/etc/gitweb.access.conf" or return;
   while (my $accessline = <$ACCESSCONF>) {
       chomp $accessline;
       my ($accesspath,$foo_groups) = split ' ', $accessline;
       if($accesspath =~ m/\#/) { next; }
       if ($accesspath eq $dir) {
           my @userliste = split ' ', $accessline;
           $foo_groups = unescape($foo_groups);
           my @foo_a_groups = split ' ', $foo_groups;
           if(grep $_ eq $ENV {'REMOTE_USER'}, @userliste) {
               close $ACCESSCONF;
               return 1;
           }
           else { 
           # kein treffer
   }   }   }
   close $ACCESSCONF;
   return 0; 
 };