From 59f2225d192cda0f843a9d5f99892e60b5a95341 Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Sat, 12 Sep 2015 15:03:52 +0300 Subject: [PATCH] Reindent everything --- Makefile.PL | 36 +++++++++++++------------- lib/Apache2/AuthzCaps.pm | 56 ++++++++++++++++++++-------------------- t/Apache2-AuthzCaps.t | 8 +++--- 3 files changed, 50 insertions(+), 50 deletions(-) diff --git a/Makefile.PL b/Makefile.PL index d2cd36f..8b2284d 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,22 +1,22 @@ use ExtUtils::MakeMaker; WriteMakefile( - NAME => 'Apache2::AuthzCaps', - VERSION_FROM => 'lib/Apache2/AuthzCaps.pm', - ABSTRACT_FROM => 'lib/Apache2/AuthzCaps.pm', - AUTHOR => 'Marius Gavrilescu ', - MIN_PERL_VERSION => '5.14.0', - LICENSE => 'perl', - SIGN => 1, - PREREQ_PM => { - qw/YAML::Any 0/, - }, - META_MERGE => { - dynamic_config => 0, - recommends => { - qw/Apache2::Access 0 - Apache2::Const 0 - Apache2::RequestRec 0/, - } - } + NAME => 'Apache2::AuthzCaps', + VERSION_FROM => 'lib/Apache2/AuthzCaps.pm', + ABSTRACT_FROM => 'lib/Apache2/AuthzCaps.pm', + AUTHOR => 'Marius Gavrilescu ', + MIN_PERL_VERSION => '5.14.0', + LICENSE => 'perl', + SIGN => 1, + PREREQ_PM => { + qw/YAML::Any 0/, + }, + META_MERGE => { + dynamic_config => 0, + recommends => { + qw/Apache2::Access 0 + Apache2::Const 0 + Apache2::RequestRec 0/, + } + } ); diff --git a/lib/Apache2/AuthzCaps.pm b/lib/Apache2/AuthzCaps.pm index 426b608..281d3d6 100644 --- a/lib/Apache2/AuthzCaps.pm +++ b/lib/Apache2/AuthzCaps.pm @@ -21,45 +21,45 @@ our @EXPORT_OK = qw/setcap hascaps/; our $rootdir; sub setcap{ - my ($user, $cap, $value) = @_; - my $config = eval { LoadFile "$rootdir/$user.yml" } // {}; - $config->{caps}//={}; - my $caps=$config->{caps}; - - delete $caps->{$cap} unless $value; - $caps->{$cap} = 1 if $value; - DumpFile "$rootdir/$user.yml", $config + my ($user, $cap, $value) = @_; + my $config = eval { LoadFile "$rootdir/$user.yml" } // {}; + $config->{caps}//={}; + my $caps=$config->{caps}; + + delete $caps->{$cap} unless $value; + $caps->{$cap} = 1 if $value; + DumpFile "$rootdir/$user.yml", $config } sub hascaps{ - my ($user, @caps) = @_; - my $config = LoadFile "$rootdir/$user.yml"; - my $caps = $config->{caps}; - for (@caps) { - return 0 unless $caps->{$_} - } - 1 + my ($user, @caps) = @_; + my $config = LoadFile "$rootdir/$user.yml"; + my $caps = $config->{caps}; + for (@caps) { + return 0 unless $caps->{$_} + } + 1 } sub handler{ - my $r=shift; - my $user = $r->user; - local $rootdir = $r->dir_config('AuthzCapsRootdir'); + my $r=shift; + my $user = $r->user; + local $rootdir = $r->dir_config('AuthzCapsRootdir'); - if ($user) { - LOOP: for my $requirement (map { $_->{requirement} } @{$r->requires}) { - my ($command, @args) = split ' ', $requirement; + if ($user) { + LOOP: for my $requirement (map { $_->{requirement} } @{$r->requires}) { + my ($command, @args) = split ' ', $requirement; - given ($command){ - when('cap'){ - return OK if hascaps $user, @args - } + given ($command){ + when('cap'){ + return OK if hascaps $user, @args + } - } + } + } } - } - DECLINED + DECLINED } 1; diff --git a/t/Apache2-AuthzCaps.t b/t/Apache2-AuthzCaps.t index b018dd5..9052703 100644 --- a/t/Apache2-AuthzCaps.t +++ b/t/Apache2-AuthzCaps.t @@ -9,13 +9,13 @@ BEGIN { use_ok('Apache2::AuthzCaps', qw/setcap hascaps/) }; $Apache2::AuthzCaps::rootdir = tempdir CLEANUP => 1; sub checkcaps{ - my ($user, $testname, @caps) = @_; - ok hascaps ($user, @caps), $testname + my ($user, $testname, @caps) = @_; + ok hascaps ($user, @caps), $testname } sub checknocaps{ - my ($user, $testname, @caps) = @_; - ok !(hascaps $user, @caps), $testname + my ($user, $testname, @caps) = @_; + ok !(hascaps $user, @caps), $testname } setcap marius => dostuff => 1; -- 2.39.2