]> iEval git - apache2-authzcaps.git/blobdiff - lib/Apache2/AuthzCaps.pm
Add Apache 2.4 support
[apache2-authzcaps.git] / lib / Apache2 / AuthzCaps.pm
index 281d3d6f6e3b63eaa9874172ea00f5030901bbc5..0056efe3be654e30a81b42ceb0673859dbaa87aa 100644 (file)
@@ -4,12 +4,13 @@ use 5.014000;
 use strict;
 use warnings;
 use subs qw/OK DECLINED/;
-no if $] >= 5.017011, warnings => 'experimental::smartmatch';
+
 our $VERSION = '0.001001';
 
 use if $ENV{MOD_PERL}, 'Apache2::Access';
 use if $ENV{MOD_PERL}, 'Apache2::Const' => qw/OK DECLINED/;
 use if $ENV{MOD_PERL}, 'Apache2::RequestRec';
+use if $ENV{MOD_PERL}, 'Apache2::RequestUtil';
 use YAML::Any qw/LoadFile DumpFile/;
 
 use parent qw/Exporter/;
@@ -47,15 +48,10 @@ sub handler{
        local $rootdir = $r->dir_config('AuthzCapsRootdir');
 
        if ($user) {
-         LOOP: for my $requirement (map { $_->{requirement} } @{$r->requires}) {
+               for my $requirement (map { $_->{requirement} } @{$r->requires}) {
                        my ($command, @args) = split ' ', $requirement;
 
-                       given ($command){
-                               when('cap'){
-                                       return OK if hascaps $user, @args
-                               }
-
-                       }
+                       return OK if $command eq 'cap' && hascaps $user, @args;
                }
        }
 
@@ -95,6 +91,8 @@ Apache2::AuthzCaps - mod_perl2 capability authorization
 
 Apache2::AuthzCaps is a perl module which provides simple Apache2 capability-based authorization. It contains a PerlAuthzHandler and some utility functions.
 
+B<< For Apache 2.4, use L<Apache2_4::AuthzCaps>. >>
+
 The user data is stored in YAML files in a user-set directory. Set this directory using:
 
   $Apache2::AuthzCaps::rootdir = "/path/to/directory"; # From perl
@@ -124,7 +122,7 @@ Marius Gavrilescu, E<lt>marius@ieval.roE<gt>
 
 =head1 COPYRIGHT AND LICENSE
 
-Copyright (C) 2013 by Marius Gavrilescu
+Copyright (C) 2013-2015 by Marius Gavrilescu
 
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself, either Perl version 5.14.2 or,
This page took 0.024766 seconds and 4 git commands to generate.