| 1 | # | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # $HeadURL: https://svn.oucs.ox.ac.uk/people/oliver/pub/librpc-serialized-perl/trunk/lib/RPC/Serialized/ACL.pm $ | ||||||||||||||||||||||||||||||||||||||||||
| 3 | # $LastChangedRevision: 1281 $ | ||||||||||||||||||||||||||||||||||||||||||
| 4 | # $LastChangedDate: 2008-10-01 16:16:56 +0100 (Wed, 01 Oct 2008) $ | ||||||||||||||||||||||||||||||||||||||||||
| 5 | # $LastChangedBy: oliver $ | ||||||||||||||||||||||||||||||||||||||||||
| 6 | # | ||||||||||||||||||||||||||||||||||||||||||
| 7 | package RPC::Serialized::ACL; | ||||||||||||||||||||||||||||||||||||||||||
| 8 | { | ||||||||||||||||||||||||||||||||||||||||||
| 9 | 2 | $RPC::Serialized::ACL::VERSION = '1.123630'; | |||||||||||||||||||||||||||||||||||||||||
| 10 | } | ||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 2 | ▶ | use warnings FATAL => 'all'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | 2 | ▶ | use RPC::Serialized::ACL::Operation; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 2 | ▶ | use RPC::Serialized::ACL::Subject; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | 2 | ▶ | use RPC::Serialized::ACL::Target; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | 2 | ▶ | use constant DECLINE => 0; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | 2 | ▶ | use constant DENY => 1; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | 2 | ▶ | use constant ALLOW => 2; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | 12 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=9 SCAR=22.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | 12 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 25 | 12 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||
| 26 | 12 | my $self; | |||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | 12 | ▶ | if ( defined $args{operation} and ref $args{operation} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $args{"operation"} and ref $args{"operation"}
MC/DC50%1/2
defined $args{"operation"} and ref $args{"operation"}
defined $args{"operation"}
ref $args{"operation"}
Truth table66%2/3
A and B
A= defined $args{"operation"}B= ref $args{"operation"}
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | 7 | $self->{OPERATION} = $args{operation}; | |||||||||||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||||||||||
| 31 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 32 | $self->{OPERATION} | ||||||||||||||||||||||||||||||||||||||||||
| 33 | 5 | = RPC::Serialized::ACL::Operation->new( $args{operation} ); | |||||||||||||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||||||||||||
| 35 | 12 | ▶ | if ( defined $args{subject} and ref $args{subject} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $args{"subject"} and ref $args{"subject"}
MC/DC50%1/2
defined $args{"subject"} and ref $args{"subject"}
defined $args{"subject"}
ref $args{"subject"}
Truth table66%2/3
A and B
A= defined $args{"subject"}B= ref $args{"subject"}
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | 7 | $self->{SUBJECT} = $args{subject}; | |||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||
| 38 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 39 | 5 | $self->{SUBJECT} = RPC::Serialized::ACL::Subject->new( $args{subject} ); | |||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||
| 41 | 12 | ▶ | if ( defined $args{target} and ref $args{target} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $args{"target"} and ref $args{"target"}
MC/DC50%1/2
defined $args{"target"} and ref $args{"target"}
defined $args{"target"}
ref $args{"target"}
Truth table66%2/3
A and B
A= defined $args{"target"}B= ref $args{"target"}
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | 7 | $self->{TARGET} = $args{target}; | |||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||
| 44 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 45 | 5 | $self->{TARGET} = RPC::Serialized::ACL::Target->new( $args{target} ); | |||||||||||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||||||||||||
| 47 | 12 | ▶ | if ( defined $args{action} and $args{action} eq 'allow' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $args{"action"} and $args{"action"} eq "allow"
MC/DC50%1/2
defined $args{"action"} and $args{"action"} eq "allow"
defined $args{"action"}
$args{"action"} eq "allow"
Truth table66%2/3
A and B
A= defined $args{"action"}B= $args{"action"} eq "allow"
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | 8 | $self->{ACTION} = ALLOW; | |||||||||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||||||||
| 50 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 51 | 4 | $self->{ACTION} = DENY; | |||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | 12 | return bless $self, $class; | |||||||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | 79 | ▶ | sub operation { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
operation: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 58 | 79 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 59 | 79 | $self->{OPERATION}; | |||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | 60 | ▶ | sub subject { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
subject: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 63 | 60 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 64 | 60 | $self->{SUBJECT}; | |||||||||||||||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||
| 67 | 44 | ▶ | sub target { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
target: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 68 | 44 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 69 | 44 | $self->{TARGET}; | |||||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | 32 | ▶ | sub action { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
action: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 73 | 32 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 74 | 32 | $self->{ACTION}; | |||||||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||
| 77 | 69 | ▶ | sub check { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
check: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 78 | 69 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 79 | 69 | my ( $subject, $operation, $target ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||
| 81 | 69 | ▶ | return DECLINE | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$self->operation->match($operation) and $self->subject->match($subject) and $self->target->match($target)
$self->operation->match($operation) and $self->subject->match($subject)
MC/DC100%3/3
$self->operation->match($operation) and $self->subject->match($subject) and $self->target->match($target)
$self->operation->match($operation)
$self->subject->match($subject)
$self->target->match($target)
Truth table100%4/4
A and B and C
A= $self->operation->match($operation)B= $self->subject->match($subject)C= $self->target->match($target)
| |||||||||||||||||||||||||||||||||||||||||||
| 82 | unless $self->operation->match($operation) | ||||||||||||||||||||||||||||||||||||||||||
| 83 | and $self->subject->match($subject) | ||||||||||||||||||||||||||||||||||||||||||
| 84 | and $self->target->match($target); | ||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | 24 | return $self->action(); | |||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||
| 89 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||