Index: content-impl/impl/src/java/org/sakaiproject/content/impl/BaseContentService.java =================================================================== --- content-impl/impl/src/java/org/sakaiproject/content/impl/BaseContentService.java (revision 988) +++ content-impl/impl/src/java/org/sakaiproject/content/impl/BaseContentService.java (working copy) @@ -8444,16 +8444,32 @@ { List globalList = new ArrayList(); - Map othersites = getCollectionMap(); - Iterator siteIt = othersites.keySet().iterator(); - while (siteIt.hasNext()) - { - String collId = (String) siteIt.next(); - String displayName = (String) othersites.get(collId); - List artifacts = getFlatResources(collId); - globalList.addAll(filterArtifacts(artifacts, type, primaryMimeType, subMimeType, true)); - } + // originally this returned all resources from any site the user can + // access. This was added for use of OSP. We now think OSP should + // only present resources from the user's home worksite, because + // other sites may disappear. Portfolios typically have longer + // lifetimes than course sites, and we don't want holes appearing + // in students' portfolios when a course site is removed. + // Map othersites = getCollectionMap(); + // Iterator siteIt = othersites.keySet().iterator(); + //while (siteIt.hasNext()) + //{ + //String collId = (String) siteIt.next(); + //String displayName = (String) othersites.get(collId); + //List artifacts = getFlatResources(collId); + //// getFlatResources checked perms, so no need here + //globalList.addAll(filterArtifacts(artifacts, type, primaryMimeType, subMimeType, false)); + //} + + // for structured objects, just try user's worksite. There's no reason it + // would be anywhere else, and the full search is slow. + + String collId = getSiteCollection(m_siteService.getUserSiteId(SessionManager.getCurrentSessionUserId())); + List artifacts = getFlatResources(collId); + // getFlatResources checked perms, so no need here + globalList.addAll(filterArtifacts(artifacts, type, primaryMimeType, subMimeType, false)); + return globalList; } @@ -8545,7 +8561,7 @@ // this one is a structured object, get rid of it i.remove(); } - else + else if (mimeType != null) { String[] parts = mimeType.split("/"); String currentPrimaryType = parts[0]; @@ -8562,6 +8578,8 @@ i.remove(); } } + else + i.remove(); } else { i.remove();