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

Filename/var/www/foswikidev/core/lib/Foswiki/Configure/Auth.pm
StatementsExecuted 11 statements in 440µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111231µs297µsFoswiki::Configure::Auth::::BEGIN@7Foswiki::Configure::Auth::BEGIN@7
11111µs31µsFoswiki::Configure::Auth::::BEGIN@6Foswiki::Configure::Auth::BEGIN@6
11110µs10µsFoswiki::Configure::Auth::::BEGIN@5Foswiki::Configure::Auth::BEGIN@5
1118µs20µsFoswiki::Configure::Auth::::BEGIN@17Foswiki::Configure::Auth::BEGIN@17
1118µs12µsFoswiki::Configure::Auth::::BEGIN@18Foswiki::Configure::Auth::BEGIN@18
0000s0sFoswiki::Configure::Auth::::checkAccessFoswiki::Configure::Auth::checkAccess
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
3package Foswiki::Configure::Auth;
4
5234µs110µs
# spent 10µs within Foswiki::Configure::Auth::BEGIN@5 which was called: # once (10µs+0s) by Foswiki::Plugins::ConfigurePlugin::BEGIN@37 at line 5
use Foswiki::Func;
# spent 10µs making 1 call to Foswiki::Configure::Auth::BEGIN@5
6231µs252µs
# spent 31µs (11+21) within Foswiki::Configure::Auth::BEGIN@6 which was called: # once (11µs+21µs) by Foswiki::Plugins::ConfigurePlugin::BEGIN@37 at line 6
use Foswiki::AccessControlException;
# spent 31µs making 1 call to Foswiki::Configure::Auth::BEGIN@6 # spent 21µs making 1 call to Error::import
72116µs2318µs
# spent 297µs (231+66) within Foswiki::Configure::Auth::BEGIN@7 which was called: # once (231µs+66µs) by Foswiki::Plugins::ConfigurePlugin::BEGIN@37 at line 7
use Foswiki::Contrib::JsonRpcContrib::Error;
# spent 297µs making 1 call to Foswiki::Configure::Auth::BEGIN@7 # spent 21µs making 1 call to Error::import
8
9=begin TML
10
11---+ package Foswiki::Configure::Auth
12
13Implements authorization checking for access to configure.
14
15=cut
16
17223µs232µs
# spent 20µs (8+12) within Foswiki::Configure::Auth::BEGIN@17 which was called: # once (8µs+12µs) by Foswiki::Plugins::ConfigurePlugin::BEGIN@37 at line 17
use strict;
# spent 20µs making 1 call to Foswiki::Configure::Auth::BEGIN@17 # spent 12µs making 1 call to strict::import
182233µs215µs
# spent 12µs (8+4) within Foswiki::Configure::Auth::BEGIN@18 which was called: # once (8µs+4µs) by Foswiki::Plugins::ConfigurePlugin::BEGIN@37 at line 18
use warnings;
# spent 12µs making 1 call to Foswiki::Configure::Auth::BEGIN@18 # spent 4µs making 1 call to warnings::import
19
20=begin TML
21
22---++ StaticMethod checkAccess( $session, $die )
23
24Throws an AccessControlException if access is denied.
25
26=cut
27
28sub checkAccess {
29 my $session = shift;
30 my $json = shift; # JSON needs throw JSON errors.
31
32 return
33 if ( defined $Foswiki::cfg{LoginManager}
34 && $Foswiki::cfg{LoginManager} eq 'none' );
35
36 my $wikiname = Foswiki::Func::getWikiName( $session->{user} );
37
38 return
39 if ( defined $Foswiki::cfg{AdminUserWikiName}
40 && $Foswiki::cfg{AdminUserWikiName} eq $wikiname );
41
42 if ( defined $Foswiki::cfg{FeatureAccess}{Configure}
43 && length( $Foswiki::cfg{FeatureAccess}{Configure} ) )
44 {
45 my $authorized = '';
46 foreach my $authuser (
47 split( /[,\s]/, $Foswiki::cfg{FeatureAccess}{Configure} ) )
48 {
49 if ( $wikiname eq $authuser ) {
50 $authorized = 1;
51 last;
52 }
53 }
54 unless ($authorized) {
55 if ($json) {
56 throw Foswiki::Contrib::JsonRpcContrib::Error( -32600,
57'Access to configure denied by {FeatureAccess}{Configure} Setting'
58 );
59 }
60 else {
61 throw Foswiki::AccessControlException( 'VIEW',
62 $session->{user}, 'System', 'Configuration',
63 'Denied by {FeatureAccess}{Configure} Setting' );
64 }
65 }
66 }
67 else {
68 unless ( Foswiki::Func::isAnAdmin() ) {
69 if ($json) {
70 throw Foswiki::Contrib::JsonRpcContrib::Error( -32600,
71 'Access to configure denied for non-admin users' );
72 }
73 else {
74 throw Foswiki::AccessControlException( 'VIEW',
75 $session->{user}, 'System', 'Configuration',
76 'Not an admin' );
77 }
78 }
79 }
80}
81
8212µs1;
83__END__