merge-requests/133/head
Christophe Maudoux 6 years ago
parent d20c5efb35
commit 6f2e5c1811
  1. 10
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/Notifications/JSON.pm
  2. 11
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/Notifications/XML.pm

@ -150,8 +150,8 @@ sub getNotifBack {
my $uid = $req->sessionInfo->{ $self->notifObject->notifField };
# ALL notifications are returned here => Need to check active ones only
my ( $notifs, $forUser );
eval { ( $notifs, $forUser ) = $self->notifObject->getNotifications($uid) };
my ( $notifs, $forUser ) =
eval { $self->notifObject->getNotifications($uid) };
return $self->p->sendError( $req, $@, 500 ) if ($@);
if ($notifs) {
@ -327,10 +327,8 @@ sub notificationServer {
$res = [];
foreach my $notif ( keys %$notifs ) {
$self->p->logger->debug("Found notification $notif");
my $json;
eval {
$json = from_json( $notifs->{$notif}, { allow_nonref => 1 } );
};
my $json =
eval { from_json( $notifs->{$notif}, { allow_nonref => 1 } ) };
return $self->p->sendError( $req, "Unable to decode JSON file: $@",
400 )
if ($@);

@ -198,8 +198,8 @@ sub getNotifBack {
my $uid = $req->sessionInfo->{ $self->notifObject->notifField };
# ALL notifications are returned here => Need to check active ones only
my ( $notifs, $forUser );
eval { ( $notifs, $forUser ) = $self->notifObject->getNotifications($uid) };
my ( $notifs, $forUser ) =
eval { $self->notifObject->getNotifications($uid) };
return $self->p->sendError( $req, $@, 500 ) if ($@);
if ($notifs) {
@ -225,7 +225,8 @@ sub getNotifBack {
my $xml = $self->parser->parse_string($file);
# Get pending notifications and verify that they have been accepted
LOOP: foreach my $notif (
LOOP:
foreach my $notif (
$xml->documentElement->getElementsByTagName('notification') )
{
my $reference = $notif->getAttribute('reference');
@ -239,7 +240,7 @@ sub getNotifBack {
}
unless ( $date le $now ) {
$self->logger->debug('Notification date not reached');
$fileResult = 0; # Do not delete notification
$fileResult = 0; # Do not delete notification
next LOOP;
}
@ -257,7 +258,7 @@ sub getNotifBack {
unless ( $condition->( $req, $req->sessionInfo ) ) {
$self->logger->debug(
'Notification condition not authorized');
$fileResult = 0; # Do not delete notification
$fileResult = 0; # Do not delete notification
next LOOP;
}
}

Loading…
Cancel
Save