← Index
NYTProf Performance Profile   « line view »
For ./view
  Run on Fri Jul 31 18:42:36 2015
Reported on Fri Jul 31 18:48:15 2015

Filename/var/www/foswikidev/core/lib/Foswiki/Access.pm
StatementsExecuted 520 statements in 873µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1111.14ms7.25msFoswiki::Access::::newFoswiki::Access::new
25211299µs299µsFoswiki::Access::::getReasonFoswiki::Access::getReason
11114µs27µsFoswiki::Access::::BEGIN@13Foswiki::Access::BEGIN@13
11112µs46µsFoswiki::Access::::BEGIN@14Foswiki::Access::BEGIN@14
1119µs36µsFoswiki::Access::::BEGIN@16Foswiki::Access::BEGIN@16
1115µs5µsFoswiki::Access::::BEGIN@18Foswiki::Access::BEGIN@18
1113µs3µsFoswiki::Access::::finishFoswiki::Access::finish
0000s0sFoswiki::Access::::haveAccessFoswiki::Access::haveAccess
Call graph for these subroutines as a Graphviz dot language file.
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
7A singleton object of this class manages the access control database.
8
9=cut
10
11package Foswiki::Access;
12
13229µs239µ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
use strict;
# spent 27µs making 1 call to Foswiki::Access::BEGIN@13 # spent 12µs making 1 call to strict::import
14230µs281µ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
use Assert;
# spent 46µs making 1 call to Foswiki::Access::BEGIN@14 # spent 35µs making 1 call to Exporter::import
15
16253µs263µ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
use constant MONITOR => 0;
# 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
BEGIN {
1915µs if ( $Foswiki::cfg{UseLocale} ) {
20 require locale;
21 import locale();
22 }
231229µs15µs}
# spent 5µs making 1 call to Foswiki::Access::BEGIN@18
24
25=begin TML
26
27---++ ClassMethod new($session)
28
29Constructor.
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
sub new {
341900ns my ( $class, $session ) = @_;
35 ASSERT( $session->isa('Foswiki') ) if DEBUG;
3611µs my $imp = $Foswiki::cfg{AccessControl} || 'Foswiki::Access::TopicACLAccess';
37
38 print STDERR "using $imp Access Control\n" if MONITOR;
39
40120µs my $ok = eval("require $imp; 1;");
# spent 66µs executing statements in string eval
41 ASSERT( $ok, $@ ) if DEBUG;
4214µs110µs my $this = $imp->new($session);
# spent 10µs making 1 call to Foswiki::Access::TopicACLAccess::new
43 ASSERT($this) if DEBUG;
44
4513µs return $this;
46}
47
48=begin TML
49
50---++ ObjectMethod finish()
51Break 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
sub finish {
591700ns my $this = shift;
6011µs undef $this->{failure};
6115µs undef $this->{session};
62}
63
64=begin TML
65
66---++ ObjectMethod getReason() -> $string
67
68Return a string describing the reason why the last access control failure
69occurred.
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
sub getReason {
7425258µs my $this = shift;
75252431µ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)
86Check if the user has the given mode of access to the topic. This call
87may result in the topic being read.
88
89=cut
90
91sub haveAccess {
92 die 'base class';
93}
94
9512µs1;
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.