use of org.olat.core.commons.modules.bc.vfs.OlatNamedContainerImpl in project openolat by klemens.
the class CoursesFoldersTest method testCreateFolder.
@Test
public void testCreateFolder() throws IOException, URISyntaxException {
assertTrue(conn.login("administrator", "openolat"));
URI uri = UriBuilder.fromUri(getNodeURI()).path("files").path("RootFolder").build();
HttpPut method = conn.createPut(uri, MediaType.APPLICATION_JSON, true);
HttpResponse response = conn.execute(method);
assertEquals(200, response.getStatusLine().getStatusCode());
OlatNamedContainerImpl folder = BCCourseNode.getNodeFolderContainer((BCCourseNode) bcNode, course1.getCourseEnvironment());
VFSItem item = folder.resolve("RootFolder");
assertNotNull(item);
assertTrue(item instanceof VFSContainer);
}
use of org.olat.core.commons.modules.bc.vfs.OlatNamedContainerImpl in project openolat by klemens.
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.commons.modules.bc.vfs.OlatNamedContainerImpl in project openolat by klemens.
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.commons.modules.bc.vfs.OlatNamedContainerImpl in project openolat by klemens.
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.commons.modules.bc.vfs.OlatNamedContainerImpl in project openolat by klemens.
the class BCCourseNode method getNodeFolderContainer.
/**
* Get a named container of a node with the node title as its name.
* @param node
* @param courseEnv
* @return
*/
public static OlatNamedContainerImpl getNodeFolderContainer(BCCourseNode node, CourseEnvironment courseEnv) {
String path = getFoldernodePathRelToFolderBase(courseEnv, node);
OlatRootFolderImpl rootFolder = new OlatRootFolderImpl(path, null);
OlatNamedContainerImpl namedFolder = new OlatNamedContainerImpl(node.getShortTitle(), rootFolder);
return namedFolder;
}
Aggregations