Skip to content
Snippets Groups Projects
Commit 4fda1bb3 authored by User expired's avatar User expired
Browse files

openolat#63: changed migration logic for repository entries with...

openolat#63: changed migration logic for repository entries with ACC_OWNERS_AUTHORS access to not set them to published and if they are courses to referencable
parent 8e60ae41
No related branches found
No related tags found
No related merge requests found
......@@ -35,8 +35,8 @@ public class LiveStreamSecurityCallbackFactory {
ModuleConfiguration config) {
boolean canViewStreams = true;
// UIBK: we currently only allow olat admins to change/add streams, remove the first condition here to revert:
boolean canEditStreams = userCourseEnv.getIdentityEnvironment().getRoles().isAdministrator() &&
userCourseEnv.isAdmin()
boolean canEditStreams = (userCourseEnv.getIdentityEnvironment().getRoles().isAdministrator() &&
userCourseEnv.isAdmin())
|| (userCourseEnv.isCoach() && config.getBooleanSafe(LiveStreamCourseNode.CONFIG_COACH_CAN_EDIT));
return createSecurityCallback(canViewStreams, canEditStreams);
}
......
......@@ -324,7 +324,10 @@ public class OLATUpgrade_13_0_0 extends OLATUpgrade {
if(access == RepositoryEntryAccessUpgrade.ACC_OWNERS) {
status = RepositoryEntryStatusEnum.preparation;
} else if(access == RepositoryEntryAccessUpgrade.ACC_OWNERS_AUTHORS) {
status = RepositoryEntryStatusEnum.review;
// UIBK: as we do not have the review status for now, we set this to preparation here.
// no entries should be in this "unpublished" status anyway...
log.info("Setting unpublished repository entry (" + entry.getOlatResource().getResourceableTypeName() + ") course with access ACC_OWNERS_AUTHORS to preparation status: " + entry.getDisplayname());
status = RepositoryEntryStatusEnum.preparation;
}
} else if(access == RepositoryEntryAccessUpgrade.ACC_OWNERS) {
if(isMembersOnly) {
......@@ -333,11 +336,20 @@ public class OLATUpgrade_13_0_0 extends OLATUpgrade {
status = RepositoryEntryStatusEnum.preparation;
}
} else if(access == RepositoryEntryAccessUpgrade.ACC_OWNERS_AUTHORS) {
status = RepositoryEntryStatusEnum.review;
// UIBK: as we do not have the review status for now, we set this to published here.
log.info("Setting repository entry (" + entry.getOlatResource().getResourceableTypeName() + ") course with access ACC_OWNERS_AUTHORS to published: " + entry.getDisplayname());
status = RepositoryEntryStatusEnum.published;
// UIBK: for courses we also set the flag reference, so other authors can see them.
// we can ignore other learning resources as they are handled manually
if (entry.getOlatResource().getResourceableTypeName().equals("CourseModule")) {
log.info("Setting course with access ACC_OWNERS_AUTHORS to referencable: " + entry.getDisplayname());
entry.setCanReference(true);
}
} else if(access == RepositoryEntryAccessUpgrade.ACC_USERS || access == RepositoryEntryAccessUpgrade.ACC_USERS_GUESTS) {
status = RepositoryEntryStatusEnum.published;
}
entry.setEntryStatus(status);
dbInstance.getCurrentEntityManager().merge(entry);
dbInstance.commit();
......
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