Skip to content

Commit

Permalink
SAK-31115 elFinder not longer working for browsing My Workspace (saka…
Browse files Browse the repository at this point in the history
…iproject#2483)

elFinder not longer working for browsing My Workspace
  • Loading branch information
Miguel Carro Pellicer authored and ottenhoff committed May 24, 2016
1 parent d528d74 commit 28283aa
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions reference/library/src/webapp/editor/ckeditor.launch.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ sakai.editor.editors.ckeditor.launch = function(targetId, config, w, h) {
var elfinderUrl = '/library/editor/elfinder/sakai/elfinder.' + elfinderBuild +
'.html?connector=elfinder-connector/elfinder-servlet/connector';

// Add tilde to userId in order to avoid permission error while getting resources from user workspace
collentionId = collectionId.replace('/user/','/user/~');

var filebrowser = {
browseUrl : elfinderUrl + '&startdir=' + collectionId,
imageBrowseUrl : elfinderUrl + '&startdir=' + collectionId + '&type=images',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.sakaiproject.site.api.SiteService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.sakaiproject.user.api.UserDirectoryService;

import java.io.IOException;
import java.util.*;
Expand All @@ -38,6 +39,7 @@ public class SakaiFsService implements FsService {

private ContentHostingService contentHostingService;
private SiteService siteService;
private UserDirectoryService userDirectoryService;

private FsSecurityChecker securityChecker;

Expand Down Expand Up @@ -164,6 +166,12 @@ public String getVolumeId(FsVolume volume) {

public FsVolume[] getVolumes() {
List<Site> sites = siteService.getSites(ACCESS, null, null, null, null, null);
// Add the user workspace as volume.
try {
String userId = userDirectoryService.getCurrentUser().getId();
Site myWorkspace = siteService.getSiteVisit(siteService.getUserSiteId(userId));
sites.add(0,myWorkspace);
} catch (Exception e) {}
List<FsVolume> volumes = new ArrayList<>(sites.size());
for (Site site: sites) {
String currentSiteId = site.getId();
Expand Down Expand Up @@ -219,4 +227,8 @@ public void setContentHostingService(ContentHostingService contentHostingService
this.contentHostingService = contentHostingService;
}

public void setUserDirectoryService(UserDirectoryService userDirectoryService) {
this.userDirectoryService = userDirectoryService;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<bean class="org.sakaiproject.elfinder.sakai.SakaiFsService">
<property name="contentHostingService" ref="org.sakaiproject.content.api.ContentHostingService"/>
<property name="siteService" ref="org.sakaiproject.site.api.SiteService"/>
<property name="userDirectoryService" ref="org.sakaiproject.user.api.UserDirectoryService"/>
<property name="securityChecker">
<bean class="org.sakaiproject.elfinder.impl.SakaiFsSecurityChecker"/>
</property>
Expand Down

0 comments on commit 28283aa

Please sign in to comment.