use of org.olat.core.util.vfs.callbacks.FullAccessWithQuotaCallback 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.util.vfs.callbacks.FullAccessWithQuotaCallback in project OpenOLAT by OpenOLAT.
the class NodeExportVisitor method getIsolatedCourseFolder.
protected OlatRootFolderImpl getIsolatedCourseFolder() {
// create local course folder
OlatRootFolderImpl isolatedCourseFolder = new OlatRootFolderImpl(courseRootContainer.getRelPath() + File.separator + COURSEFOLDER, null);
// generate course folder
File fCourseFolder = isolatedCourseFolder.getBasefile();
if (!fCourseFolder.exists() && !fCourseFolder.mkdirs()) {
throw new OLATRuntimeException(this.getClass(), "could not create course's coursefolder path:" + fCourseFolder.getAbsolutePath(), null);
}
FullAccessWithQuotaCallback secCallback = new FullAccessWithLazyQuotaCallback(isolatedCourseFolder.getRelPath(), QuotaConstants.IDENTIFIER_DEFAULT_COURSE);
isolatedCourseFolder.setLocalSecurityCallback(secCallback);
return isolatedCourseFolder;
}
use of org.olat.core.util.vfs.callbacks.FullAccessWithQuotaCallback in project openolat by klemens.
the class BCCourseNodeEditController method getSecurityCallbackWithQuota.
private VFSSecurityCallback getSecurityCallbackWithQuota(String relPath) {
Quota quota = quotaManager.getCustomQuota(relPath);
if (quota == null) {
Quota defQuota = QuotaManager.getInstance().getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_NODES);
quota = QuotaManager.getInstance().createQuota(relPath, defQuota.getQuotaKB(), defQuota.getUlLimitKB());
}
return new FullAccessWithQuotaCallback(quota);
}
use of org.olat.core.util.vfs.callbacks.FullAccessWithQuotaCallback in project openolat by klemens.
the class BriefcaseWebDAVMergeSource method getLocalSecurityCallback.
@Override
public VFSSecurityCallback getLocalSecurityCallback() {
if (super.getLocalSecurityCallback() == null) {
// set quota for this merge source
QuotaManager qm = QuotaManager.getInstance();
Quota quota = qm.getCustomQuotaOrDefaultDependingOnRole(identity, PersonalFolderManager.getInstance().getRootPathFor(identity));
FullAccessWithQuotaCallback secCallback = new FullAccessWithQuotaCallback(quota);
setLocalSecurityCallback(secCallback);
}
return super.getLocalSecurityCallback();
}
use of org.olat.core.util.vfs.callbacks.FullAccessWithQuotaCallback in project openolat by klemens.
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);
}
Aggregations