Skip to content
Snippets Groups Projects
Commit a5ca87f7 authored by srosse's avatar srosse
Browse files

OO-1777: prevent guest to leave a course

parent 7c329e1c
No related branches found
No related tags found
No related merge requests found
...@@ -581,7 +581,7 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im ...@@ -581,7 +581,7 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im
} }
if(repositoryService.isParticipantAllowedToLeave(getRepositoryEntry()) if(repositoryService.isParticipantAllowedToLeave(getRepositoryEntry())
&& !assessmentLock && !assessmentLock && !roles.isGuestOnly()
&& (uce.isParticipant() || !uce.getParticipatingGroups().isEmpty())) { && (uce.isParticipant() || !uce.getParticipatingGroups().isEmpty())) {
leaveLink = LinkFactory.createToolLink("sign.out", "leave", translate("sign.out"), this); leaveLink = LinkFactory.createToolLink("sign.out", "leave", translate("sign.out"), this);
leaveLink.setIconLeftCSS("o_icon o_icon-fw o_icon_sign_out"); leaveLink.setIconLeftCSS("o_icon o_icon-fw o_icon_sign_out");
...@@ -1015,6 +1015,8 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im ...@@ -1015,6 +1015,8 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im
} }
private void doLeave(UserRequest ureq) { private void doLeave(UserRequest ureq) {
if(roles.isGuestOnly()) return;
MailerResult result = new MailerResult(); MailerResult result = new MailerResult();
MailPackage reMailing = new MailPackage(result, getWindowControl().getBusinessControl().getAsString(), true); MailPackage reMailing = new MailPackage(result, getWindowControl().getBusinessControl().getAsString(), true);
//leave course //leave course
......
...@@ -313,7 +313,8 @@ public class RepositoryEntryDetailsController extends FormBasicController { ...@@ -313,7 +313,8 @@ public class RepositoryEntryDetailsController extends FormBasicController {
Roles roles = ureq.getUserSession().getRoles(); Roles roles = ureq.getUserSession().getRoles();
layoutCont.contextPut("roles", roles); layoutCont.contextPut("roles", roles);
if(memberRoles.contains(GroupRoles.participant.name()) && repositoryService.isParticipantAllowedToLeave(entry)) { if(!guestOnly && memberRoles.contains(GroupRoles.participant.name())
&& repositoryService.isParticipantAllowedToLeave(entry)) {
leaveLink = uifactory.addFormLink("sign.out", "leave", "sign.out", null, formLayout, Link.LINK); leaveLink = uifactory.addFormLink("sign.out", "leave", "sign.out", null, formLayout, Link.LINK);
leaveLink.setIconLeftCSS("o_icon o_icon_sign_out"); leaveLink.setIconLeftCSS("o_icon o_icon_sign_out");
} }
...@@ -576,6 +577,8 @@ public class RepositoryEntryDetailsController extends FormBasicController { ...@@ -576,6 +577,8 @@ public class RepositoryEntryDetailsController extends FormBasicController {
} }
protected void doLeave() { protected void doLeave() {
if(guestOnly) return;
MailerResult result = new MailerResult(); MailerResult result = new MailerResult();
MailPackage reMailing = new MailPackage(result, getWindowControl().getBusinessControl().getAsString(), true); MailPackage reMailing = new MailPackage(result, getWindowControl().getBusinessControl().getAsString(), true);
LeavingStatusList status = new LeavingStatusList(); LeavingStatusList status = new LeavingStatusList();
......
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