Apache-AuthzUnix
view release on metacpan or search on metacpan
lib/Apache/AuthzUnix.pm view on Meta::CPAN
my $user = $r->user or return DECLINED();
my $fn = $r->filename;
if (!-e $r->filename) { $fn = dirname($fn) }
# Why did we just do that? Because:
# If we're PUTting a file, we want to check if we can write to the directory.
# Otherwise, we're GETting a non-existent or autogenerated file (ie autoindex)
# If it's a directory index, then we use the permissions of the directory.
# If it's non-existent, permissions are an irrelevance!
my $stat = File::stat::stat($fn);
my $access =
_access($user, $stat->mode, $stat->uid, $stat->gid, $r->method);
warn "Access to file: "
. $r->filename
. " (resolved as $fn) : "
. ($access ? "allowed" : "denied")
if $DEBUG;
return $access ? OK() : DECLINED();
}
( run in 1.218 second using v1.01-cache-2.11-cpan-49f99fa48dc )