use of org.olat.core.util.vfs.callbacks.VFSSecurityCallback in project OpenOLAT by OpenOLAT.
the class PFManager method provideParticipantContainer.
/**
* Provide participant view in webdav.
*
* @param pfNode
* @param courseEnv
* @param identity
* @return the VFS container
*/
private VFSContainer provideParticipantContainer(PFCourseNode pfNode, CourseEnvironment courseEnv, Identity identity, boolean courseReadOnly) {
Locale locale = I18nManager.getInstance().getLocaleOrDefault(identity.getUser().getPreferences().getLanguage());
Translator translator = Util.createPackageTranslator(PFRunController.class, locale);
SubscriptionContext subsContext = CourseModule.createSubscriptionContext(courseEnv, pfNode);
String path = courseEnv.getCourseBaseContainer().getRelPath() + "/" + FILENAME_PARTICIPANTFOLDER;
VFSContainer courseElementBaseContainer = new OlatRootFolderImpl(path, null);
VirtualContainer namedCourseFolder = new VirtualContainer(identity.getName());
Path relPath = Paths.get(pfNode.getIdent(), getIdFolderName(identity));
VFSContainer userBaseContainer = VFSManager.resolveOrCreateContainerFromPath(courseElementBaseContainer, relPath.toString());
if (pfNode.hasParticipantBoxConfigured()) {
VFSContainer dropContainer = new NamedContainerImpl(translator.translate("drop.box"), VFSManager.resolveOrCreateContainerFromPath(userBaseContainer, FILENAME_DROPBOX));
if (courseReadOnly) {
dropContainer.setLocalSecurityCallback(new ReadOnlyCallback(subsContext));
} else {
VFSContainer dropbox = resolveOrCreateDropFolder(courseEnv, pfNode, identity);
VFSSecurityCallback callback = calculateCallback(courseEnv, pfNode, dropbox, true);
dropContainer.setLocalSecurityCallback(callback);
}
namedCourseFolder.addItem(dropContainer);
}
if (pfNode.hasCoachBoxConfigured()) {
VFSContainer returnContainer = new NamedContainerImpl(translator.translate("return.box"), VFSManager.resolveOrCreateContainerFromPath(userBaseContainer, FILENAME_RETURNBOX));
returnContainer.setLocalSecurityCallback(new ReadOnlyCallback(subsContext));
namedCourseFolder.addItem(returnContainer);
}
return namedCourseFolder;
}
use of org.olat.core.util.vfs.callbacks.VFSSecurityCallback in project OpenOLAT by OpenOLAT.
the class UserInfoMainController method doOpenFolder.
private FolderRunController doOpenFolder(UserRequest ureq) {
removeAsListenerAndDispose(folderRunController);
String chosenUserFolderRelPath = FolderConfig.getUserHome(chosenIdentity.getName()) + "/public";
OlatRootFolderImpl rootFolder = new OlatRootFolderImpl(chosenUserFolderRelPath, null);
OlatNamedContainerImpl namedFolder = new OlatNamedContainerImpl(firstLastName, rootFolder);
// decided in plenum to have read only view in the personal visiting card, even for admin
VFSSecurityCallback secCallback = new ReadOnlyCallback();
namedFolder.setLocalSecurityCallback(secCallback);
OLATResourceable ores = OresHelper.createOLATResourceableType("userfolder");
WindowControl bwControl = addToHistory(ureq, ores, null);
folderRunController = new FolderRunController(namedFolder, false, true, false, ureq, bwControl);
folderRunController.setResourceURL("[Identity:" + chosenIdentity.getKey() + "][userfolder:0]");
listenTo(folderRunController);
return folderRunController;
}
use of org.olat.core.util.vfs.callbacks.VFSSecurityCallback in project OpenOLAT by OpenOLAT.
the class BCCourseNode method getSecurisedNodeFolderContainer.
public static OlatNamedContainerImpl getSecurisedNodeFolderContainer(BCCourseNode node, CourseEnvironment courseEnv, IdentityEnvironment ienv) {
boolean isOlatAdmin = ienv.getRoles().isOLATAdmin();
boolean isGuestOnly = ienv.getRoles().isGuestOnly();
UserCourseEnvironmentImpl uce = new UserCourseEnvironmentImpl(ienv, courseEnv);
NodeEvaluation ne = node.eval(uce.getConditionInterpreter(), new TreeEvaluation(), new VisibleTreeFilter());
OlatNamedContainerImpl container = getNodeFolderContainer(node, courseEnv);
VFSSecurityCallback secCallback = new FolderNodeCallback(container.getRelPath(), ne, isOlatAdmin, isGuestOnly, null);
container.setLocalSecurityCallback(secCallback);
return container;
}
use of org.olat.core.util.vfs.callbacks.VFSSecurityCallback in project OpenOLAT by OpenOLAT.
the class GroupfoldersWebDAVMergeSource method getGroupContainer.
private VFSContainer getGroupContainer(String name, BusinessGroup group, boolean isOwner) {
String folderPath = collaborationManager.getFolderRelPath(group);
// create container and set quota
OlatRootFolderImpl localImpl = new OlatRootFolderImpl(folderPath, this);
// already done in OlatRootFolderImpl localImpl.getBasefile().mkdirs(); // lazy initialize dirs
String containerName = RequestUtil.normalizeFilename(name);
NamedContainerImpl grpContainer = new GroupNamedContainer(containerName, localImpl);
boolean writeAccess;
if (!isOwner) {
// check if participants have read/write access
int folderAccess = CollaborationTools.FOLDER_ACCESS_ALL;
Long lFolderAccess = collaborationManager.lookupFolderAccess(group);
if (lFolderAccess != null) {
folderAccess = lFolderAccess.intValue();
}
writeAccess = (folderAccess == CollaborationTools.FOLDER_ACCESS_ALL);
} else {
writeAccess = true;
}
VFSSecurityCallback secCallback;
if (writeAccess) {
SubscriptionContext sc = new SubscriptionContext(group, "toolfolder");
secCallback = new FullAccessWithLazyQuotaCallback(folderPath, QuotaConstants.IDENTIFIER_DEFAULT_GROUPS, sc);
} else {
secCallback = new ReadOnlyCallback();
}
grpContainer.setLocalSecurityCallback(secCallback);
return grpContainer;
}
use of org.olat.core.util.vfs.callbacks.VFSSecurityCallback in project openolat by klemens.
the class CmdEditContent 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