| 1 | package Class::Protected; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use 5.006; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 1 | our $VERSION = '0.01.02'; | |||||||||
| 8 | 1 | our $DEBUG = 0; | |||||||||
| 9 | |||||||||||
| 10 | 1 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | 1 | ▶ | use Class::Maker; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | |||||||||||
| 14 | 1 | ▶ | use Class::Proxy; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | |||||||||||
| 16 | 1 | ▶ | use Decision::ACL; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | 1 | ▶ | use Decision::ACL::Rule; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 18 | 1 | ▶ | use Decision::ACL::Constants qw(:rule); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | |||||||||||
| 20 | 1 | ▶ | use IO::Extended qw(:all); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 21 | |||||||||||
| 22 | 1 | our $uid; | |||||||||
| 23 | |||||||||||
| 24 | Class::Maker::class | ||||||||||
| 25 | { | ||||||||||
| 26 | isa => [qw( Class::Proxy )], | ||||||||||
| 27 | |||||||||||
| 28 | public => | ||||||||||
| 29 | { | ||||||||||
| 30 | hash => [qw( table )], | ||||||||||
| 31 | |||||||||||
| 32 | ref => { acl => 'Decision::ACL' }, | ||||||||||
| 33 | }, | ||||||||||
| 34 | |||||||||||
| 35 | default => | ||||||||||
| 36 | { | ||||||||||
| 37 | events => | ||||||||||
| 38 | { | ||||||||||
| 39 | method => sub | ||||||||||
| 40 | 0 | ▶ | { | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||
| 41 | 0 | my ( $this, $e, $m, $victim, $args ) = @_; | |||||||||
| 42 | |||||||||||
| 43 | 0 | my $uid = shift @{$args}; | |||||||||
| 44 | |||||||||||
| 45 | 0 | ▶ | unless( ACL_RULE_ALLOW eq $this->test_acl( pkg => ref ${ $victim }, method => ${ $m }, uid => $Class::Protected::uid ) ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 46 | { | ||||||||||
| 47 | 0 | croak sprintf "Die because of ACL restrictions on protected class '%s'. '%s' is rejected to access method '%s'", ref ${ $victim }, $Class::Protected::uid, ${$m} ; | |||||||||
| 48 | } | ||||||||||
| 49 | }, | ||||||||||
| 50 | }, | ||||||||||
| 51 | }, | ||||||||||
| 52 | 1 | }; | |||||||||
| 53 | |||||||||||
| 54 | 0 | ▶ | sub add_acl_rule : method | ||||||||
|
Subroutine
add_acl_rule: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 55 | { | ||||||||||
| 56 | 0 | my $this = shift; | |||||||||
| 57 | |||||||||||
| 58 | 0 | my %rule = @_; | |||||||||
| 59 | |||||||||||
| 60 | 0 | return $this->acl->push_rule( Decision::ACL::Rule->new( \%rule ) ); | |||||||||
| 61 | } | ||||||||||
| 62 | |||||||||||
| 63 | 0 | ▶ | sub test_acl : method | ||||||||
|
Subroutine
test_acl: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 64 | { | ||||||||||
| 65 | 0 | my $this = shift; | |||||||||
| 66 | |||||||||||
| 67 | 0 | my %rule = @_; | |||||||||
| 68 | |||||||||||
| 69 | 0 | return $this->acl->run_acl( \%rule ); | |||||||||
| 70 | } | ||||||||||
| 71 | # guard is only working on blessed references (tie interface for Class::Proxy could | ||||||||||
| 72 | # wave this constrain). | ||||||||||
| 73 | 1 | 1; | |||||||||
| 74 | __END__ | ||||||||||