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