Filename | /var/www/foswikidev/core/lib/Foswiki/Access.pm |
Statements | Executed 520 statements in 873µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 1.14ms | 7.25ms | new | Foswiki::Access::
252 | 1 | 1 | 299µs | 299µs | getReason | Foswiki::Access::
1 | 1 | 1 | 14µs | 27µs | BEGIN@13 | Foswiki::Access::
1 | 1 | 1 | 12µs | 46µs | BEGIN@14 | Foswiki::Access::
1 | 1 | 1 | 9µs | 36µs | BEGIN@16 | Foswiki::Access::
1 | 1 | 1 | 5µs | 5µs | BEGIN@18 | Foswiki::Access::
1 | 1 | 1 | 3µs | 3µs | finish | Foswiki::Access::
0 | 0 | 0 | 0s | 0s | haveAccess | Foswiki::Access::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | # See bottom of file for license and copyright information | ||||
2 | |||||
3 | =begin TML | ||||
4 | |||||
5 | ---+ package Foswiki::Access | ||||
6 | |||||
7 | A singleton object of this class manages the access control database. | ||||
8 | |||||
9 | =cut | ||||
10 | |||||
11 | package Foswiki::Access; | ||||
12 | |||||
13 | 2 | 29µs | 2 | 39µs | # spent 27µs (14+12) within Foswiki::Access::BEGIN@13 which was called:
# once (14µs+12µs) by Foswiki::access at line 13 # spent 27µs making 1 call to Foswiki::Access::BEGIN@13
# spent 12µs making 1 call to strict::import |
14 | 2 | 30µs | 2 | 81µs | # spent 46µs (12+35) within Foswiki::Access::BEGIN@14 which was called:
# once (12µs+35µs) by Foswiki::access at line 14 # spent 46µs making 1 call to Foswiki::Access::BEGIN@14
# spent 35µs making 1 call to Exporter::import |
15 | |||||
16 | 2 | 53µs | 2 | 63µs | # spent 36µs (9+27) within Foswiki::Access::BEGIN@16 which was called:
# once (9µs+27µs) by Foswiki::access at line 16 # spent 36µs making 1 call to Foswiki::Access::BEGIN@16
# spent 27µs making 1 call to constant::import |
17 | |||||
18 | # spent 5µs within Foswiki::Access::BEGIN@18 which was called:
# once (5µs+0s) by Foswiki::access at line 23 | ||||
19 | 1 | 5µs | if ( $Foswiki::cfg{UseLocale} ) { | ||
20 | require locale; | ||||
21 | import locale(); | ||||
22 | } | ||||
23 | 1 | 229µs | 1 | 5µs | } # spent 5µs making 1 call to Foswiki::Access::BEGIN@18 |
24 | |||||
25 | =begin TML | ||||
26 | |||||
27 | ---++ ClassMethod new($session) | ||||
28 | |||||
29 | Constructor. | ||||
30 | |||||
31 | =cut | ||||
32 | |||||
33 | # spent 7.25ms (1.14+6.11) within Foswiki::Access::new which was called:
# once (1.14ms+6.11ms) by Foswiki::access at line 2441 of /var/www/foswikidev/core/lib/Foswiki.pm | ||||
34 | 1 | 900ns | my ( $class, $session ) = @_; | ||
35 | ASSERT( $session->isa('Foswiki') ) if DEBUG; | ||||
36 | 1 | 1µs | my $imp = $Foswiki::cfg{AccessControl} || 'Foswiki::Access::TopicACLAccess'; | ||
37 | |||||
38 | print STDERR "using $imp Access Control\n" if MONITOR; | ||||
39 | |||||
40 | 1 | 20µs | my $ok = eval("require $imp; 1;"); # spent 66µs executing statements in string eval | ||
41 | ASSERT( $ok, $@ ) if DEBUG; | ||||
42 | 1 | 4µs | 1 | 10µs | my $this = $imp->new($session); # spent 10µs making 1 call to Foswiki::Access::TopicACLAccess::new |
43 | ASSERT($this) if DEBUG; | ||||
44 | |||||
45 | 1 | 3µs | return $this; | ||
46 | } | ||||
47 | |||||
48 | =begin TML | ||||
49 | |||||
50 | ---++ ObjectMethod finish() | ||||
51 | Break circular references. | ||||
52 | |||||
53 | =cut | ||||
54 | |||||
55 | # Note to developers; please undef *all* fields in the object explicitly, | ||||
56 | # whether they are references or not. That way this method is "golden | ||||
57 | # documentation" of the live fields in the object. | ||||
58 | # spent 3µs within Foswiki::Access::finish which was called:
# once (3µs+0s) by Foswiki::finish at line 2488 of /var/www/foswikidev/core/lib/Foswiki.pm | ||||
59 | 1 | 700ns | my $this = shift; | ||
60 | 1 | 1µs | undef $this->{failure}; | ||
61 | 1 | 5µs | undef $this->{session}; | ||
62 | } | ||||
63 | |||||
64 | =begin TML | ||||
65 | |||||
66 | ---++ ObjectMethod getReason() -> $string | ||||
67 | |||||
68 | Return a string describing the reason why the last access control failure | ||||
69 | occurred. | ||||
70 | |||||
71 | =cut | ||||
72 | |||||
73 | # spent 299µs within Foswiki::Access::getReason which was called 252 times, avg 1µs/call:
# 252 times (299µs+0s) by Foswiki::Meta::haveAccess at line 1926 of /var/www/foswikidev/core/lib/Foswiki/Meta.pm, avg 1µs/call | ||||
74 | 252 | 58µs | my $this = shift; | ||
75 | 252 | 431µs | return $this->{failure}; | ||
76 | } | ||||
77 | |||||
78 | =begin TML | ||||
79 | |||||
80 | ---++ ObjectMethod haveAccess($mode, $User, $web, $topic, $attachment) -> $boolean | ||||
81 | ---++ ObjectMethod haveAccess($mode, $User, $meta) -> $boolean | ||||
82 | ---++ ObjectMethod haveAccess($mode, $User, $address) -> $boolean | ||||
83 | |||||
84 | * =$mode= - 'VIEW', 'CHANGE', 'CREATE', etc. (defaults to VIEW) | ||||
85 | * =$cUID= - Canonical user id (defaults to current user) | ||||
86 | Check if the user has the given mode of access to the topic. This call | ||||
87 | may result in the topic being read. | ||||
88 | |||||
89 | =cut | ||||
90 | |||||
91 | sub haveAccess { | ||||
92 | die 'base class'; | ||||
93 | } | ||||
94 | |||||
95 | 1 | 2µs | 1; | ||
96 | |||||
97 | # Module of Foswiki - The Free and Open Source Wiki, http://foswiki.org/ | ||||
98 | # | ||||
99 | # Copyright (C) 2008-2011 Foswiki Contributors. Foswiki Contributors | ||||
100 | # are listed in the AUTHORS file in the root of this distribution. | ||||
101 | # NOTE: Please extend that file, not this notice. | ||||
102 | # | ||||
103 | # Additional copyrights apply to some or all of the code in this | ||||
104 | # file as follows: | ||||
105 | # | ||||
106 | # Copyright (C) 1999-2007 Peter Thoeny, peter@thoeny.org | ||||
107 | # and TWiki Contributors. All Rights Reserved. TWiki Contributors | ||||
108 | # are listed in the AUTHORS file in the root of this distribution. | ||||
109 | # | ||||
110 | # This program is free software; you can redistribute it and/or | ||||
111 | # modify it under the terms of the GNU General Public License | ||||
112 | # as published by the Free Software Foundation; either version 2 | ||||
113 | # of the License, or (at your option) any later version. For | ||||
114 | # more details read LICENSE in the root of this distribution. | ||||
115 | # | ||||
116 | # This program is distributed in the hope that it will be useful, | ||||
117 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
118 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||||
119 | # | ||||
120 | # As per the GPL, removal of this notice is prohibited. |