Filename | /var/www/foswiki11/lib/Foswiki/If/OP_ingroup.pm |
Statements | Executed 10 statements in 356µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 23µs | 48µs | new | Foswiki::If::OP_ingroup::
1 | 1 | 1 | 21µs | 39µs | BEGIN@11 | Foswiki::If::OP_ingroup::
1 | 1 | 1 | 12µs | 19µs | BEGIN@12 | Foswiki::If::OP_ingroup::
1 | 1 | 1 | 5µs | 5µs | BEGIN@14 | Foswiki::If::OP_ingroup::
0 | 0 | 0 | 0s | 0s | evaluate | Foswiki::If::OP_ingroup::
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 | ||||
6 | |||||
7 | =cut | ||||
8 | |||||
9 | package Foswiki::If::OP_ingroup; | ||||
10 | |||||
11 | 2 | 38µs | 2 | 58µs | # spent 39µs (21+18) within Foswiki::If::OP_ingroup::BEGIN@11 which was called:
# once (21µs+18µs) by Foswiki::If::Parser::new at line 11 # spent 39µs making 1 call to Foswiki::If::OP_ingroup::BEGIN@11
# spent 18µs making 1 call to strict::import |
12 | 2 | 38µs | 2 | 26µs | # spent 19µs (12+7) within Foswiki::If::OP_ingroup::BEGIN@12 which was called:
# once (12µs+7µs) by Foswiki::If::Parser::new at line 12 # spent 19µs making 1 call to Foswiki::If::OP_ingroup::BEGIN@12
# spent 7µs making 1 call to warnings::import |
13 | |||||
14 | 2 | 245µs | 1 | 5µs | # spent 5µs within Foswiki::If::OP_ingroup::BEGIN@14 which was called:
# once (5µs+0s) by Foswiki::If::Parser::new at line 14 # spent 5µs making 1 call to Foswiki::If::OP_ingroup::BEGIN@14 |
15 | 1 | 9µs | our @ISA = ('Foswiki::Query::BinaryOP'); | ||
16 | |||||
17 | # spent 48µs (23+24) within Foswiki::If::OP_ingroup::new which was called:
# once (23µs+24µs) by Foswiki::If::Parser::new at line 31 of /var/www/foswiki11/lib/Foswiki/If/Parser.pm | ||||
18 | 1 | 800ns | my $class = shift; | ||
19 | 1 | 22µs | 1 | 24µs | return $class->SUPER::new( # spent 24µs making 1 call to Foswiki::Query::BinaryOP::new |
20 | name => 'ingroup', | ||||
21 | prec => 600, | ||||
22 | casematters => 1 | ||||
23 | ); | ||||
24 | } | ||||
25 | |||||
26 | sub evaluate { | ||||
27 | my $this = shift; | ||||
28 | my $node = shift; | ||||
29 | my $a = | ||||
30 | $node->{params}->[0] | ||||
31 | ; # user cUID/ loginname / WikiName / WebDotWikiName :( (string) | ||||
32 | my $b = $node->{params}->[1]; # group name (string | ||||
33 | my %domain = @_; | ||||
34 | my $session = $domain{tom}->session; | ||||
35 | throw Error::Simple( | ||||
36 | 'No context in which to evaluate "' . $a->stringify() . '"' ) | ||||
37 | unless $session; | ||||
38 | my $user = $session->{users}->getCanonicalUserID( $a->evaluate(@_) ); | ||||
39 | return 0 unless $user; | ||||
40 | my $group = $b->_evaluate(@_); | ||||
41 | return 0 unless $group; | ||||
42 | return 1 if ( $session->{users}->isInGroup( $user, $group ) ); | ||||
43 | return 0; | ||||
44 | } | ||||
45 | |||||
46 | 1 | 4µs | 1; | ||
47 | __END__ |