Skip to content
Snippets Groups Projects
Commit b472774c authored by fkiefer's avatar fkiefer
Browse files

OO-2365 new Coursenode Participant Folder

parent 44dfa176
No related branches found
No related tags found
No related merge requests found
Showing
with 1891 additions and 3 deletions
...@@ -42,6 +42,7 @@ Inbox=Inbox ...@@ -42,6 +42,7 @@ Inbox=Inbox
EPStructuredMap=ePortfolio EPStructuredMap=ePortfolio
InfoMessage=Mitteilungen InfoMessage=Mitteilungen
LibrarySite=Bibliothek LibrarySite=Bibliothek
PFCourseNode=Drop Box
ReturnboxController=R\u00FCckgabeordner ReturnboxController=R\u00FCckgabeordner
SolutionController=Musterl\u00F6sungen SolutionController=Musterl\u00F6sungen
User=Benutzer User=Benutzer
......
...@@ -42,6 +42,7 @@ GroupTask=Task ...@@ -42,6 +42,7 @@ GroupTask=Task
Inbox=Inbox Inbox=Inbox
InfoMessage=Messages InfoMessage=Messages
LibrarySite=Library LibrarySite=Library
PFCourseNode=Drop Box
ReturnboxController=Return box ReturnboxController=Return box
SolutionController=Sample solutions SolutionController=Sample solutions
User=User User=User
......
...@@ -53,6 +53,7 @@ import org.olat.core.util.vfs.VFSContainer; ...@@ -53,6 +53,7 @@ import org.olat.core.util.vfs.VFSContainer;
import org.olat.core.util.vfs.VFSItem; import org.olat.core.util.vfs.VFSItem;
import org.olat.core.util.vfs.VFSLeaf; import org.olat.core.util.vfs.VFSLeaf;
import org.olat.core.util.vfs.VFSLockManager; import org.olat.core.util.vfs.VFSLockManager;
import org.olat.core.util.vfs.VirtualContainer;
import org.olat.core.util.vfs.lock.LockInfo; import org.olat.core.util.vfs.lock.LockInfo;
import org.olat.core.util.vfs.version.Versionable; import org.olat.core.util.vfs.version.Versionable;
import org.olat.core.util.vfs.version.Versions; import org.olat.core.util.vfs.version.Versions;
...@@ -173,6 +174,8 @@ public class ListRenderer { ...@@ -173,6 +174,8 @@ public class ListRenderer {
// assume full access unless security callback tells us something different. // assume full access unless security callback tells us something different.
boolean canWrite = child.getParentContainer().canWrite() == VFSConstants.YES; boolean canWrite = child.getParentContainer().canWrite() == VFSConstants.YES;
// special case: virtual folders are always read only. parent of child =! the current container
canWrite = canWrite && !(fc.getCurrentContainer() instanceof VirtualContainer);
boolean isAbstract = (child instanceof AbstractVirtualContainer); boolean isAbstract = (child instanceof AbstractVirtualContainer);
Versions versions = null; Versions versions = null;
......
...@@ -438,7 +438,8 @@ public class MetaInfoFormController extends FormBasicController { ...@@ -438,7 +438,8 @@ public class MetaInfoFormController extends FormBasicController {
} }
} }
MetaInfo meta = CoreSpringFactory.getImpl(MetaInfoFactory.class).createMetaInfoFor((OlatRelPathImpl)item); MetaInfo meta = item instanceof OlatRelPathImpl ?
CoreSpringFactory.getImpl(MetaInfoFactory.class).createMetaInfoFor((OlatRelPathImpl)item) : null;
if(meta == null) { if(meta == null) {
return null; return null;
} }
......
...@@ -37,7 +37,9 @@ import org.olat.core.util.vfs.filters.VFSItemFilter; ...@@ -37,7 +37,9 @@ import org.olat.core.util.vfs.filters.VFSItemFilter;
import org.olat.course.config.CourseConfig; import org.olat.course.config.CourseConfig;
import org.olat.course.nodes.BCCourseNode; import org.olat.course.nodes.BCCourseNode;
import org.olat.course.nodes.CourseNode; import org.olat.course.nodes.CourseNode;
import org.olat.course.nodes.PFCourseNode;
import org.olat.course.nodes.bc.BCCourseNodeEditController; import org.olat.course.nodes.bc.BCCourseNodeEditController;
import org.olat.course.nodes.pf.manager.PFManager;
import org.olat.course.run.userview.NodeEvaluation; import org.olat.course.run.userview.NodeEvaluation;
import org.olat.course.run.userview.TreeEvaluation; import org.olat.course.run.userview.TreeEvaluation;
import org.olat.course.run.userview.UserCourseEnvironment; import org.olat.course.run.userview.UserCourseEnvironment;
...@@ -217,6 +219,21 @@ public class MergedCourseContainer extends MergeSource { ...@@ -217,6 +219,21 @@ public class MergedCourseContainer extends MergeSource {
nodesContainer.addContainer(courseNodeContainer); nodesContainer.addContainer(courseNodeContainer);
} }
} }
} else if (courseNodeChild instanceof PFCourseNode) {
final PFCourseNode pfNode = (PFCourseNode) courseNodeChild;
// add folder not to merge source. Use name and node id to have unique name
PFManager pfManager = CoreSpringFactory.getImpl(PFManager.class);
folderName = getBCFolderName(nodesContainer, pfNode, folderName);
MergeSource courseNodeContainer = new MergeSource(nodesContainer, folderName);
UserCourseEnvironment userCourseEnv = new UserCourseEnvironmentImpl(identityEnv, course.getCourseEnvironment());
VFSContainer rootFolder = pfManager.provideCoachOrParticipantContainer(pfNode, userCourseEnv, identityEnv.getIdentity());
VFSContainer nodeContentContainer = new NamedContainerImpl(folderName, rootFolder);
courseNodeContainer.addContainersChildren(nodeContentContainer, true);
addFolderBuildingBlocks(course, courseNodeContainer, child);
nodesContainer.addContainer(courseNodeContainer);
} else { } else {
// For non-folder course nodes, add merge source (no files to show) ... // For non-folder course nodes, add merge source (no files to show) ...
MergeSource courseNodeContainer = new MergeSource(null, folderName); MergeSource courseNodeContainer = new MergeSource(null, folderName);
...@@ -266,6 +283,8 @@ public class MergedCourseContainer extends MergeSource { ...@@ -266,6 +283,8 @@ public class MergedCourseContainer extends MergeSource {
// Do recursion for all children // Do recursion for all children
addFolderBuildingBlocks(course, courseNodeContainer, child); addFolderBuildingBlocks(course, courseNodeContainer, child);
} }
} else if (child instanceof PFCourseNode) {
//FIXME check if something is to be done here
} else { } else {
// For non-folder course nodes, add merge source (no files to show) ... // For non-folder course nodes, add merge source (no files to show) ...
MergeSource courseNodeContainer = new MergeSource(null, folderName); MergeSource courseNodeContainer = new MergeSource(null, folderName);
...@@ -287,7 +306,7 @@ public class MergedCourseContainer extends MergeSource { ...@@ -287,7 +306,7 @@ public class MergedCourseContainer extends MergeSource {
* @param folderName * @param folderName
* @return * @return
*/ */
private String getBCFolderName(MergeSource nodesContainer, BCCourseNode bcNode, String folderName) { private String getBCFolderName(MergeSource nodesContainer, CourseNode bcNode, String folderName) {
// add node ident if multiple files have same name // add node ident if multiple files have same name
if (nodesContainer.getItems(new VFSItemFilter() { if (nodesContainer.getItems(new VFSItemFilter() {
@Override @Override
......
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.course.nodes;
import java.io.File;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Date;
import org.olat.core.CoreSpringFactory;
import org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl;
import org.olat.core.commons.services.notifications.NotificationsManager;
import org.olat.core.commons.services.notifications.SubscriptionContext;
import org.olat.core.gui.UserRequest;
import org.olat.core.gui.components.stack.BreadcrumbPanel;
import org.olat.core.gui.control.Controller;
import org.olat.core.gui.control.WindowControl;
import org.olat.core.gui.control.generic.tabbable.TabbableController;
import org.olat.core.id.Identity;
import org.olat.core.util.FileUtils;
import org.olat.core.util.Util;
import org.olat.core.util.vfs.LocalFolderImpl;
import org.olat.core.util.vfs.VFSContainer;
import org.olat.course.CourseModule;
import org.olat.course.ICourse;
import org.olat.course.editor.CourseEditorEnv;
import org.olat.course.editor.NodeEditController;
import org.olat.course.editor.StatusDescription;
import org.olat.course.nodes.pf.manager.PFManager;
import org.olat.course.nodes.pf.ui.PFEditController;
import org.olat.course.nodes.pf.ui.PFPeekviewController;
import org.olat.course.nodes.pf.ui.PFPreviewController;
import org.olat.course.nodes.pf.ui.PFRunController;
import org.olat.course.run.environment.CourseEnvironment;
import org.olat.course.run.navigation.NodeRunConstructionResult;
import org.olat.course.run.userview.NodeEvaluation;
import org.olat.course.run.userview.UserCourseEnvironment;
import org.olat.modules.ModuleConfiguration;
import org.olat.repository.RepositoryEntry;
public class PFCourseNode extends AbstractAccessableCourseNode {
public static final String TYPE = "pf";
public static final String CONFIG_KEY_PARTICIPANTBOX = "participantbox";
public static final String CONFIG_KEY_COACHBOX = "coachbox";
public static final String CONFIG_KEY_ALTERFILE = "alterfile";
public static final String CONFIG_KEY_LIMITCOUNT = "limitcount";
public static final String CONFIG_KEY_FILECOUNT = "filecount";
public static final String CONFIG_KEY_TIMEFRAME = "timeframe";
public static final String CONFIG_KEY_DATESTART = "datestart";
public static final String CONFIG_KEY_DATEEND = "dateend";
/**
*
*/
public static final long serialVersionUID = 1L;
public PFCourseNode(String type) {
super(type);
}
public PFCourseNode() {
super(TYPE);
}
@Override
public RepositoryEntry getReferencedRepositoryEntry() {
return null;
}
@Override
public boolean needsReferenceToARepositoryEntry() {
return false;
}
public void updateModuleConfig(boolean participantbox, boolean coachbox, boolean alterfile,
boolean limitcount, int filecount, boolean timeframe, Date start, Date end) {
ModuleConfiguration config = getModuleConfiguration();
config.setBooleanEntry(CONFIG_KEY_PARTICIPANTBOX, participantbox);
config.setBooleanEntry(CONFIG_KEY_COACHBOX, coachbox);
config.setBooleanEntry(CONFIG_KEY_ALTERFILE, alterfile);
config.setBooleanEntry(CONFIG_KEY_LIMITCOUNT, limitcount);
if (limitcount){
config.set(CONFIG_KEY_FILECOUNT, filecount);
}
config.setBooleanEntry(CONFIG_KEY_TIMEFRAME, timeframe);
if (timeframe){
config.set(CONFIG_KEY_DATESTART, start);
config.set(CONFIG_KEY_DATEEND, end);
}
}
public boolean hasParticipantBoxConfigured() {
boolean hasStundentBox = getModuleConfiguration().getBooleanSafe(CONFIG_KEY_PARTICIPANTBOX);
return hasStundentBox;
}
public boolean hasCoachBoxConfigured() {
boolean hasTeacherBox = getModuleConfiguration().getBooleanSafe(CONFIG_KEY_COACHBOX);
return hasTeacherBox;
}
public boolean hasAlterFileConfigured() {
boolean hasStundentBox = getModuleConfiguration().getBooleanSafe(CONFIG_KEY_PARTICIPANTBOX);
if (hasStundentBox) {
boolean hasAlterFile = getModuleConfiguration().getBooleanSafe(CONFIG_KEY_ALTERFILE);
return hasAlterFile;
}
return false;
}
public boolean hasLimitCountConfigured() {
boolean hasStundentBox = getModuleConfiguration().getBooleanSafe(CONFIG_KEY_PARTICIPANTBOX);
if (hasStundentBox) {
boolean hasLimitCount = getModuleConfiguration().getBooleanSafe(CONFIG_KEY_LIMITCOUNT);
return hasLimitCount;
}
return false;
}
public boolean isGreaterOrEqualToLimit (int count) {
ModuleConfiguration config = getModuleConfiguration();
int limit = config.getBooleanEntry(CONFIG_KEY_FILECOUNT) != null ?
(int) config.get(CONFIG_KEY_FILECOUNT) : 0;
return count >= limit;
}
public boolean hasDropboxTimeFrameConfigured() {
boolean hasStundentBox = getModuleConfiguration().getBooleanSafe(CONFIG_KEY_PARTICIPANTBOX);
if (hasStundentBox) {
boolean hasTimeFrame = getModuleConfiguration().getBooleanSafe(CONFIG_KEY_TIMEFRAME);
return hasTimeFrame;
}
return false;
}
public boolean isInDropboxTimeFrame () {
ModuleConfiguration config = getModuleConfiguration();
Date start = config.getBooleanEntry(CONFIG_KEY_DATESTART) != null ?
(Date) config.getDateValue(CONFIG_KEY_DATESTART) : new Date();
Date end = config.getBooleanEntry(CONFIG_KEY_DATEEND) != null ?
(Date) config.getDateValue(CONFIG_KEY_DATEEND) : new Date();
Date current = new Date();
return start.before(current) && end.after(current);
}
public int getLimitCount() {
ModuleConfiguration config = getModuleConfiguration();
return config.getBooleanEntry(CONFIG_KEY_FILECOUNT) != null ?
(int) config.get(CONFIG_KEY_FILECOUNT) : 0;
}
public Date getDateStart() {
ModuleConfiguration config = getModuleConfiguration();
return config.getBooleanEntry(CONFIG_KEY_DATESTART) != null ?
(Date) config.getDateValue(CONFIG_KEY_DATESTART) : new Date();
}
public Date getDateEnd() {
ModuleConfiguration config = getModuleConfiguration();
return config.getBooleanEntry(CONFIG_KEY_DATEEND) != null ?
(Date) config.getDateValue(CONFIG_KEY_DATEEND) : new Date();
}
@Override
public StatusDescription isConfigValid() {
StatusDescription sd = StatusDescription.NOERROR;
boolean isValid = hasCoachBoxConfigured() || hasParticipantBoxConfigured();
if (!isValid) {
String shortKey = "error.noreference.short";
String longKey = "error.noreference.long";
String[] params = new String[] { this.getShortTitle() };
@SuppressWarnings("deprecation")
String translPackage = Util.getPackageName(PFEditController.class);
sd = new StatusDescription(StatusDescription.ERROR, shortKey, longKey, params, translPackage);
sd.setDescriptionForUnit(getIdent());
// set which pane is affected by error
sd.setActivateableViewIdentifier(CONFIG_KEY_PARTICIPANTBOX);
}
return sd;
}
@Override
public TabbableController createEditController(UserRequest ureq, WindowControl wControl, BreadcrumbPanel stackPanel,
ICourse course, UserCourseEnvironment euce) {
PFEditController ordnerCtr = new PFEditController(ureq, wControl, this, course, euce);
CourseNode chosenNode = course.getEditorTreeModel().getCourseNode(euce.getCourseEditorEnv().getCurrentCourseNodeId());
return new NodeEditController(ureq, wControl, course.getEditorTreeModel(), course, chosenNode, euce, ordnerCtr);
}
@Override
public NodeRunConstructionResult createNodeRunConstructionResult(UserRequest ureq, WindowControl wControl,
UserCourseEnvironment userCourseEnv, NodeEvaluation ne, String nodecmd) {
PFRunController runController = new PFRunController(ureq, wControl, this, userCourseEnv);
return runController.createNodeRunConstructionResult(ureq);
}
@Override
public Controller createPeekViewRunController(UserRequest ureq, WindowControl wControl,
UserCourseEnvironment userCourseEnv, NodeEvaluation ne) {
VFSContainer rootFolder = null;
CourseEnvironment courseEnv = userCourseEnv.getCourseEnvironment();
Identity identity = userCourseEnv.getIdentityEnvironment().getIdentity();
Path folderRelPath = null;
OlatRootFolderImpl baseContainer = courseEnv.getCourseBaseContainer();
PFManager pfManager = CoreSpringFactory.getImpl(PFManager.class);
if (userCourseEnv.isCoach() || userCourseEnv.isAdmin()) {
folderRelPath = Paths.get(baseContainer.getBasefile().toPath().toString(),
PFManager.FILENAME_PARTICIPANTFOLDER, getIdent());
rootFolder = new LocalFolderImpl(folderRelPath.toFile());
} else if (userCourseEnv.isParticipant()) {
folderRelPath = Paths.get(baseContainer.getBasefile().toPath().toString(),
PFManager.FILENAME_PARTICIPANTFOLDER, getIdent(),
pfManager.getIdFolderName(identity));
rootFolder = new LocalFolderImpl(folderRelPath.toFile());
}
if (rootFolder == null) {
return super.createPeekViewRunController(ureq, wControl, userCourseEnv, ne);
} else {
return new PFPeekviewController(ureq, wControl, rootFolder, getIdent(), 4);
}
}
@Override
public Controller createPreviewController(UserRequest ureq, WindowControl wControl,
UserCourseEnvironment userCourseEnv, NodeEvaluation ne) {
return new PFPreviewController(ureq, wControl, this, userCourseEnv);
}
@Override
public void cleanupOnDelete(ICourse course) {
// mark the subscription to this node as deleted
SubscriptionContext folderSubContext = CourseModule.createTechnicalSubscriptionContext(course.getCourseEnvironment(), this);
NotificationsManager.getInstance().delete(folderSubContext);
// delete filesystem
CourseEnvironment courseEnv = course.getCourseEnvironment();
File root = Paths.get(courseEnv.getCourseBaseContainer().getRelPath(),
PFManager.FILENAME_PARTICIPANTFOLDER, getIdent()).toFile();
if (root.exists()){
FileUtils.deleteDirsAndFiles(root, true, true);
}
}
@Override
public StatusDescription[] isConfigValid(CourseEditorEnv cev) {
return new StatusDescription[]{StatusDescription.NOERROR};
}
}
...@@ -22,6 +22,7 @@ title_iqtest=Test ...@@ -22,6 +22,7 @@ title_iqtest=Test
title_ms=Bewertung title_ms=Bewertung
title_qti21assessment=Test (QTI 2.1) title_qti21assessment=Test (QTI 2.1)
title_scorm=SCORM-Lerninhalt title_scorm=SCORM-Lerninhalt
title_pf=Teilnehmer Ordner
title_sp=Einzelne Seite title_sp=Einzelne Seite
title_st=Struktur title_st=Struktur
title_ta=<s>Aufgabe (deprecated)</s> title_ta=<s>Aufgabe (deprecated)</s>
......
...@@ -29,6 +29,7 @@ title_podcast=Podcast ...@@ -29,6 +29,7 @@ title_podcast=Podcast
title_projectbroker=Topic assignment title_projectbroker=Topic assignment
title_qti21assessment=Test (QTI 2.1) title_qti21assessment=Test (QTI 2.1)
title_scorm=SCORM learning content title_scorm=SCORM learning content
title_pf=Participant Folder
title_sp=Single page title_sp=Single page
title_st=Structure title_st=Structure
title_ta=<s>Task (deprecated)</s> title_ta=<s>Task (deprecated)</s>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
http://www.springframework.org/schema/context http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd"> http://www.springframework.org/schema/context/spring-context.xsd">
<context:component-scan base-package="org.olat.course.nodes.en,org.olat.course.nodes.cl,org.olat.course.nodes.projectbroker.service,org.olat.course.nodes.gta" /> <context:component-scan base-package="org.olat.course.nodes.en,org.olat.course.nodes.cl,org.olat.course.nodes.projectbroker.service,org.olat.course.nodes.gta,org.olat.course.nodes.pf" />
<!-- Course node spring config: Course Nodes are searched on the whole classpath, just place your CourceNodeConfiguration somewhere <!-- Course node spring config: Course Nodes are searched on the whole classpath, just place your CourceNodeConfiguration somewhere
on the classpath best as a jar. The xml file with ending ...Context.xml has do to be outside of the jar to get automatically loaded --> on the classpath best as a jar. The xml file with ending ...Context.xml has do to be outside of the jar to get automatically loaded -->
...@@ -20,6 +20,10 @@ ...@@ -20,6 +20,10 @@
--> -->
<bean id="bbfactory" class="org.olat.course.nodes.CourseNodeFactory"></bean> <bean id="bbfactory" class="org.olat.course.nodes.CourseNodeFactory"></bean>
<bean id="pf" class="org.olat.course.nodes.pf.PFCourseNodeConfiguration" scope="prototype">
<property name="order" value="111"/>
</bean>
<bean id="st" class="org.olat.course.nodes.st.STCourseNodeConfiguration" scope="prototype"> <bean id="st" class="org.olat.course.nodes.st.STCourseNodeConfiguration" scope="prototype">
<property name="order" value="1" /> <property name="order" value="1" />
......
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.course.nodes.pf;
import java.util.Locale;
import org.olat.core.gui.translator.Translator;
import org.olat.core.util.Util;
import org.olat.course.nodes.AbstractCourseNodeConfiguration;
import org.olat.course.nodes.CourseNode;
import org.olat.course.nodes.CourseNodeConfiguration;
import org.olat.course.nodes.CourseNodeGroup;
import org.olat.course.nodes.PFCourseNode;
/**
*
* @author Fabian Kiefer, fabian.kiefer@frentix.com, http://www.frentix.com
*
*/
public class PFCourseNodeConfiguration extends AbstractCourseNodeConfiguration {
public PFCourseNodeConfiguration() {
super();
}
@Override
public String getAlias() {
return PFCourseNode.TYPE;
}
@Override
public String getGroup() {
return CourseNodeGroup.content.name();
}
@Override
public CourseNode getInstance() {
return new PFCourseNode();
}
@Override
public String getLinkText(Locale locale) {
Translator fallback = Util.createPackageTranslator(CourseNodeConfiguration.class, locale);
Translator translator = Util.createPackageTranslator(this.getClass(), locale, fallback);
return translator.translate("title_pf");
}
@Override
public String getIconCSSClass() {
return "o_pf_icon";
}
}
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.course.nodes.pf.manager;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import javax.servlet.http.HttpServletResponse;
import org.olat.core.CoreSpringFactory;
import org.olat.core.gui.media.MediaResource;
import org.olat.core.id.Identity;
import org.olat.core.logging.OLog;
import org.olat.core.logging.Tracing;
import org.olat.course.nodes.PFCourseNode;
import org.olat.course.run.environment.CourseEnvironment;
import org.olat.user.UserManager;
/**
*
* Initial date: 15.12.2016<br>
* @author Fabian Kiefer, fabian.kiefer@frentix.com, http://www.frentix.com
*
*/
public class FileSystemExport implements MediaResource {
private static final OLog log = Tracing.createLoggerFor(FileSystemExport.class);
private List<Identity> identities;
private PFCourseNode pfNode;
private CourseEnvironment courseEnv;
public FileSystemExport(List<Identity> identities, PFCourseNode pfNode, CourseEnvironment courseEnv) {
super();
this.identities = identities;
this.pfNode = pfNode;
this.courseEnv = courseEnv;
}
@Override
public boolean acceptRanges() {
return false;
}
@Override
public String getContentType() {
return "application/zip";
}
@Override
public Long getSize() {
return null;
}
@Override
public InputStream getInputStream() {
return null;
}
@Override
public Long getLastModified() {
return null;
}
@Override
public void prepare(HttpServletResponse hres) {
try (ZipOutputStream zout = new ZipOutputStream(hres.getOutputStream())) {
zout.setLevel(9);
String pfolder = "participantfolder/";
Path relPath = Paths.get(courseEnv.getCourseBaseContainer().getBasefile().getAbsolutePath(),
pfolder, pfNode.getIdent());
fsToZip(zout, relPath, pfolder);
zout.close();
} catch (IOException e) {
log.error("", e);
}
}
@Override
public void release() {
//
}
private void fsToZip(ZipOutputStream zout, final Path sourceFolder, final String targetPath) throws IOException {
UserManager userManager = CoreSpringFactory.getImpl(UserManager.class);
Set<Long> idKeys = new HashSet<>();
for (Identity identity : identities) {
idKeys.add(identity.getKey());
}
Files.walkFileTree(sourceFolder, new SimpleFileVisitor<Path>() {
private String containsID (String relPath) {
for (Long key : idKeys) {
if (relPath.contains(key.toString())) {
String exportFolderName = userManager.getUserDisplayName(key).replace(", ", "_") + "_" + key;
return relPath.replace(key.toString(), exportFolderName);
}
}
return null;
}
private boolean boxesEnabled(String relPath) {
return pfNode.hasParticipantBoxConfigured() && relPath.contains(PFManager.FILENAME_DROPBOX)
|| pfNode.hasCoachBoxConfigured() && relPath.contains(PFManager.FILENAME_RETURNBOX);
}
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
String relPath = sourceFolder.relativize(file).toString();
if ((relPath = containsID(relPath)) != null && boxesEnabled(relPath)) {
zout.putNextEntry(new ZipEntry(targetPath + relPath));
Files.copy(file, zout);
zout.closeEntry();
}
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
String relPath = sourceFolder.relativize(dir).toString() + "/";
if ((relPath = containsID(relPath)) != null && boxesEnabled(relPath)) {
zout.putNextEntry(new ZipEntry(targetPath + relPath));
zout.closeEntry();
}
return FileVisitResult.CONTINUE;
}
});
}
}
\ No newline at end of file
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.course.nodes.pf.manager;
import org.olat.core.gui.components.form.flexible.FormItem;
import org.olat.core.gui.components.form.flexible.impl.FormEvent;
import org.olat.core.gui.control.Event;
import org.olat.core.id.Identity;
/**
*
* Initial date: 20.12.2016<br>
* @author Fabian Kiefer, fabian.kiefer@frentix.com, http://www.frentix.com
*
*/
public class PFEvent extends FormEvent {
/**
*
*/
private static final long serialVersionUID = 1L;
private Identity identity;
public PFEvent(Event event, FormItem source, int action) {
super(event, source, action);
}
public PFEvent(String command, FormItem source, Identity identity) {
super(command, source);
this.identity = identity;
}
public Identity getIdentity() {
return identity;
}
}
This diff is collapsed.
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.course.nodes.pf.manager;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import org.olat.core.commons.modules.bc.FileInfo;
import org.olat.core.commons.modules.bc.FolderManager;
import org.olat.core.commons.modules.bc.meta.MetaInfo;
import org.olat.core.commons.services.notifications.NotificationsManager;
import org.olat.core.commons.services.notifications.Publisher;
import org.olat.core.commons.services.notifications.Subscriber;
import org.olat.core.commons.services.notifications.model.SubscriptionListItem;
import org.olat.core.gui.translator.Translator;
import org.olat.core.id.Identity;
import org.olat.core.id.context.BusinessControlFactory;
import org.olat.core.logging.OLog;
import org.olat.core.logging.Tracing;
import org.olat.core.util.Util;
import org.olat.course.CourseFactory;
import org.olat.course.ICourse;
import org.olat.course.groupsandrights.CourseGroupManager;
import org.olat.course.nodes.CourseNode;
import org.olat.course.nodes.pf.ui.PFRunController;
import org.olat.course.run.environment.CourseEnvironment;
import org.olat.repository.RepositoryEntry;
/**
*
* Initial date: 05.01.2017<br>
* @author Fabian Kiefer, fabian.kiefer@frentix.com, http://www.frentix.com
*
*/
public class PFNotifications {
private static final OLog log = Tracing.createLoggerFor(PFNotifications.class);
private final Date compareDate;
private final Subscriber subscriber;
private final Translator translator;
private final List<SubscriptionListItem> items = new ArrayList<>();
private String displayname;
private NotificationsManager notificationsManager;
private PFManager pfManager;
public PFNotifications(Subscriber subscriber, Locale locale, Date compareDate, PFManager pfManager,
NotificationsManager notificationsManager) {
this.subscriber = subscriber;
this.compareDate = compareDate;
this.notificationsManager = notificationsManager;
this.pfManager = pfManager;
translator = Util.createPackageTranslator(PFRunController.class, locale);
}
public List<SubscriptionListItem> getItems() throws Exception {
Publisher p = subscriber.getPublisher();
Identity identity = subscriber.getIdentity();
ICourse course = CourseFactory.loadCourse(p.getResId());
CourseEnvironment courseEnv = course.getCourseEnvironment();
CourseGroupManager groupManager = courseEnv.getCourseGroupManager();
CourseNode node = course.getRunStructure().getNode(p.getSubidentifier());
RepositoryEntry entry = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
Date latestNews = p.getLatestNewsDate();
if (notificationsManager.isPublisherValid(p) && compareDate.before(latestNews)) {
this.displayname = entry.getDisplayname();
if (groupManager.isIdentityCourseCoach(identity) || groupManager.isIdentityCourseAdministrator(identity)) {
List<Identity> participants = pfManager.getParticipants(identity, courseEnv);
for (Identity participant : participants) {
gatherItems(participant, p, courseEnv, node);
}
} else {
gatherItems(identity, p, courseEnv, node);
}
}
return items;
}
private void gatherItems (Identity participant, Publisher p,
CourseEnvironment courseEnv, CourseNode node) {
Path folderRoot = Paths.get(courseEnv.getCourseBaseContainer().getRelPath(),
PFManager.FILENAME_PARTICIPANTFOLDER, node.getIdent(),
pfManager.getIdFolderName(participant));
final List<FileInfo> fInfos = FolderManager.getFileInfos(folderRoot.toString(), compareDate);
SubscriptionListItem subListItem;
for (Iterator<FileInfo> it_infos = fInfos.iterator(); it_infos.hasNext();) {
FileInfo fi = it_infos.next();
MetaInfo metaInfo = fi.getMetaInfo();
String filePath = fi.getRelPath();
Date modDate = fi.getLastModified();
String action = "upload";
try {
Path basepath = courseEnv.getCourseBaseContainer().getBasefile().toPath();
Path completepath = Paths.get(basepath.toString(), PFManager.FILENAME_PARTICIPANTFOLDER,
node.getIdent(), pfManager.getIdFolderName(participant), filePath);
BasicFileAttributes attrs = Files.readAttributes(completepath, BasicFileAttributes.class);
if (attrs.creationTime().toMillis() < attrs.lastModifiedTime().toMillis()) {
action = "modify";
}
} catch (IOException ioe) {
log.error("IOException", ioe);
}
String forby = translator.translate("notifications.entry." +
(filePath.contains(PFManager.FILENAME_DROPBOX) ? "by" : "for"));
String desc = translator.translate("notifications.entry." + action,
new String[] { filePath, forby, participant.getName() });
String businessPath = p.getBusinessPath();
String urlToSend = BusinessControlFactory.getInstance()
.getURLFromBusinessPathString(businessPath);
String iconCssClass = null;
if (metaInfo != null) {
iconCssClass = metaInfo.getIconCssClass();
}
if (metaInfo != null && !metaInfo.getName().startsWith(".")) {
subListItem = new SubscriptionListItem(desc, urlToSend, businessPath, modDate, iconCssClass);
items.add(subListItem);
}
}
}
public String getDisplayname() {
return displayname;
}
}
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.course.nodes.pf.manager;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import org.olat.core.CoreSpringFactory;
import org.olat.core.commons.services.notifications.NotificationsHandler;
import org.olat.core.commons.services.notifications.NotificationsManager;
import org.olat.core.commons.services.notifications.Publisher;
import org.olat.core.commons.services.notifications.Subscriber;
import org.olat.core.commons.services.notifications.SubscriptionContext;
import org.olat.core.commons.services.notifications.SubscriptionInfo;
import org.olat.core.commons.services.notifications.manager.NotificationsUpgradeHelper;
import org.olat.core.commons.services.notifications.model.SubscriptionListItem;
import org.olat.core.commons.services.notifications.model.TitleItem;
import org.olat.core.gui.translator.Translator;
import org.olat.core.gui.util.CSSHelper;
import org.olat.core.logging.OLog;
import org.olat.core.logging.Tracing;
import org.olat.core.util.Util;
import org.olat.course.CourseModule;
import org.olat.course.nodes.CourseNode;
import org.olat.course.nodes.pf.ui.PFRunController;
import org.olat.course.run.environment.CourseEnvironment;
import org.olat.group.BusinessGroup;
import org.olat.group.BusinessGroupService;
import org.olat.repository.RepositoryManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
*
* Initial date: 05.01.2017<br>
* @author Fabian Kiefer, fabian.kiefer@frentix.com, http://www.frentix.com
*
*/
@Service
public class PFNotificationsHandler implements NotificationsHandler {
private static final OLog log = Tracing.createLoggerFor(PFNotificationsHandler.class);
protected static final String CSS_CLASS_ICON = "o_gta_icon";
@Autowired
private NotificationsManager notificationsManager;
@Autowired
private PFManager pfManager;
public PFNotificationsHandler() {
}
protected static SubscriptionContext getSubscriptionContext(CourseEnvironment courseEnv, CourseNode node) {
return CourseModule.createSubscriptionContext(courseEnv, node, node.getIdent());
}
@Override
public SubscriptionInfo createSubscriptionInfo(Subscriber subscriber, Locale locale, Date compareDate) {
SubscriptionInfo si = null;
Publisher p = subscriber.getPublisher();
try {
final Translator translator = Util.createPackageTranslator(PFRunController.class, locale);
PFNotifications notifications = new PFNotifications(subscriber, locale, compareDate,
pfManager, notificationsManager);
List<SubscriptionListItem> items = notifications.getItems();
if (items.isEmpty()) {
si = notificationsManager.getNoSubscriptionInfo();
} else {
String displayName = notifications.getDisplayname();
String title = translator.translate("notifications.header", new String[]{ displayName });
si = new SubscriptionInfo(subscriber.getKey(), p.getType(), new TitleItem(title, CSS_CLASS_ICON), items);
}
} catch (Exception e) {
log.error("Unknown Exception", e);
si = notificationsManager.getNoSubscriptionInfo();
}
return si;
}
private void checkPublisher(Publisher p) {
try {
if("BusinessGroup".equals(p.getResName())) {
BusinessGroup bg = CoreSpringFactory.getImpl(BusinessGroupService.class).loadBusinessGroup(p.getResId());
if(bg == null) {
log.info("deactivating publisher with key; " + p.getKey(), null);
NotificationsManager.getInstance().deactivate(p);
}
} else if ("CourseModule".equals(p.getResName())) {
if(!NotificationsUpgradeHelper.checkCourse(p)) {
log.info("deactivating publisher with key; " + p.getKey(), null);
NotificationsManager.getInstance().deactivate(p);
}
}
} catch (Exception e) {
log.error("", e);
}
}
private TitleItem getTitleItem(Publisher p, Translator translator) {
String title;
try {
String resName = p.getResName();
if("BusinessGroup".equals(resName)) {
BusinessGroup bg = CoreSpringFactory.getImpl(BusinessGroupService.class).loadBusinessGroup(p.getResId());
title = translator.translate("notifications.header.group", new String[]{bg.getName()});
} else if("CourseModule".equals(resName)) {
String displayName = RepositoryManager.getInstance().lookupDisplayNameByOLATResourceableId(p.getResId());
title = translator.translate("notifications.header.course", new String[]{displayName});
} else {
title = translator.translate("notifications.header");
}
} catch (Exception e) {
log.error("", e);
checkPublisher(p);
title = translator.translate("notifications.header");
}
return new TitleItem(title, CSSHelper.CSS_CLASS_FILETYPE_FOLDER);
}
@Override
public String createTitleInfo(Subscriber subscriber, Locale locale) {
Translator translator = Util.createPackageTranslator(PFRunController.class, locale);
TitleItem title = getTitleItem(subscriber.getPublisher(), translator);
return title.getInfoContent("text/plain");
}
@Override
public String getType() {
return "PFCourseNode";
}
}
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.course.nodes.pf.manager;
/**
*
* @author Fabian Kiefer, fabian.kiefer@frentix.com, http://www.frentix.com
*
*/
public enum PFView{
onlyDrop,
onlyReturn,
displayDrop,
displayReturn,
dropAndReturn,
nothingToDisplay;
}
\ No newline at end of file
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.course.nodes.pf.manager;
import org.olat.core.commons.services.notifications.SubscriptionContext;
import org.olat.core.util.vfs.Quota;
import org.olat.core.util.vfs.callbacks.VFSSecurityCallback;
/**
*
* @author Fabian Kiefer, fabian.kiefer@frentix.com, http://www.frentix.com
*
*/
public class ReadDeleteCallback implements VFSSecurityCallback {
private SubscriptionContext subsContext;
public ReadDeleteCallback(SubscriptionContext subsContext) {
super();
this.subsContext = subsContext;
}
@Override
public boolean canRead() {
return true;
}
@Override
public boolean canWrite() {
return false;
}
@Override
public boolean canCreateFolder() {
return false;
}
@Override
public boolean canDelete() {
return true;
}
@Override
public boolean canList() {
return false;
}
@Override
public boolean canCopy() {
return false;
}
@Override
public boolean canDeleteRevisionsPermanently() {
return false;
}
@Override
public Quota getQuota() {
return null;
}
@Override
public void setQuota(Quota quota) {
}
@Override
public SubscriptionContext getSubscriptionContext() {
return subsContext;
}
}
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.course.nodes.pf.manager;
import org.olat.core.commons.services.notifications.SubscriptionContext;
import org.olat.core.util.vfs.Quota;
import org.olat.core.util.vfs.callbacks.VFSSecurityCallback;
/**
*
* @author Fabian Kiefer, fabian.kiefer@frentix.com, http://www.frentix.com
*
*/
public class ReadOnlyCallback implements VFSSecurityCallback {
private SubscriptionContext subsContext;
public ReadOnlyCallback(SubscriptionContext subsContext) {
super();
this.subsContext = subsContext;
}
@Override
public boolean canRead() {
return true;
}
@Override
public boolean canWrite() {
return false;
}
@Override
public boolean canCreateFolder() {
return false;
}
@Override
public boolean canDelete() {
return false;
}
@Override
public boolean canList() {
return false;
}
@Override
public boolean canCopy() {
return false;
}
@Override
public boolean canDeleteRevisionsPermanently() {
return false;
}
@Override
public Quota getQuota() {
return null;
}
@Override
public void setQuota(Quota quota) {
}
@Override
public SubscriptionContext getSubscriptionContext() {
return subsContext;
}
}
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.course.nodes.pf.manager;
import org.olat.core.commons.services.notifications.SubscriptionContext;
import org.olat.core.util.vfs.Quota;
import org.olat.core.util.vfs.callbacks.VFSSecurityCallback;
/**
*
* @author Fabian Kiefer, fabian.kiefer@frentix.com, http://www.frentix.com
*
*/
public class ReadWriteCallback implements VFSSecurityCallback {
private SubscriptionContext subsContext;
public ReadWriteCallback(SubscriptionContext subsContext) {
super();
this.subsContext = subsContext;
}
@Override
public boolean canRead() {
return true;
}
@Override
public boolean canWrite() {
return true;
}
@Override
public boolean canCreateFolder() {
return false;
}
@Override
public boolean canDelete() {
return false;
}
@Override
public boolean canList() {
return false;
}
@Override
public boolean canCopy() {
return false;
}
@Override
public boolean canDeleteRevisionsPermanently() {
return false;
}
@Override
public Quota getQuota() {
return null;
}
@Override
public void setQuota(Quota quota) {
}
@Override
public SubscriptionContext getSubscriptionContext() {
return subsContext;
}
}
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.course.nodes.pf.manager;
import org.olat.core.commons.services.notifications.SubscriptionContext;
import org.olat.core.util.vfs.Quota;
import org.olat.core.util.vfs.callbacks.VFSSecurityCallback;
/**
*
* @author Fabian Kiefer, fabian.kiefer@frentix.com, http://www.frentix.com
*
*/
public class ReadWriteDeleteCallback implements VFSSecurityCallback {
private SubscriptionContext subsContext;
public ReadWriteDeleteCallback(SubscriptionContext subsContext) {
super();
this.subsContext = subsContext;
}
@Override
public boolean canRead() {
return true;
}
@Override
public boolean canWrite() {
return true;
}
@Override
public boolean canCreateFolder() {
return true;
}
@Override
public boolean canDelete() {
return true;
}
@Override
public boolean canList() {
return true;
}
@Override
public boolean canCopy() {
return true;
}
@Override
public boolean canDeleteRevisionsPermanently() {
return false;
}
@Override
public Quota getQuota() {
return null;
}
@Override
public void setQuota(Quota quota) {
}
@Override
public SubscriptionContext getSubscriptionContext() {
return subsContext;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment