← Index
NYTProf Performance Profile   « block view • line view • sub view »
For /usr/local/src/github.com/foswiki/core/bin/view
  Run on Sun Dec 4 17:17:59 2011
Reported on Sun Dec 4 17:27:21 2011

Filename/usr/local/src/github.com/foswiki/core/lib/Foswiki/If/OP_ingroup.pm
StatementsExecuted 10 statements in 428µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11128µs43µsFoswiki::If::OP_ingroup::::newFoswiki::If::OP_ingroup::new
11128µs35µsFoswiki::If::OP_ingroup::::BEGIN@12Foswiki::If::OP_ingroup::BEGIN@12
11116µs33µsFoswiki::If::OP_ingroup::::BEGIN@13Foswiki::If::OP_ingroup::BEGIN@13
1119µs9µsFoswiki::If::OP_ingroup::::BEGIN@15Foswiki::If::OP_ingroup::BEGIN@15
0000s0sFoswiki::If::OP_ingroup::::evaluateFoswiki::If::OP_ingroup::evaluate
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::If::OP_ingroup
6Test if the user named on the LHS is in the user group named on the RHS.
7
8=cut
9
10package Foswiki::If::OP_ingroup;
11
12245µs242µs
# spent 35µs (28+7) within Foswiki::If::OP_ingroup::BEGIN@12 which was called: # once (28µs+7µs) by Foswiki::If::Parser::BEGIN@26 at line 12
use strict;
# spent 35µs making 1 call to Foswiki::If::OP_ingroup::BEGIN@12 # spent 7µs making 1 call to strict::import
13244µs249µs
# spent 33µs (16+17) within Foswiki::If::OP_ingroup::BEGIN@13 which was called: # once (16µs+17µs) by Foswiki::If::Parser::BEGIN@26 at line 13
use warnings;
# spent 33µs making 1 call to Foswiki::If::OP_ingroup::BEGIN@13 # spent 17µs making 1 call to warnings::import
14
152298µs19µs
# spent 9µs within Foswiki::If::OP_ingroup::BEGIN@15 which was called: # once (9µs+0s) by Foswiki::If::Parser::BEGIN@26 at line 15
use Foswiki::Query::OP ();
# spent 9µs making 1 call to Foswiki::If::OP_ingroup::BEGIN@15
16110µsour @ISA = ('Foswiki::Query::OP');
17
18
# spent 43µs (28+15) within Foswiki::If::OP_ingroup::new which was called: # once (28µs+15µs) by Foswiki::If::Parser::new at line 42 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/If/Parser.pm
sub new {
1912µs my $class = shift;
20125µs114µs return $class->SUPER::new(
# spent 14µs making 1 call to Foswiki::Query::OP::new
21 arity => 2,
22 name => 'ingroup',
23 prec => 600,
24 casematters => 1
25 );
26}
27
28sub evaluate {
29 my $this = shift;
30 my $node = shift;
31 my $a =
32 $node->{params}->[0]
33 ; # user cUID/ loginname / WikiName / WebDotWikiName :( (string)
34 my $b = $node->{params}->[1]; # group name (string
35 my %domain = @_;
36 my $session = $domain{tom}->session;
37 throw Error::Simple(
38 'No context in which to evaluate "' . $a->stringify() . '"' )
39 unless $session;
40 my $user = $session->{users}->getCanonicalUserID( $a->evaluate(@_) );
41 return 0 unless $user;
42 my $group = $b->_evaluate(@_);
43 return 0 unless $group;
44 return 1 if ( $session->{users}->isInGroup( $user, $group ) );
45 return 0;
46}
47
4816µs1;
49__END__