Bug #995 (closed)
Opened 11 years ago
Closed 11 years ago
Search Filter by owner
| Reported by: | jburel | Owned by: | jamoore |
|---|---|---|---|
| Priority: | blocker | Cc: | |
| Sprint: | n.a. | ||
| Total Remaining Time: | n.a. |
Description
I am doing a basic search on the name of the images
Search service = getSearchService(); service.setAllowLeadingWildcard(true); service.onlyOwnedBy(exp.asExperimenter().getDetails()); where exp = me service.onlyType(Image.class) service.bySomeMustNone(some, must, none); where some = [*API*]
I found images but I am NOT the owner of the returned images.
Change History (3)
comment:1 Changed 11 years ago by jmoore
- Status changed from new to assigned
comment:2 Changed 11 years ago by jmoore
r2450 contains the test.
comment:3 Changed 11 years ago by jmoore
- Resolution set to fixed
- Status changed from assigned to closed
Closing. This seems to be a documentation error on my part. It needs to be clear that: onlyOwnedBy(Details) expects a new Details instance with the Owner set, as opposed to:
onlyOwnedBy( someExperimenter.getDetails() );
See #997 for further work on this.
Jean-Marie, can you verify that this is the problem we're talking about? The following passes currently.
@Test(groups = "ticket:955") public void testIssueOnlyOwnedByReturnsWrongContent() { // Create user which will own the image. String uuid = uuid(); Experimenter owner = loginNewUser(); Details d_owner = Details.create(); d_owner.setOwner(owner); // Add an image as the owner Image i = new Image(); i.setName("Some text " + uuid + " blah blah"); i = this.iUpdate.saveAndReturnObject(i); loginRoot(); this.iUpdate.indexObject(i); // Now login as another user who doesn't own that image Experimenter searcher = loginNewUser(); Details d_searcher = Details.create(); d_searcher.setOwner(searcher); Search search = this.factory.createSearchService(); search.setAllowLeadingWildcard(true); search.onlyOwnedBy(d_searcher); search.onlyType(Image.class); // We shouldn't find any results search.bySomeMustNone(new String[] { "*" + uuid + "*" }, null, null); assertResults(search, 0); search.bySomeMustNone(new String[] { "*blah blah*" }, null, null); assertResults(search, 0); // Now let's change to the owner and see the results search.onlyOwnedBy(d_owner); search.bySomeMustNone(new String[] { "*" + uuid + "*" }, null, null); assertResults(search, 1); search.bySomeMustNone(new String[] { "*blah blah*" }, null, null); assertResults(search, 1); }