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

OO-3302: fix some issues if organisation feature is disabled

parent 8c460d1e
No related branches found
No related tags found
No related merge requests found
......@@ -22,6 +22,7 @@ package org.olat.modules.curriculum.ui;
import java.util.ArrayList;
import java.util.List;
import org.olat.basesecurity.OrganisationModule;
import org.olat.basesecurity.OrganisationRoles;
import org.olat.basesecurity.OrganisationService;
import org.olat.basesecurity.model.OrganisationRefImpl;
......@@ -65,6 +66,8 @@ public class EditCurriculumController extends FormBasicController {
@Autowired
private CurriculumService curriculumService;
@Autowired
private OrganisationModule organisationModule;
@Autowired
private OrganisationService organisationService;
/**
......@@ -148,6 +151,7 @@ public class EditCurriculumController extends FormBasicController {
organisationEl = uifactory.addDropdownSingleselect("curriculum.organisation", formLayout,
keyList.toArray(new String[keyList.size()]), valueList.toArray(new String[valueList.size()]));
organisationEl.setVisible(organisationModule.isEnabled());
if(selectedOrganisationKey != null && keyList.contains(selectedOrganisationKey)) {
organisationEl.select(selectedOrganisationKey, true);
}
......@@ -181,7 +185,7 @@ public class EditCurriculumController extends FormBasicController {
protected void formOK(UserRequest ureq) {
//create a new one
Organisation organisation;
if(organisationEl != null && organisationEl.isOneSelected()) {
if(organisationEl != null && organisationEl.isVisible() && organisationEl.isOneSelected()) {
organisation = organisationService
.getOrganisation(new OrganisationRefImpl(Long.valueOf(organisationEl.getSelectedKey())));
} else {
......
......@@ -157,7 +157,11 @@ public class AuthoringEditAccessAndBookingController extends FormBasicController
}
public List<Organisation> getSelectedOrganisations() {
List<Organisation> organisations = new ArrayList<>(repositoryEntryOrganisations);
if(organisationsEl == null || !organisationsEl.isVisible()) {
return repositoryEntryOrganisations;
}
List<Organisation> organisations = new ArrayList<>();
Set<String> organisationKeys = organisationsEl.getKeys();
Collection<String> selectedOrganisationKeys = organisationsEl.getSelectedKeys();
......@@ -350,6 +354,8 @@ public class AuthoringEditAccessAndBookingController extends FormBasicController
List<Organisation> organisationList = new ArrayList<>(organisations);
List<Organisation> reOrganisations = repositoryService.getOrganisations(entry);
repositoryEntryOrganisations = new ArrayList<>(reOrganisations);
for(Organisation reOrganisation:reOrganisations) {
if(reOrganisation != null && !organisationList.contains(reOrganisation)) {
organisationList.add(reOrganisation);
......@@ -364,7 +370,6 @@ public class AuthoringEditAccessAndBookingController extends FormBasicController
keyList.add(organisation.getKey().toString());
valueList.add(organisation.getDisplayName());
}
repositoryEntryOrganisations = new ArrayList<>(reOrganisations.size());
organisationsEl = uifactory.addCheckboxesDropdown("organisations", "cif.organisations", formLayout,
keyList.toArray(new String[keyList.size()]), valueList.toArray(new String[valueList.size()]),
null, null);
......@@ -382,7 +387,7 @@ public class AuthoringEditAccessAndBookingController extends FormBasicController
if (organisationsEl != null) {
organisationsEl.clearError();
if(!organisationsEl.isAtLeastSelected(1)) {
if(organisationsEl.isVisible() && !organisationsEl.isAtLeastSelected(1)) {
organisationsEl.setErrorKey("form.legende.mandatory", null);
allOk &= false;
}
......
......@@ -23,6 +23,7 @@ import java.util.ArrayList;
import java.util.List;
import org.olat.NewControllerFactory;
import org.olat.basesecurity.OrganisationModule;
import org.olat.basesecurity.OrganisationRoles;
import org.olat.basesecurity.OrganisationService;
import org.olat.basesecurity.model.OrganisationRefImpl;
......@@ -86,6 +87,8 @@ public class CreateRepositoryEntryController extends FormBasicController impleme
@Autowired
private LicenseModule licenseModule;
@Autowired
private OrganisationModule organisationModule;
@Autowired
private OrganisationService organisationService;
@Autowired
private RepositoryEntryLicenseHandler licenseHandler;
......@@ -162,7 +165,7 @@ public class CreateRepositoryEntryController extends FormBasicController impleme
if(!organisationKeys.isEmpty()) {
organisationEl.select(organisationKeys.get(0), true);
}
organisationEl.setVisible(organisationKeys.size() > 1);
organisationEl.setVisible(organisationKeys.size() > 1 && organisationModule.isEnabled());
FormLayoutContainer buttonContainer = FormLayoutContainer.createButtonLayout("buttonContainer", getTranslator());
formLayout.add("buttonContainer", buttonContainer);
......@@ -231,7 +234,7 @@ public class CreateRepositoryEntryController extends FormBasicController impleme
String displayname = displaynameEl.getValue();
Organisation organisation;
if(organisationEl.isOneSelected()) {
if(organisationEl.isVisible() && organisationEl.isOneSelected()) {
Long organisationKey = Long.valueOf(organisationEl.getSelectedKey());
organisation = organisationService.getOrganisation(new OrganisationRefImpl(organisationKey));
} else {
......
......@@ -62,6 +62,9 @@ ldap.attributename.useridentifyer=uid
#make sure the lecture module is enabled
lecture.enabled=true
#make sure the organisation module is enabled
organisation.enabled=true
#make sure it works it mimic the pre 8.3 behavior
group.mandatory.enrolment.email.users=false
group.mandatory.enrolment.email.authors=false
......
......@@ -7,7 +7,6 @@
tomcat.id=2
defaultlang=de
db.show_sql=false
#force use of java.io.tmpDir for unit tests
archive.dir=
log.dir=
......@@ -18,6 +17,12 @@ instance.id=${test.env.instance.id:2}
generate.index.at.startup=false
#disable debugging
olat.debug=false
localization.cache=true
is.translation.server=disabled
deploy.course.exports=false
# for UserTest
keepUserEmailAfterDeletion=false
keepUserLoginAfterDeletion=true
......@@ -29,11 +34,8 @@ jmx.rmi.port=${test.env.jmx.rmi.port.0:1009}
# SingleVM jms.broker.url
jms.broker.url=vm://embedded?broker.persistent=false
search.broker.url=vm://embedded?broker.persistent=false
# Cluster (remote) jms.broker.url
#jms.broker.url=failover:(tcp://localhost:${test.env.jms.broker.port}?wireFormat.maxInactivityDuration=0)
#search.broker.url=failover:(tcp://localhost:${test.env.jms.broker.port}?wireFormat.maxInactivityDuration=0)
smtp.host=testing
smtp.host=disabled
#
# if you like to run your tests against mysql just uncomment the following. Please do not commit it!
......@@ -48,6 +50,24 @@ db.default.schema=olattest
auto.upgrade.database=false
db.hibernate.hikari.leakDetectionThreshold=120000
#site we need
site.portal.enable=true
# ldap
ldap.enable=true
ldap.ldapSyncOnStartup=false
ldap.ldapUrl=ldap://localhost:1389
ldap.ldapSystemDN=uid=test,ou=person,dc=olattest,dc=org
ldap.ldapSystemPW=olattest
ldap.ldapBases=ou=person,dc=olattest,dc=org
ldap.attributename.useridentifyer=uid
#make sure the lecture module is enabled
lecture.enabled=true
#make sure the organisation module is enabled
organisation.enabled=true
#make sure it works it mimic the pre 8.3 behavior
group.mandatory.enrolment.email.users=false
group.mandatory.enrolment.email.authors=false
......@@ -61,6 +81,14 @@ group.accept.membership.usermanagers=false
group.accept.membership.groupmanagers=false
group.accept.membership.administrators=false
#make sure the test for QTI 1.2 works
#make sure the test and survey for QTI 1.2 works
qti12.create.resources.enabled=true
course.node.survey.enabled=true
#security
base.security.frameOptionsSameOrigine=enabled
base.security.strictTransportSecurity=enabled
base.security.xContentTypeOptions=enabled
base.security.contentSecurityPolicy=enabled
base.security.contentSecurityPolicy.frameSrc=http://lti.frentix.com
......@@ -62,6 +62,9 @@ ldap.attributename.useridentifyer=uid
#make sure the lecture module is enabled
lecture.enabled=true
#make sure the organisation module is enabled
organisation.enabled=true
#make sure it works it mimic the pre 8.3 behavior
group.mandatory.enrolment.email.users=false
group.mandatory.enrolment.email.authors=false
......
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