use of org.olat.core.util.vfs.NamedContainerImpl in project OpenOLAT by OpenOLAT.
the class CourseRuntimeController method doCourseFolder.
private FolderRunController doCourseFolder(UserRequest ureq) {
if (delayedClose == Delayed.courseFolder || requestForClose(ureq)) {
removeCustomCSS();
// Folder for course with custom link model to jump to course nodes
ICourse course = CourseFactory.loadCourse(getRepositoryEntry());
VFSContainer courseContainer;
if (overrideReadOnly) {
courseContainer = course.getCourseFolderContainer(overrideReadOnly);
} else {
courseContainer = course.getCourseFolderContainer();
}
VFSContainer namedCourseFolder = new NamedContainerImpl(translate("command.coursefolder"), courseContainer);
CustomLinkTreeModel customLinkTreeModel = new CourseInternalLinkTreeModel(course.getEditorTreeModel());
FolderRunController ctrl = new FolderRunController(namedCourseFolder, true, true, true, true, ureq, getWindowControl(), null, customLinkTreeModel, null);
ctrl.addLoggingResourceable(LoggingResourceable.wrap(course));
courseFolderCtrl = pushController(ureq, translate("command.coursefolder"), ctrl);
setActiveTool(folderLink);
currentToolCtr = courseFolderCtrl;
} else {
delayedClose = Delayed.courseFolder;
}
return courseFolderCtrl;
}
use of org.olat.core.util.vfs.NamedContainerImpl in project OpenOLAT by OpenOLAT.
the class QTIEditorPackageImpl method getBaseDir.
@Override
public VFSContainer getBaseDir() {
VFSContainer localDir = new LocalFolderImpl(packageDir);
if (secCallback != null) {
localDir.setLocalSecurityCallback(secCallback);
}
String dirName = translator.translate("qti.basedir.displayname");
NamedContainerImpl namedBaseDir = new NamedContainerImpl(dirName, localDir);
return namedBaseDir;
}
use of org.olat.core.util.vfs.NamedContainerImpl in project OpenOLAT by OpenOLAT.
the class GroupfoldersWebDAVMergeSource method getGroupContainer.
private VFSContainer getGroupContainer(String name, BusinessGroup group, boolean isOwner) {
String folderPath = collaborationManager.getFolderRelPath(group);
// create container and set quota
OlatRootFolderImpl localImpl = new OlatRootFolderImpl(folderPath, this);
// already done in OlatRootFolderImpl localImpl.getBasefile().mkdirs(); // lazy initialize dirs
String containerName = RequestUtil.normalizeFilename(name);
NamedContainerImpl grpContainer = new GroupNamedContainer(containerName, localImpl);
boolean writeAccess;
if (!isOwner) {
// check if participants have read/write access
int folderAccess = CollaborationTools.FOLDER_ACCESS_ALL;
Long lFolderAccess = collaborationManager.lookupFolderAccess(group);
if (lFolderAccess != null) {
folderAccess = lFolderAccess.intValue();
}
writeAccess = (folderAccess == CollaborationTools.FOLDER_ACCESS_ALL);
} else {
writeAccess = true;
}
VFSSecurityCallback secCallback;
if (writeAccess) {
SubscriptionContext sc = new SubscriptionContext(group, "toolfolder");
secCallback = new FullAccessWithLazyQuotaCallback(folderPath, QuotaConstants.IDENTIFIER_DEFAULT_GROUPS, sc);
} else {
secCallback = new ReadOnlyCallback();
}
grpContainer.setLocalSecurityCallback(secCallback);
return grpContainer;
}
use of org.olat.core.util.vfs.NamedContainerImpl in project openolat by klemens.
the class PFManager method provideParticipantFolder.
/**
* Provide participant folder in GUI.
*
* @param pfNode
* @param pfView
* @param courseEnv
* @param identity
* @param isCoach
* @return the VFS container
*/
public VFSContainer provideParticipantFolder(PFCourseNode pfNode, PFView pfView, Translator translator, CourseEnvironment courseEnv, Identity identity, boolean isCoach, boolean readOnly) {
SubscriptionContext nodefolderSubContext = CourseModule.createSubscriptionContext(courseEnv, pfNode);
String path = courseEnv.getCourseBaseContainer().getRelPath() + "/" + FILENAME_PARTICIPANTFOLDER;
VFSContainer courseElementBaseContainer = new OlatRootFolderImpl(path, null);
Path relPath = Paths.get(pfNode.getIdent(), getIdFolderName(identity));
VFSContainer userBaseContainer = VFSManager.resolveOrCreateContainerFromPath(courseElementBaseContainer, relPath.toString());
String baseContainerName = userManager.getUserDisplayName(identity);
VirtualContainer namedCourseFolder = new VirtualContainer(baseContainerName);
namedCourseFolder.setLocalSecurityCallback(new ReadOnlyCallback(nodefolderSubContext));
VFSContainer dropContainer = new NamedContainerImpl(PFView.onlyDrop.equals(pfView) || PFView.onlyReturn.equals(pfView) ? baseContainerName : translator.translate("drop.box"), VFSManager.resolveOrCreateContainerFromPath(userBaseContainer, FILENAME_DROPBOX));
if (pfNode.hasParticipantBoxConfigured()) {
namedCourseFolder.addItem(dropContainer);
}
VFSContainer returnContainer = new NamedContainerImpl(PFView.onlyDrop.equals(pfView) || PFView.onlyReturn.equals(pfView) ? baseContainerName : translator.translate("return.box"), VFSManager.resolveOrCreateContainerFromPath(userBaseContainer, FILENAME_RETURNBOX));
if (pfNode.hasCoachBoxConfigured()) {
namedCourseFolder.addItem(returnContainer);
}
if (readOnly) {
dropContainer.setLocalSecurityCallback(new ReadOnlyCallback(nodefolderSubContext));
returnContainer.setLocalSecurityCallback(new ReadOnlyCallback(nodefolderSubContext));
} else {
if (isCoach) {
dropContainer.setLocalSecurityCallback(new ReadOnlyCallback(nodefolderSubContext));
returnContainer.setLocalSecurityCallback(new ReadWriteDeleteCallback(nodefolderSubContext));
} else {
VFSContainer dropbox = resolveOrCreateDropFolder(courseEnv, pfNode, identity);
VFSSecurityCallback callback = calculateCallback(courseEnv, pfNode, dropbox, false);
dropContainer.setLocalSecurityCallback(callback);
returnContainer.setLocalSecurityCallback(new ReadOnlyCallback(nodefolderSubContext));
}
}
VFSContainer folderRunContainer;
switch(pfView) {
case dropAndReturn:
folderRunContainer = namedCourseFolder;
break;
case onlyDrop:
folderRunContainer = dropContainer;
break;
case onlyReturn:
folderRunContainer = returnContainer;
break;
default:
folderRunContainer = namedCourseFolder;
break;
}
return folderRunContainer;
}
use of org.olat.core.util.vfs.NamedContainerImpl in project openolat by klemens.
the class PFManager method provideParticipantContainer.
/**
* Provide participant view in webdav.
*
* @param pfNode
* @param courseEnv
* @param identity
* @return the VFS container
*/
private VFSContainer provideParticipantContainer(PFCourseNode pfNode, CourseEnvironment courseEnv, Identity identity, boolean courseReadOnly) {
Locale locale = I18nManager.getInstance().getLocaleOrDefault(identity.getUser().getPreferences().getLanguage());
Translator translator = Util.createPackageTranslator(PFRunController.class, locale);
SubscriptionContext subsContext = CourseModule.createSubscriptionContext(courseEnv, pfNode);
String path = courseEnv.getCourseBaseContainer().getRelPath() + "/" + FILENAME_PARTICIPANTFOLDER;
VFSContainer courseElementBaseContainer = new OlatRootFolderImpl(path, null);
VirtualContainer namedCourseFolder = new VirtualContainer(identity.getName());
Path relPath = Paths.get(pfNode.getIdent(), getIdFolderName(identity));
VFSContainer userBaseContainer = VFSManager.resolveOrCreateContainerFromPath(courseElementBaseContainer, relPath.toString());
if (pfNode.hasParticipantBoxConfigured()) {
VFSContainer dropContainer = new NamedContainerImpl(translator.translate("drop.box"), VFSManager.resolveOrCreateContainerFromPath(userBaseContainer, FILENAME_DROPBOX));
if (courseReadOnly) {
dropContainer.setLocalSecurityCallback(new ReadOnlyCallback(subsContext));
} else {
VFSContainer dropbox = resolveOrCreateDropFolder(courseEnv, pfNode, identity);
VFSSecurityCallback callback = calculateCallback(courseEnv, pfNode, dropbox, true);
dropContainer.setLocalSecurityCallback(callback);
}
namedCourseFolder.addItem(dropContainer);
}
if (pfNode.hasCoachBoxConfigured()) {
VFSContainer returnContainer = new NamedContainerImpl(translator.translate("return.box"), VFSManager.resolveOrCreateContainerFromPath(userBaseContainer, FILENAME_RETURNBOX));
returnContainer.setLocalSecurityCallback(new ReadOnlyCallback(subsContext));
namedCourseFolder.addItem(returnContainer);
}
return namedCourseFolder;
}
Aggregations