Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix incorrect filtering logic in QuerySessionsAsync #946

Merged
merged 1 commit into from
Jul 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/EntityFramework.Storage/Stores/ServerSideSessionStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,8 @@ public virtual async Task<QueryResult<ServerSideSession>> QuerySessionsAsync(Ses
!String.IsNullOrWhiteSpace(filter.SessionId))
{
query = query.Where(x =>
(filter.SubjectId == null || x.SubjectId.Contains(filter.SubjectId)) ||
(filter.SessionId == null || x.SessionId.Contains(filter.SessionId)) ||
(filter.SubjectId == null || x.SubjectId.Contains(filter.SubjectId)) &&
(filter.SessionId == null || x.SessionId.Contains(filter.SessionId)) &&
(filter.DisplayName == null || (x.DisplayName != null && x.DisplayName.Contains(filter.DisplayName) == true))
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ public Task<QueryResult<ServerSideSession>> QuerySessionsAsync(SessionQuery filt
!String.IsNullOrWhiteSpace(filter.SessionId))
{
query = query.Where(x =>
(filter.SubjectId == null || x.SubjectId.Contains(filter.SubjectId)) ||
(filter.SessionId == null || x.SessionId.Contains(filter.SessionId)) ||
(filter.SubjectId == null || x.SubjectId.Contains(filter.SubjectId)) &&
(filter.SessionId == null || x.SessionId.Contains(filter.SessionId)) &&
(filter.DisplayName == null || (x.DisplayName != null && x.DisplayName.Contains(filter.DisplayName) == true))
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,13 @@ public async Task querysessions_on_ticket_store_should_use_session_store()
_pipeline.RemoveLoginCookie();
await _pipeline.LoginAsync("alice");
_pipeline.RemoveLoginCookie();
await _pipeline.LoginAsync("alice");
await _pipeline.LoginAsync("bob");
_pipeline.RemoveLoginCookie();

var tickets = await _ticketService.QuerySessionsAsync(new SessionQuery { SubjectId = "alice" });
tickets.TotalCount.Should().Be(2);
var sessions = await _sessionStore.QuerySessionsAsync(new SessionQuery { SubjectId = "alice" });
sessions.TotalCount.Should().Be(2);

tickets.ResultsToken.Should().Be(sessions.ResultsToken);
tickets.HasPrevResults.Should().Be(sessions.HasPrevResults);
Expand Down