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

QA-15289: GraphQL JCRSite query with restricted home page #464

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

baptistegrimaud
Copy link
Contributor

@baptistegrimaud baptistegrimaud commented Oct 2, 2024

JIRA

https://jira.jahia.org/browse/QA-15289

Description

Gracefully handle scenarios where the home page has restricted access by returning null for the homePage field of the GraphQL JCRSite query.

Depends on #465.

Tests

The following are included in this PR

  • Unit Tests (Most changes should have unit tests)
  • Integration Tests

Checklist

I have considered the following implications of my change:

  • Security (in particular for changes to authentication, authorization, data fetching, ...)
  • Performance
  • Migration
  • Code maintainability

Documentation

  • Inline documentation
  • Internal Documentation (wiki)
  • User-facing Documentation

Gracefully handle scenarios where the home page has restricted access by returning null for the homePage field of the GraphQL JCRSite query.
@@ -46,7 +47,9 @@ static DXPaginatedData<GqlGroup> getGroupMembership(String localPath,

List<String> paths = groupManagerService.getMembershipByPath(localPath);
Stream<GqlGroup> stream = paths.stream()
.map(path -> groupManagerService.lookupGroupByPath(path).getJahiaGroup())
.map(groupManagerService::lookupGroupByPath)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lookupGroupByPath() can return null (if the group does not exist anymore).
In the new test (site.cy.ts), a new site is created which also creates a new group for it.
And because groupManagerService.getMembershipByPath(localPath) gets the list from a cache (which for some reasons is not flushed when the site is deleted), it's returning a group that no longer exists.
Which was causing an existing test to fail (user.cy.ts)

@baptistegrimaud baptistegrimaud marked this pull request as draft October 4, 2024 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant