use of org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl in project OpenOLAT by OpenOLAT.
the class DropboxController method getUploadLimit.
/**
* Get upload limit for dropbox of a certain user. The upload can be limited
* by available-folder space, max folder size or configurated upload-limit.
* @param ureq
* @return max upload limit in KB
*/
private int getUploadLimit() {
String dropboxPath = getRelativeDropBoxFilePath(getIdentity());
Quota dropboxQuota = QuotaManager.getInstance().getCustomQuota(dropboxPath);
if (dropboxQuota == null) {
dropboxQuota = QuotaManager.getInstance().getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_NODES);
}
OlatRootFolderImpl rootFolder = new OlatRootFolderImpl(getRelativeDropBoxFilePath(getIdentity()), null);
VFSContainer dropboxContainer = new OlatNamedContainerImpl(getIdentity().getName(), rootFolder);
FullAccessWithQuotaCallback secCallback = new FullAccessWithQuotaCallback(dropboxQuota);
rootFolder.setLocalSecurityCallback(secCallback);
return QuotaManager.getInstance().getUploadLimitKB(dropboxQuota.getQuotaKB(), dropboxQuota.getUlLimitKB(), dropboxContainer);
}
use of org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl in project OpenOLAT by OpenOLAT.
the class AssessmentTestSessionDAO method getSessionStorage.
/**
* Create a folder for a session in bcroot.
*
* @param session
* @return
*/
public File getSessionStorage(AssessmentTestSession session) {
OlatRootFolderImpl rootContainer = getQtiSerializationPath();
File directory = new File(rootContainer.getBasefile(), session.getStorage());
if (!directory.exists()) {
directory.mkdirs();
}
return directory;
}
use of org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl in project OpenOLAT by OpenOLAT.
the class OLATUpgrade_11_0_0 method processNonPropertiesTAStates.
/**
* Find if someone dropped a file in a Task element without task assignment, or has a returned
* document.
*
* @param assessableIdentities
* @param tNode
* @param course
* @param courseEntry
* @param nodeAssessmentMap
*/
private void processNonPropertiesTAStates(List<Identity> assessableIdentities, TACourseNode tNode, ICourse course, RepositoryEntry courseEntry, Map<AssessmentDataKey, AssessmentEntryImpl> nodeAssessmentMap, Map<AssessmentDataKey, AssessmentEntryImpl> curentNodeAssessmentMap) {
for (Identity assessedIdentity : assessableIdentities) {
AssessmentDataKey key = new AssessmentDataKey(assessedIdentity, course.getResourceableId(), tNode.getIdent());
if (curentNodeAssessmentMap.containsKey(key)) {
continue;
}
AssessmentEntryImpl nodeAssessment;
if (!nodeAssessmentMap.containsKey(key)) {
nodeAssessment = createAssessmentEntry(assessedIdentity, null, course, courseEntry, tNode.getIdent());
nodeAssessmentMap.put(key, nodeAssessment);
String dropbox = DropboxController.getDropboxPathRelToFolderRoot(course.getCourseEnvironment(), tNode) + File.separator + assessedIdentity.getName();
OlatRootFolderImpl dropBox = new OlatRootFolderImpl(dropbox, null);
if (dropBox.getBasefile().exists() && dropBox.getBasefile().listFiles(SystemFileFilter.FILES_ONLY).length > 0) {
nodeAssessment.setAssessmentStatus(AssessmentEntryStatus.inProgress);
} else {
String returnbox = ReturnboxController.getReturnboxPathRelToFolderRoot(course.getCourseEnvironment(), tNode) + File.separator + assessedIdentity.getName();
OlatRootFolderImpl returnBox = new OlatRootFolderImpl(returnbox, null);
if (returnBox.getBasefile().exists() && returnBox.getBasefile().listFiles(SystemFileFilter.FILES_ONLY).length > 0) {
nodeAssessment.setAssessmentStatus(AssessmentEntryStatus.inProgress);
}
}
}
}
}
use of org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl in project OpenOLAT by OpenOLAT.
the class OLATUpgrade_12_3_0 method moveDocumentPoolInfosPage.
private boolean moveDocumentPoolInfosPage(UpgradeManager upgradeManager, UpgradeHistoryData uhd) {
boolean allOk = true;
if (!uhd.getBooleanDataValue(MOVE_DOC_POOL_INFOS_PAGE)) {
String path = "/" + TaxonomyService.DIRECTORY + "/" + DocumentPoolModule.INFOS_PAGE_DIRECTORY;
VFSContainer taxonomyContainer = new OlatRootFolderImpl(path, null);
VFSContainer documentPoolContainer = documentPoolModule.getInfoPageContainer();
if (taxonomyContainer.exists() && documentPoolContainer.getItems(new VFSLeafButSystemFilter()).isEmpty() && !taxonomyContainer.getItems(new VFSLeafButSystemFilter()).isEmpty()) {
VFSManager.copyContent(taxonomyContainer, documentPoolContainer);
taxonomyContainer.delete();
}
uhd.setBooleanDataValue(MOVE_DOC_POOL_INFOS_PAGE, allOk);
upgradeManager.setUpgradesHistory(uhd, VERSION);
}
return allOk;
}
use of org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl 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;
}
Aggregations