Bump version and update Changes
[apache2-authzcaps.git] / lib / Apache2_4 / AuthzCaps.pm
CommitLineData
d586dfdf
MG
1package Apache2_4::AuthzCaps;
2
3use 5.014000;
4use strict;
5use warnings;
6
b8d9e21f 7our $VERSION = '0.002';
d586dfdf
MG
8
9use Apache2::AuthzCaps 'hascaps';
10use Apache2::Const qw/AUTHZ_GRANTED AUTHZ_DENIED AUTHZ_DENIED_NO_USER/;
11use Apache2::RequestRec;
12use Apache2::RequestUtil;
13
14##################################################
15
16# General handler template stolen from Apache2_4::AuthCookie
17sub handler {
18 my ($r, $caps) = @_;
19 my $user = $r->user;
20 local $Apache2::AuthzCaps::rootdir = $r->dir_config('AuthzCapsRootdir');
21 return AUTHZ_DENIED_NO_USER unless $user;
22 my @caps = split ' ', $caps;
23 hascaps($user, @caps) ? AUTHZ_GRANTED : AUTHZ_DENIED
24}
25
261;
27__END__
28
29=encoding utf-8
30
31=head1 NAME
32
33Apache2_4::AuthzCaps - mod_perl2 capability authorization for Apache 2.4
34
35=head1 SYNOPSIS
36
37 # In Apache2 config
38 PerlAddAuthzProvider cap Apache2_4::AuthzCaps
39 <Location /protected>
40 # Insert authentication here
41 PerlSetVar AuthzCapsRootdir /path/to/user/directory
42 Require cap staff important
43 Require cap admin
44 </Location>
45 # This will:
46 # 1) Let important staff members access /protected
47 # 2) Let admins access /protected
48 # 3) Not let anyone else (such as an important non-staff member or an non-important staff member) access /protected
49
50=head1 DESCRIPTION
51
52Apache2_4::AuthzCaps is a modification of L<Apache2::AuthzCaps> for
53Apache 2.4. See that module's documentation for helper functions and
54more information.
55
56=head1 AUTHOR
57
58Marius Gavrilescu, E<lt>marius@ieval.roE<gt>
59
60=head1 COPYRIGHT AND LICENSE
61
62Copyright (C) 2013-2015 by Marius Gavrilescu
63
64This library is free software; you can redistribute it and/or modify
65it under the same terms as Perl itself, either Perl version 5.14.2 or,
66at your option, any later version of Perl 5 you may have available.
This page took 0.012022 seconds and 4 git commands to generate.