@@ -262,7 +262,7 @@ public void traverseFolderAndSharedFolder() throws Exception {
262
262
result = deleteByIdFailsWith4xxStatus (u1 , apiKey , info .getId ());
263
263
}
264
264
265
- // ser shouldn't be able to create content inside these folders either.
265
+ // user shouldn't be able to create content inside these folders either.
266
266
ApiFolder folderPost = new ApiFolder ();
267
267
folderPost .setName ("TestFolder" );
268
268
folderPost .setParentFolderId (sharedId );
@@ -294,6 +294,30 @@ public void traverseFolderAndSharedFolder() throws Exception {
294
294
deleteByIdFailsWith4xxStatus (group .getPi (), piApiKey , getRootFolderForUser (u1 ).getId ());
295
295
}
296
296
297
+ @ Test
298
+ public void listOwnSharedFolderInNonOwnedFolder_RSDEV_488 () throws Exception {
299
+ TestGroup group = createTestGroup (2 );
300
+ User u1 = group .u1 ();
301
+ logoutAndLoginAs (u1 );
302
+ String apiKey = createNewApiKeyForUser (u1 );
303
+
304
+ Long groupSharedFolderId = group .getGroup ().getCommunalGroupFolderId ();
305
+ ApiFolder folderPost = new ApiFolder ();
306
+ folderPost .setName ("u1 test folder in group's shared folder" );
307
+ folderPost .setParentFolderId (groupSharedFolderId );
308
+ MvcResult result = this .mockMvc .perform (folderCreate (u1 , apiKey , folderPost )).andReturn ();
309
+ ApiFolder created = getFromJsonResponseBody (result , ApiFolder .class );
310
+ assertNotNull (created .getId ());
311
+
312
+ // listing of top-level folder works fine for u1 (RSDEV-488)
313
+ ApiRecordTreeItemListing sharedFolderListing =
314
+ performFolderListingById (u1 , apiKey , groupSharedFolderId );
315
+ assertEquals (1 , sharedFolderListing .getTotalHits ().intValue ());
316
+ RecordTreeItemInfo retrievedFolder = sharedFolderListing .getRecords ().get (0 );
317
+ assertEquals (u1 .getUsername (), retrievedFolder .getOwner ().getUsername ());
318
+ assertEquals (groupSharedFolderId , retrievedFolder .getParentFolderId ());
319
+ }
320
+
297
321
private long getIdFromNameForListing (String name , ApiRecordTreeItemListing listing ) {
298
322
return listing .getRecords ().stream ()
299
323
.filter (item -> item .getName ().equals (name ))
0 commit comments