This commit is contained in:
Xavier Guimard 2010-10-03 19:58:07 +00:00
parent 84a56ef1d8
commit f570afbad1
2 changed files with 46 additions and 2 deletions

View File

@ -338,7 +338,7 @@ s/^(samlSPMetaDataXML|samlSPMetaDataExportedAttributes|samlSPMetaDataOptions)\/(
} # END LOOP
# 1.4 Loading unchanged parameters (ajax nodes not open)
$self->lmLog( "Save unchanged parameters", 'debug' );
$self->lmLog( "Restore unchanged parameters", 'debug' );
foreach ( @{ $result->getChildrenByTagName('ignore') } ) {
my $node = $_->getAttribute('value');
$node =~ s/^.*node=(.*?)(?:&.*)?\}$/$1/;
@ -356,7 +356,28 @@ s/^(samlSPMetaDataXML|samlSPMetaDataExportedAttributes|samlSPMetaDataOptions)\/(
}
}
# 1.5 Author attributes for accounting
# 1.5 Global tests
$self->lmLog( "Launch global tests", 'debug' );
{
my $tests = $self->globalTests($newConf);
while ( my ( $name, $sub ) = each %$tests ) {
my ( $res, $msg );
eval {
( $res, $msg ) = $sub->();
if ($res) {
if ($msg) {
$errors->{warnings}->{$name} = $msg;
}
}
else {
$errors->{error}->{$name} = $msg;
}
};
$errors->{warnings}->{$name} = "Test $name failed" if($@);
}
}
# 1.6 Author attributes for accounting
$newConf->{cfgAuthor} = $ENV{REMOTE_USER} || 'anonymous';
$newConf->{cfgAuthorIP} = $ENV{REMOTE_ADDR};
$newConf->{cfgDate} = time();

View File

@ -1782,4 +1782,27 @@ sub subDefaultConf {
};
}
## @method hashref globalTests(hashref conf)
# Return a hash ref where keys are the names of the tests and values
# subroutines to execute
# @param $conf Configuration to test
# @return hash ref where keys are the names of the tests and values
sub globalTests {
my ( $self, $conf ) = splice @_;
return {
'portalIsInDomain' => sub {
# TODO: better parsing
return (
1,
(
index( $conf->{portal}, $conf->{domain} ) > 0
? ''
: "Portal seems not to be in the domain $conf->{domain}"
)
);
},
};
}
1;