Search in sources :

Example 1 with FullAccessWithQuotaCallback

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);
}
Also used : OlatNamedContainerImpl(org.olat.core.commons.modules.bc.vfs.OlatNamedContainerImpl) OlatRootFolderImpl(org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl) FullAccessWithQuotaCallback(org.olat.core.util.vfs.callbacks.FullAccessWithQuotaCallback) Quota(org.olat.core.util.vfs.Quota) VFSContainer(org.olat.core.util.vfs.VFSContainer)

Example 2 with FullAccessWithQuotaCallback

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;
}
Also used : FullAccessWithLazyQuotaCallback(org.olat.core.util.vfs.callbacks.FullAccessWithLazyQuotaCallback) OlatRootFolderImpl(org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl) FullAccessWithQuotaCallback(org.olat.core.util.vfs.callbacks.FullAccessWithQuotaCallback) OLATRuntimeException(org.olat.core.logging.OLATRuntimeException) File(java.io.File)

Example 3 with FullAccessWithQuotaCallback

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);
}
Also used : FullAccessWithQuotaCallback(org.olat.core.util.vfs.callbacks.FullAccessWithQuotaCallback) Quota(org.olat.core.util.vfs.Quota)

Example 4 with FullAccessWithQuotaCallback

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();
}
Also used : FullAccessWithQuotaCallback(org.olat.core.util.vfs.callbacks.FullAccessWithQuotaCallback) Quota(org.olat.core.util.vfs.Quota) QuotaManager(org.olat.core.util.vfs.QuotaManager)

Example 5 with FullAccessWithQuotaCallback

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);
}
Also used : OlatNamedContainerImpl(org.olat.core.commons.modules.bc.vfs.OlatNamedContainerImpl) OlatRootFolderImpl(org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl) FullAccessWithQuotaCallback(org.olat.core.util.vfs.callbacks.FullAccessWithQuotaCallback) Quota(org.olat.core.util.vfs.Quota) VFSContainer(org.olat.core.util.vfs.VFSContainer)

Aggregations

FullAccessWithQuotaCallback (org.olat.core.util.vfs.callbacks.FullAccessWithQuotaCallback)14 Quota (org.olat.core.util.vfs.Quota)12 OlatRootFolderImpl (org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl)8 OlatNamedContainerImpl (org.olat.core.commons.modules.bc.vfs.OlatNamedContainerImpl)6 FolderRunController (org.olat.core.commons.modules.bc.FolderRunController)4 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)4 VFSContainer (org.olat.core.util.vfs.VFSContainer)4 VFSSecurityCallback (org.olat.core.util.vfs.callbacks.VFSSecurityCallback)4 File (java.io.File)2 SubscriptionContext (org.olat.core.commons.services.notifications.SubscriptionContext)2 OLATRuntimeException (org.olat.core.logging.OLATRuntimeException)2 QuotaManager (org.olat.core.util.vfs.QuotaManager)2 VFSItem (org.olat.core.util.vfs.VFSItem)2 FullAccessWithLazyQuotaCallback (org.olat.core.util.vfs.callbacks.FullAccessWithLazyQuotaCallback)2 ReadOnlyCallback (org.olat.core.util.vfs.callbacks.ReadOnlyCallback)2 CoursePropertyManager (org.olat.course.properties.CoursePropertyManager)2 PersistingCoursePropertyManager (org.olat.course.properties.PersistingCoursePropertyManager)2 CPEditMainController (org.olat.ims.cp.ui.CPEditMainController)2 Property (org.olat.properties.Property)2