SIAM/Privilege.pm

filter: Statementstmt 100% 25 / 25 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 9 / 9 Podpod 100% 3 / 3 totaltotal 100% 37 / 37 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« SIAM/Device.pm ↑ Summary SIAM/Service.pm »
1 package SIAM::Privilege;
2  
3 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 3 ▶use base 'SIAM::Object';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 3 ▶use SIAM::AccessScope;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10  
11 =head1 NAME
12  
13 SIAM::Privilege - Privilege object class
14  
15 =head1 SYNOPSIS
16  
17  
18 =head1 METHODS
19  
20  
21 =head2 scope_id
22  
23 Retrurns the value of C<siam.privilege.access_scope_id> attribute.
24  
25 =cut
26  
27 sub scope_id
28 10 ▶{
Subroutine scope_id: called CC=1 SCAR=0.0
Pod documented
29 10 my $self = shift;
30 10 return $self->attr('siam.privilege.access_scope_id');
31 }
32  
33  
34 =head2 match_object
35  
36 Expects an object as an argument. Returns true if the object matches the
37 related scope.
38  
39 =cut
40  
41  
42 sub match_object
43 8 ▶{
Subroutine match_object: called CC=1 SCAR=0.0
Pod documented
44 8 my $self = shift;
45 8 my $obj = shift;
46  
47 8 my $scope = new SIAM::AccessScope($self->_driver, $self->scope_id);
48 8 return $scope->match_object($obj);
49 }
50  
51  
52  
53 =head2 matches_all
54  
55 Takes an object class. Returns true if the privilege is associated with
56 a match-all scope for a given class.
57  
58 =cut
59  
60  
61 sub matches_all
62 4 ▶{
Subroutine matches_all: called CC=1 SCAR=0.0
Pod documented
63 4 my $self = shift;
64 4 my $objclass = shift;
65  
66 4 return SIAM::AccessScope->matches_all
67 ($self->attr('siam.privilege.access_scope_id'), $objclass);
68 }
69  
70  
71 # mandatory attributes
72  
73 3 my $mandatory_attributes =
74 [ 'siam.privilege.access_scope_id',
75 'siam.privilege.type' ];
76  
77 sub _mandatory_attributes
78 16 ▶{
Subroutine _mandatory_attributes: called CC=1 SCAR=0.0
79 16 return $mandatory_attributes;
80 }
81  
82 sub _manifest_attributes
83 1 ▶{
Subroutine _manifest_attributes: called CC=1 SCAR=0.0
84 1 return $mandatory_attributes;
85 }
86  
87  
88 3 1;
89  
90 # Local Variables:
91 # mode: cperl
92 # indent-tabs-mode: nil
93 # cperl-indent-level: 4
94 # cperl-continued-statement-offset: 4
95 # cperl-continued-brace-offset: -4
96 # cperl-brace-offset: 0
97 # cperl-label-offset: -2
98 # End:
« SIAM/Device.pm ↑ Summary SIAM/Service.pm »