ACLStorageProvider implements StorageProvider { @Override public Iterator<String> getSpaces() { DuracloudUserDetails user = getCurrentUserDetails(); if (isAdmin(user)) { return targetProvider.getSpaces(); } waitForCache(); List<String> spaces = new ArrayList<String>(); for (String space : spaceACLMap.keySet()) { Map<String, AclType> acls = spaceACLMap.get(space); if (userHasAccess(user, acls) && !spaces.contains(space)) { spaces.add(space); } } Collections.sort(spaces); return spaces.iterator(); } ACLStorageProvider(StorageProvider targetProvider,
                              AccountChangeNotifier notifier,
                              DuraCloudRequestContextUtil requestContextUtil);  ACLStorageProvider(StorageProvider targetProvider,
                              SecurityContextUtil securityContextUtil,
                              AccountChangeNotifier notifier,
                              DuraCloudRequestContextUtil requestContextUtil); @Override StorageProviderType getStorageProviderType(); @Override Iterator<String> getSpaces(); @Override Iterator<String> getSpaceContents(String spaceId, String prefix); @Override List<String> getSpaceContentsChunked(String spaceId,
                                                String prefix,
                                                long maxResults,
                                                String marker); @Override void createSpace(String spaceId); @Override void deleteSpace(String spaceId); @Override Map<String, String> getSpaceProperties(String spaceId); @Override Map<String, AclType> getSpaceACLs(String spaceId); @Override void setSpaceACLs(String spaceId, Map<String, AclType> spaceACLs); @Override String addContent(String spaceId,
                             String contentId,
                             String contentMimeType,
                             Map<String, String> userProperties,
                             long contentSize,
                             String contentChecksum,
                             InputStream content); @Override String copyContent(String sourceSpaceId,
                              String sourceContentId,
                              String destSpaceId,
                              String destContentId); @Override RetrievedContent getContent(String spaceId, String contentId); @Override RetrievedContent getContent(String spaceId, String contentId, String range); @Override void deleteContent(String spaceId, String contentId); @Override void setContentProperties(String spaceId,
                                     String contentId,
                                     Map<String, String> contentProperties); @Override Map<String, String> getContentProperties(String spaceId,
                                                    String contentId);  }
@Test public void testGetSpaces() throws Exception { createMockSecurityContext(1); createMockStorageProvider(1); replayMocks(); List<String> userSpacesA = new ArrayList<String>(); userSpacesA.add(spacePrefix + 1); userSpacesA.add(spacePrefix + 2); userSpacesA.add(spacePrefix + 3); provider = createProvider(); Iterator<String> spaces = provider.getSpaces(); Assert.assertNotNull(spaces); int i = 0; while (spaces.hasNext()) { String space = spaces.next(); Assert.assertTrue(userSpacesA.contains(space)); i++; } Assert.assertEquals(userSpacesA.size(), i); }