GitHub Issue 1028: Can't delete a sample when any sample in the sample type has been linked to study#7572
Open
XingY wants to merge 3 commits intorelease26.3-SNAPSHOTfrom
Open
GitHub Issue 1028: Can't delete a sample when any sample in the sample type has been linked to study#7572XingY wants to merge 3 commits intorelease26.3-SNAPSHOTfrom
XingY wants to merge 3 commits intorelease26.3-SNAPSHOTfrom
Conversation
…e type has been linked to study
cnathe
requested changes
Apr 10, 2026
| SimpleFilter filter = new SimpleFilter(FieldKey.fromParts(ExpMaterialTable.Column.RowId.toString()), material.getRowId()); | ||
| String lsid = new TableSelector(tableInfo, singleton("LSID"), filter, null).getObject(String.class); | ||
| UserSchema schemaWithReadPerm = QueryService.get().getUserSchema(userWithReadPerm, dataset.getContainer(), "study"); | ||
| TableInfo tableInfoForRead = schemaWithReadPerm.getTable(dataset.getName()); |
Contributor
There was a problem hiding this comment.
we have a null check on the tableInfo for the dataset below. Do we need it for this tableInfoForRead case as well?
| UserSchema schema = QueryService.get().getUserSchema(user, dataset.getContainer(), "study"); | ||
| TableInfo tableInfo = schema.getTable(dataset.getName()); | ||
| // Need Read permission to check for linked samples | ||
| User userWithReadPerm = ElevatedUser.getElevatedUser(user, ReaderRole.class); |
Contributor
There was a problem hiding this comment.
minor: this could be moved outside of the for loop instead of creating the elevated user for each container loop.
|
|
||
| // Create sample timeline event for each of the samples | ||
| if (sourceType == Dataset.PublishSource.SampleType && pairs != null) | ||
| if (sourceType == Dataset.PublishSource.SampleType && rowIds != null && rowIds.isEmpty()) |
Contributor
There was a problem hiding this comment.
shouldn't this be && !rowIds.isEmpty()? it is missing the "not" part, right?
Contributor
Author
There was a problem hiding this comment.
Good catch. Fix and added selenium test.
cnathe
approved these changes
Apr 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale
Issue link
Users shouldn't need permission on the linked study container to delete samples that are not linked.
Related Pull Requests
Changes