Skip to content

Commit

Permalink
Fix sessions count
Browse files Browse the repository at this point in the history
  • Loading branch information
guimard committed Dec 15, 2024
1 parent 49d8831 commit fe2fca4
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## v2.20.1-2
* Add "Last-Modified" header for OIDC metadata
* Add hook to modify refresh\_token
* Fix offline sessions count

## v2.20.1-1 _(2024-11-19)_
* Update to 2.20.1
Expand Down
1 change: 1 addition & 0 deletions full/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ RUN \
echo patch matrix-token-exchange.patch && patch -p1 < matrix-token-exchange.patch && \
echo patch globalLogout.patch && patch -p1 < globalLogout.patch && \
echo patch metadata-ttl.patch && patch -p1 < metadata-ttl.patch && \
echo patch fix-sessions-count.patch && patch -p1 <fix-sessions-count.patch && \
rm -f *.patch && \
LLNG_DEFAULTCONFFILE=/etc/lemonldap-ng/lemonldap-ng.ini \
perl -MLemonldap::NG::Manager::Build -e 'Lemonldap::NG::Manager::Build->run( \
Expand Down
19 changes: 19 additions & 0 deletions full/fix-sessions-count.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--- a/usr/share/perl5/Lemonldap/NG/Manager/Sessions.pm
+++ b/usr/share/perl5/Lemonldap/NG/Manager/Sessions.pm
@@ -396,6 +396,7 @@ qq{Use of an uninitialized attribute "$group" to group sessions},
}

# Build result
+ $total = 0;
$res = [
sort {
my @a = ( $a->{value} =~ /^(\d+)(?:\.(\d+))*$/ );
@@ -407,7 +408,7 @@ qq{Use of an uninitialized attribute "$group" to group sessions},
or $a[3] <=> $b[3] )
: $a->{value} cmp $b->{value}
}
- map { { value => $_, count => $r->{$_} } } keys %$r
+ map { $total += $r->{$_}; { value => $_, count => $r->{$_} } } keys %$r
];
}

1 change: 1 addition & 0 deletions manager/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ RUN \
echo patch matrix-token-exchange.patch && patch -p1 < matrix-token-exchange.patch && \
echo patch globalLogout.patch && patch -p1 < globalLogout.patch && \
echo patch metadata-ttl.patch && patch -p1 < metadata-ttl.patch && \
echo patch fix-sessions-count.patch && patch -p1 <fix-sessions-count.patch && \
rm -f *.patch && \
LLNG_DEFAULTCONFFILE=/etc/lemonldap-ng/lemonldap-ng.ini \
perl -MLemonldap::NG::Manager::Build -e 'Lemonldap::NG::Manager::Build->run( \
Expand Down
19 changes: 19 additions & 0 deletions manager/fix-sessions-count.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--- a/usr/share/perl5/Lemonldap/NG/Manager/Sessions.pm
+++ b/usr/share/perl5/Lemonldap/NG/Manager/Sessions.pm
@@ -396,6 +396,7 @@ qq{Use of an uninitialized attribute "$group" to group sessions},
}

# Build result
+ $total = 0;
$res = [
sort {
my @a = ( $a->{value} =~ /^(\d+)(?:\.(\d+))*$/ );
@@ -407,7 +408,7 @@ qq{Use of an uninitialized attribute "$group" to group sessions},
or $a[3] <=> $b[3] )
: $a->{value} cmp $b->{value}
}
- map { { value => $_, count => $r->{$_} } } keys %$r
+ map { $total += $r->{$_}; { value => $_, count => $r->{$_} } } keys %$r
];
}

0 comments on commit fe2fca4

Please sign in to comment.