File Coverage

blib/lib/SIAM/Privilege.pm
Criterion Covered Total %
statement 23 23 100.0
branch n/a
condition n/a
subroutine 9 9 100.0
pod 3 3 100.0
total 35 35 100.0


line stmt bran cond sub pod time code
1             package SIAM::Privilege;
2              
3 2     2   11 use warnings;
  2         3  
  2         50  
4 2     2   9 use strict;
  2         4  
  2         485  
5              
6 2     2   75 use base 'SIAM::Object';
  2         4  
  2         254  
7              
8 2     2   904 use SIAM::AccessScope;
  2         4  
  2         18  
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 attribute.
24              
25             =cut
26              
27             sub scope_id
28             {
29 10     10 1 16 my $self = shift;
30 10         31 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             {
44 8     8 1 13 my $self = shift;
45 8         13 my $obj = shift;
46              
47 8         29 my $scope = new SIAM::AccessScope($self->_driver, $self->scope_id);
48 8         28 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             {
63 4     4 1 6 my $self = shift;
64 4         6 my $objclass = shift;
65              
66 4         14 return SIAM::AccessScope->matches_all
67             ($self->attr('siam.privilege.access_scope_id'), $objclass);
68             }
69              
70              
71             # mandatory attributes
72              
73             my $mandatory_attributes =
74             [ 'siam.privilege.access_scope_id',
75             'siam.privilege.type' ];
76              
77             sub _mandatory_attributes
78             {
79 16     16   47 return $mandatory_attributes;
80             }
81              
82             sub _manifest_attributes
83             {
84 1     1   5 return $mandatory_attributes;
85             }
86              
87              
88             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: