Skip to content

Support container permission inheritance in search SecurityQuery #6833

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

Merged
merged 1 commit into from
Jul 14, 2025
Merged
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
8 changes: 7 additions & 1 deletion search/src/org/labkey/search/model/SecurityQuery.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.apache.lucene.util.FixedBitSet;
import org.jetbrains.annotations.NotNull;
import org.labkey.api.data.Container;
import org.labkey.api.data.ContainerManager;
import org.labkey.api.module.Module;
import org.labkey.api.search.SearchScope;
import org.labkey.api.search.SearchService;
Expand Down Expand Up @@ -168,7 +169,12 @@ private boolean canReadResource(String resourceId, String containerId)

if (null == canRead)
{
SecurableResource sr = new _SecurableResource(resourceId, _containerIds.get(containerId));
// If resourceId represents a Container, then check permissions on it; this is important to ensure that
// permission inheritance is respected. If it's not a Container, then just fake up a SecurableResource.
// This is likely specific to Data Finder, which wants search to check permissions on both the cube
// container and the study container, not a resource that lives within a container. Issue 53420.
Container container = ContainerManager.getForId(resourceId);
SecurableResource sr = null != container ? container : new _SecurableResource(resourceId, _containerIds.get(containerId));
canRead = sr.hasPermission(_user, ReadPermission.class);
_securableResourceIds.put(resourceId, canRead);
}
Expand Down