use of org.olat.core.util.vfs.Quota in project OpenOLAT by OpenOLAT.
the class FolderCallback method initFolderQuota.
private void initFolderQuota(String relPath) {
QuotaManager qm = QuotaManager.getInstance();
folderQuota = qm.getCustomQuota(relPath);
if (folderQuota == null) {
Quota defQuota = qm.getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_POWER);
folderQuota = QuotaManager.getInstance().createQuota(relPath, defQuota.getQuotaKB(), defQuota.getUlLimitKB());
}
}
use of org.olat.core.util.vfs.Quota in project OpenOLAT by OpenOLAT.
the class FeedManagerImpl method getQuota.
@Override
public Quota getQuota(OLATResourceable feed) {
OlatRootFolderImpl container = feedFileStorage.getResourceContainer(feed);
Quota quota = QuotaManager.getInstance().getCustomQuota(container.getRelPath());
if (quota == null) {
Quota defQuota = QuotaManager.getInstance().getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_FEEDS);
quota = QuotaManager.getInstance().createQuota(container.getRelPath(), defQuota.getQuotaKB(), defQuota.getUlLimitKB());
}
return quota;
}
use of org.olat.core.util.vfs.Quota in project OpenOLAT by OpenOLAT.
the class FolderNodeCallback method getQuota.
/**
* @see org.olat.modules.bc.callbacks.SecurityCallback#getQuotaKB(org.olat.modules.bc.Path)
*/
@Override
public Quota getQuota() {
if (nodeFolderQuota == null) {
QuotaManager qm = QuotaManager.getInstance();
nodeFolderQuota = qm.getCustomQuota(relPath);
if (nodeFolderQuota == null) {
Quota defQuota = qm.getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_NODES);
nodeFolderQuota = qm.createQuota(relPath, defQuota.getQuotaKB(), defQuota.getUlLimitKB());
}
}
return nodeFolderQuota;
}
use of org.olat.core.util.vfs.Quota in project OpenOLAT by OpenOLAT.
the class BGConfigToolsStepController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
boolean first = true;
String containerPage = velocity_root + "/tool_config_container.html";
String[] availableTools = CollaborationToolsFactory.getInstance().getAvailableTools().clone();
for (String k : availableTools) {
if (k.equals(CollaborationTools.TOOL_CHAT) || k.equals(CollaborationTools.TOOL_NEWS)) {
continue;
}
String[] keys = new String[] { "on" };
String[] values = new String[] { translate("collabtools.named." + k) };
String i18n = first ? "config.tools.desc" : null;
MultipleSelectionElement selectEl = uifactory.addCheckboxesHorizontal(k, i18n, formLayout, keys, values);
selectEl.addActionListener(FormEvent.ONCHANGE);
toolList.add(selectEl);
ToolConfig config = new ToolConfig(k);
config.configContainer = FormLayoutContainer.createCustomFormLayout("config.container." + k, getTranslator(), containerPage);
config.configContainer.contextPut("tool", k);
config.configContainer.setVisible(false);
config.configContainer.setRootForm(mainForm);
formLayout.add(config.configContainer);
config.enableEl = uifactory.addRadiosHorizontal("config.enable." + k, null, config.configContainer, enableKeys, enableValues);
config.enableEl.addActionListener(FormEvent.ONCHANGE);
config.enableEl.select("off", true);
enableList.add(config.enableEl);
config.enableEl.setUserObject(config);
if (k.equals(CollaborationTools.TOOL_CALENDAR)) {
config.calendarCtrl = new CalendarToolSettingsController(ureq, getWindowControl(), mainForm, CollaborationTools.CALENDAR_ACCESS_OWNERS);
config.configContainer.add("calendar", config.calendarCtrl.getInitialFormItem());
config.calendarCtrl.getInitialFormItem().setVisible(false);
} else if (k.equals(CollaborationTools.TOOL_FOLDER)) {
// add folder access configuration
config.folderCtrl = new FolderToolSettingsController(ureq, getWindowControl(), mainForm, CollaborationTools.FOLDER_ACCESS_OWNERS);
config.configContainer.add("folder", config.folderCtrl.getInitialFormItem());
config.folderCtrl.getInitialFormItem().setVisible(false);
// add quota configuration for admin only
if (ureq.getUserSession().getRoles().isOLATAdmin()) {
Quota quota = quotaManager.createQuota(null, null, null);
config.quotaCtrl = new BGConfigQuotaController(ureq, getWindowControl(), quota, mainForm);
config.configContainer.add("quota", config.quotaCtrl.getInitialFormItem());
config.quotaCtrl.getInitialFormItem().setVisible(false);
}
}
selectEl.setUserObject(config);
first = false;
}
}
use of org.olat.core.util.vfs.Quota 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);
}
Aggregations