use of org.olat.core.util.vfs.callbacks.VFSSecurityCallback in project OpenOLAT by OpenOLAT.
the class BCWebService method createFolderVO.
public static FolderVO createFolderVO(IdentityEnvironment ienv, ICourse course, BCCourseNode bcNode, Collection<String> subscribed) {
OlatNamedContainerImpl container = BCCourseNode.getSecurisedNodeFolderContainer(bcNode, course.getCourseEnvironment(), ienv);
VFSSecurityCallback secCallback = container.getLocalSecurityCallback();
FolderVO folderVo = new FolderVO();
folderVo.setName(course.getCourseTitle());
folderVo.setDetailsName(bcNode.getShortTitle());
if (subscribed != null && subscribed.contains(bcNode.getIdent())) {
folderVo.setSubscribed(true);
} else {
folderVo.setSubscribed(false);
}
folderVo.setCourseKey(course.getResourceableId());
folderVo.setCourseNodeId(bcNode.getIdent());
folderVo.setWrite(secCallback.canWrite());
folderVo.setRead(secCallback.canRead());
folderVo.setDelete(secCallback.canDelete());
folderVo.setList(secCallback.canList());
return folderVo;
}
use of org.olat.core.util.vfs.callbacks.VFSSecurityCallback in project OpenOLAT by OpenOLAT.
the class MergedCourseContainer method getBCContainer.
private VFSContainer getBCContainer(ICourse course, BCCourseNode bcNode, NodeEvaluation nodeEval, boolean isOlatAdmin) {
bcNode.updateModuleConfigDefaults(false);
// add folder not to merge source. Use name and node id to have unique name
VFSContainer rootFolder = null;
String subpath = bcNode.getModuleConfiguration().getStringValue(BCCourseNodeEditController.CONFIG_SUBPATH);
if (StringHelper.containsNonWhitespace(subpath)) {
if (bcNode.isSharedFolder()) {
// grab any shared folder that is configured
OlatRootFolderImpl sharedFolder = null;
String sfSoftkey = course.getCourseConfig().getSharedFolderSoftkey();
if (StringHelper.containsNonWhitespace(sfSoftkey) && !CourseConfig.VALUE_EMPTY_SHAREDFOLDER_SOFTKEY.equals(sfSoftkey)) {
RepositoryManager rm = RepositoryManager.getInstance();
RepositoryEntry re = rm.lookupRepositoryEntryBySoftkey(sfSoftkey, false);
if (re != null) {
sharedFolder = SharedFolderManager.getInstance().getSharedFolder(re.getOlatResource());
VFSContainer courseBase = sharedFolder;
subpath = subpath.replaceFirst("/_sharedfolder", "");
rootFolder = (VFSContainer) courseBase.resolve(subpath);
if (rootFolder != null && (course.getCourseConfig().isSharedFolderReadOnlyMount() || courseReadOnly)) {
rootFolder.setLocalSecurityCallback(new ReadOnlyCallback());
}
}
}
} else {
VFSContainer courseBase = course.getCourseBaseContainer();
rootFolder = (VFSContainer) courseBase.resolve("/coursefolder" + subpath);
}
}
if (bcNode.getModuleConfiguration().getBooleanSafe(BCCourseNodeEditController.CONFIG_AUTO_FOLDER)) {
String path = BCCourseNode.getFoldernodePathRelToFolderBase(course.getCourseEnvironment(), bcNode);
rootFolder = new OlatRootFolderImpl(path, null);
if (nodeEval != null) {
rootFolder.setLocalSecurityCallback(new FolderNodeCallback(path, nodeEval, isOlatAdmin, false, null));
} else {
VFSSecurityCallback secCallback = VFSManager.findInheritedSecurityCallback(this);
if (secCallback != null) {
rootFolder.setLocalSecurityCallback(new OverrideQuotaSecurityCallback(path, secCallback));
}
}
}
return rootFolder;
}
use of org.olat.core.util.vfs.callbacks.VFSSecurityCallback in project openolat by klemens.
the class ImsCPHandler method createEditorController.
@Override
public Controller createEditorController(RepositoryEntry re, UserRequest ureq, WindowControl wControl, TooledStackedPanel toolbar) {
// only unzips, if not already unzipped
OlatRootFolderImpl cpRoot = FileResourceManager.getInstance().unzipContainerResource(re.getOlatResource());
Quota quota = QuotaManager.getInstance().getCustomQuota(cpRoot.getRelPath());
if (quota == null) {
Quota defQuota = QuotaManager.getInstance().getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_REPO);
quota = QuotaManager.getInstance().createQuota(cpRoot.getRelPath(), defQuota.getQuotaKB(), defQuota.getUlLimitKB());
}
VFSSecurityCallback secCallback = new FullAccessWithQuotaCallback(quota);
cpRoot.setLocalSecurityCallback(secCallback);
return new CPEditMainController(ureq, wControl, toolbar, cpRoot, re.getOlatResource());
}
use of org.olat.core.util.vfs.callbacks.VFSSecurityCallback in project openolat by klemens.
the class CollaborationTools method getSecuredFolder.
/**
* Return the root VFS container with security callback set
* @return
*/
public OlatRootFolderImpl getSecuredFolder(BusinessGroup businessGroup, SubscriptionContext subsContext, Identity identity, boolean isAdmin) {
if (!isToolEnabled(CollaborationTools.TOOL_FOLDER)) {
return null;
}
boolean writeAccess;
boolean isOwner = CoreSpringFactory.getImpl(BusinessGroupService.class).hasRoles(identity, businessGroup, GroupRoles.coach.name());
if (!(isAdmin || isOwner)) {
// check if participants have read/write access
int folderAccess = CollaborationTools.FOLDER_ACCESS_ALL;
Long lFolderAccess = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(businessGroup).lookupFolderAccess();
if (lFolderAccess != null) {
folderAccess = lFolderAccess.intValue();
}
writeAccess = (folderAccess == CollaborationTools.CALENDAR_ACCESS_ALL);
} else {
writeAccess = true;
}
String relPath = getFolderRelPath();
VFSSecurityCallback secCallback = new CollabSecCallback(writeAccess, relPath, subsContext);
OlatRootFolderImpl rootContainer = new OlatRootFolderImpl(relPath, null);
rootContainer.setLocalSecurityCallback(secCallback);
return rootContainer;
}
use of org.olat.core.util.vfs.callbacks.VFSSecurityCallback in project openolat by klemens.
the class CmdEditMeta method notifyFinished.
private void notifyFinished(UserRequest ureq) {
VFSContainer container = VFSManager.findInheritingSecurityCallbackContainer(folderComponent.getRootContainer());
VFSSecurityCallback secCallback = container.getLocalSecurityCallback();
if (secCallback != null) {
SubscriptionContext subsContext = secCallback.getSubscriptionContext();
if (subsContext != null) {
NotificationsManager.getInstance().markPublisherNews(subsContext, ureq.getIdentity(), true);
}
}
fireEvent(ureq, FOLDERCOMMAND_FINISHED);
}
Aggregations