Add extended functions in locationRules test (may close #924)
This commit is contained in:
parent
2dc1750ce7
commit
ae7febe69d
|
@ -1082,15 +1082,23 @@ qr/^(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-zA-Z0-
|
|||
my ( $val, $conf ) = @_;
|
||||
my $s = $val;
|
||||
$s =~ s/\b(accept|deny)\b/1/g;
|
||||
if ( $conf->{'customFunctions'} ) {
|
||||
foreach my $f (
|
||||
split( /\s+/, $conf->{'customFunctions'}, 0 ) )
|
||||
split(
|
||||
/\s+/,
|
||||
(
|
||||
defined $conf->{'customFunctions'}
|
||||
? "$conf->{'customFunctions'} "
|
||||
: ''
|
||||
)
|
||||
. 'checkLogonHours date checkDate basic unicode2iso iso2unicode groupMatch',
|
||||
0
|
||||
)
|
||||
)
|
||||
{
|
||||
return 0, "__badCustomFuncName__ $f"
|
||||
unless $f =~ /^\w+$/;
|
||||
unless $f =~ /^[a-zA-Z]\w*$/;
|
||||
$s = "sub $f {1} $s";
|
||||
}
|
||||
}
|
||||
eval $s;
|
||||
return $@ ? ( 0, "__badExpression__: $@" ) : 1;
|
||||
}
|
||||
|
|
|
@ -884,14 +884,22 @@ sub attributes {
|
|||
my ( $val, $conf ) = @_;
|
||||
my $s = $val;
|
||||
$s =~ s/\b(accept|deny)\b/1/g;
|
||||
if ( $conf->{customFunctions} ) {
|
||||
foreach my $f ( split /\s+/, $conf->{customFunctions} )
|
||||
foreach my $f (
|
||||
split(
|
||||
/\s+/,
|
||||
(
|
||||
defined $conf->{customFunctions}
|
||||
? "$conf->{customFunctions} "
|
||||
: ''
|
||||
)
|
||||
. 'checkLogonHours date checkDate basic unicode2iso iso2unicode groupMatch',
|
||||
)
|
||||
)
|
||||
{
|
||||
return ( 0, "__badCustomFuncName__ $f" )
|
||||
unless ( $f =~ /^\w+$/ );
|
||||
unless ( $f =~ /^[a-zA-Z]\w*$/ );
|
||||
$s = "sub $f {1} $s";
|
||||
}
|
||||
}
|
||||
eval $s;
|
||||
return $@ ? ( 0, "__badExpression__: $@" ) : (1);
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue
Block a user