Rename internal has2f method to avoid conflict in perlExpr test (#2691)

This commit is contained in:
Maxime Besson 2022-02-03 15:48:22 +01:00
parent 3a2ae337df
commit 0dc995e411
4 changed files with 5 additions and 5 deletions

View File

@ -18,7 +18,7 @@ our $VERSION = '2.0.12';
# Not that only functions, not methods, can be written here
our $functions =
[
qw(&checkLogonHours &date &dateToTime &checkDate &basic &unicode2iso &iso2unicode &groupMatch &isInNet6 &varIsInUri &has2f)
qw(&checkLogonHours &date &dateToTime &checkDate &basic &unicode2iso &iso2unicode &groupMatch &isInNet6 &varIsInUri &has2f_internal)
];
## @function boolean checkLogonHours(string logon_hours, string syntax, string time_correction, boolean default_access)
@ -244,7 +244,7 @@ sub varIsInUri {
my $json = JSON::XS->new;
sub has2f {
sub has2f_internal {
my ( $session, $type ) = @_;
return 0 unless $session->{_2fDevices};

View File

@ -658,7 +658,7 @@ sub substitute {
$expr =~ s/\binGroup\(([^)]*)\)/listMatch(\$s->{'hGroups'},$1,1)/g;
# handle has2f
$expr =~ s/\bhas2f\(([^),]*)\)/has2f(\$s,$1)/g;
$expr =~ s/\bhas2f\(([^),]*)\)/has2f_internal(\$s,$1)/g;
return $expr;
}

View File

@ -69,7 +69,7 @@ ok(
ok( $res = &$code, "Function works" );
ok( $res == 1, 'Get good result' );
$sub = "sub { return(has2f(\$_[0],\$_[1])) }";
$sub = "sub { return(has2f_internal(\$_[0],\$_[1])) }";
$code = $jail->jail_reval($sub);
ok(
( defined($code) and ref($code) eq 'CODE' ),

View File

@ -62,7 +62,7 @@ ok( ( defined($listMatch) and ref($listMatch) eq 'CODE' ),
ok( &$listMatch eq '0', 'Get good result' );
# Test has2f method
my $sub7 = "sub { return(has2f(\$_[0],\$_[1])) }";
my $sub7 = "sub { return(has2f_internal(\$_[0],\$_[1])) }";
my $has2f = $jail->jail_reval($sub7);
ok(
( defined($has2f) and ref($has2f) eq 'CODE' ),