Search in sources :

Example 21 with QuotaManager

use of org.olat.core.util.vfs.QuotaManager in project openolat by klemens.

the class SharedFolderSecurityCallback method initSharedFolderQuota.

/**
 * Node folder quota has to be ionitialized only once for all of the paths.
 *
 * @param path
 */
private void initSharedFolderQuota(String path) {
    QuotaManager qm = QuotaManager.getInstance();
    sharedFolderQuota = qm.getCustomQuota(path);
    if (sharedFolderQuota == null) {
        Quota defQuota = qm.getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_COURSE);
        sharedFolderQuota = QuotaManager.getInstance().createQuota(path, defQuota.getQuotaKB(), defQuota.getUlLimitKB());
    }
}
Also used : Quota(org.olat.core.util.vfs.Quota) QuotaManager(org.olat.core.util.vfs.QuotaManager)

Example 22 with QuotaManager

use of org.olat.core.util.vfs.QuotaManager in project openolat by klemens.

the class CourseGroupWebService method getFolder.

@Path("{groupKey}/folder")
public VFSWebservice getFolder(@PathParam("groupKey") Long groupKey, @Context HttpServletRequest request) {
    BusinessGroupService bgs = CoreSpringFactory.getImpl(BusinessGroupService.class);
    BusinessGroup bg = bgs.loadBusinessGroup(groupKey);
    if (bg == null) {
        return null;
    }
    if (!isGroupManager(request)) {
        Identity identity = RestSecurityHelper.getIdentity(request);
        if (!bgs.isIdentityInBusinessGroup(identity, bg)) {
            return null;
        }
    }
    CollaborationTools collabTools = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(bg);
    if (!collabTools.isToolEnabled(CollaborationTools.TOOL_FOLDER)) {
        return null;
    }
    String relPath = collabTools.getFolderRelPath();
    QuotaManager qm = QuotaManager.getInstance();
    Quota folderQuota = qm.getCustomQuota(relPath);
    if (folderQuota == null) {
        Quota defQuota = qm.getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_GROUPS);
        folderQuota = QuotaManager.getInstance().createQuota(relPath, defQuota.getQuotaKB(), defQuota.getUlLimitKB());
    }
    SubscriptionContext subsContext = null;
    VFSWebServiceSecurityCallback secCallback = new VFSWebServiceSecurityCallback(true, true, true, folderQuota, subsContext);
    OlatRootFolderImpl rootContainer = new OlatRootFolderImpl(relPath, null);
    rootContainer.setLocalSecurityCallback(secCallback);
    return new VFSWebservice(rootContainer);
}
Also used : VFSWebServiceSecurityCallback(org.olat.core.util.vfs.restapi.VFSWebServiceSecurityCallback) OlatRootFolderImpl(org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl) Quota(org.olat.core.util.vfs.Quota) BusinessGroupService(org.olat.group.BusinessGroupService) BusinessGroup(org.olat.group.BusinessGroup) CollaborationTools(org.olat.collaboration.CollaborationTools) SubscriptionContext(org.olat.core.commons.services.notifications.SubscriptionContext) Identity(org.olat.core.id.Identity) QuotaManager(org.olat.core.util.vfs.QuotaManager) VFSWebservice(org.olat.core.util.vfs.restapi.VFSWebservice) Path(javax.ws.rs.Path)

Example 23 with QuotaManager

use of org.olat.core.util.vfs.QuotaManager in project openolat by klemens.

the class QuotaTableModel method refresh.

/**
 */
public void refresh() {
    QuotaManager qm = QuotaManager.getInstance();
    quotaList = qm.listCustomQuotasKB();
}
Also used : QuotaManager(org.olat.core.util.vfs.QuotaManager)

Example 24 with QuotaManager

use of org.olat.core.util.vfs.QuotaManager in project openolat by klemens.

the class GenericQuotaEditController method initMyContent.

private void initMyContent(UserRequest ureq) {
    QuotaManager qm = QuotaManager.getInstance();
    if (!qm.hasQuotaEditRights(ureq.getIdentity())) {
        throw new OLATSecurityException("Insufficient permissions to access QuotaController");
    }
    myContent = createVelocityContainer("edit");
    LinkFactory.createButtonSmall("qf.new", myContent, this);
    delQuotaButton = LinkFactory.createButtonSmall("qf.del", myContent, this);
    myContent.contextPut("users", qm.getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_USERS));
    myContent.contextPut("powerusers", qm.getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_POWER));
    myContent.contextPut("groups", qm.getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_GROUPS));
    myContent.contextPut("repository", qm.getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_REPO));
    myContent.contextPut("coursefolder", qm.getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_COURSE));
    myContent.contextPut("nodefolder", qm.getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_NODES));
    myContent.contextPut("feeds", qm.getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_FEEDS));
}
Also used : OLATSecurityException(org.olat.core.logging.OLATSecurityException) QuotaManager(org.olat.core.util.vfs.QuotaManager)

Example 25 with QuotaManager

use of org.olat.core.util.vfs.QuotaManager in project openolat by klemens.

the class GenericQuotaViewController method initMyContent.

private void initMyContent() {
    QuotaManager qm = QuotaManager.getInstance();
    myContent = createVelocityContainer("edit");
    myContent.contextPut("notEnoughPrivilege", Boolean.FALSE);
    myContent.contextPut("users", qm.getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_USERS));
    myContent.contextPut("powerusers", qm.getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_POWER));
    myContent.contextPut("groups", qm.getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_GROUPS));
    myContent.contextPut("repository", qm.getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_REPO));
    myContent.contextPut("coursefolder", qm.getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_COURSE));
    myContent.contextPut("nodefolder", qm.getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_NODES));
    myContent.contextPut("feeds", qm.getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_FEEDS));
}
Also used : QuotaManager(org.olat.core.util.vfs.QuotaManager)

Aggregations

QuotaManager (org.olat.core.util.vfs.QuotaManager)26 Quota (org.olat.core.util.vfs.Quota)18 Path (javax.ws.rs.Path)4 CollaborationTools (org.olat.collaboration.CollaborationTools)4 OlatRootFolderImpl (org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl)4 SubscriptionContext (org.olat.core.commons.services.notifications.SubscriptionContext)4 Identity (org.olat.core.id.Identity)4 VFSWebServiceSecurityCallback (org.olat.core.util.vfs.restapi.VFSWebServiceSecurityCallback)4 VFSWebservice (org.olat.core.util.vfs.restapi.VFSWebservice)4 BusinessGroup (org.olat.group.BusinessGroup)4 BusinessGroupService (org.olat.group.BusinessGroupService)4 File (java.io.File)2 OLATSecurityException (org.olat.core.logging.OLATSecurityException)2 FullAccessWithQuotaCallback (org.olat.core.util.vfs.callbacks.FullAccessWithQuotaCallback)2 VFSSecurityCallback (org.olat.core.util.vfs.callbacks.VFSSecurityCallback)2 CourseConfig (org.olat.course.config.CourseConfig)2 Reference (org.olat.resource.references.Reference)2