Index: lams_admin/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r49e26f9cd287f22068c3dc02ee2d25258ad64f80 -r3f99af7413ffdfdf7f69c54fd2a773f9443ac899 --- lams_admin/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 49e26f9cd287f22068c3dc02ee2d25258ad64f80) +++ lams_admin/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 3f99af7413ffdfdf7f69c54fd2a773f9443ac899) @@ -261,6 +261,7 @@ config.xmpp.password =Chat server admin password config.allow.direct.lesson.launch =Allow direct lesson launch config.allow.live.edit =Allow Live Edit +config.allow.kumalive =Allow Kumalive config.ldap.provisioning.enabled =Enable provisioning config.ldap.provider.url =LDAP server URL config.ldap.security.authentication =Authentication mechanism Index: lams_build/lib/lams/lams.jar =================================================================== diff -u -r6455f6e20efee02e4c447821693548724bb9cf8c -r3f99af7413ffdfdf7f69c54fd2a773f9443ac899 Binary files differ Index: lams_central/src/java/org/lamsfoundation/lams/web/DisplayGroupAction.java =================================================================== diff -u -r3a30c9806be555d7cc8bff332abd27521cca4145 -r3f99af7413ffdfdf7f69c54fd2a773f9443ac899 --- lams_central/src/java/org/lamsfoundation/lams/web/DisplayGroupAction.java (.../DisplayGroupAction.java) (revision 3a30c9806be555d7cc8bff332abd27521cca4145) +++ lams_central/src/java/org/lamsfoundation/lams/web/DisplayGroupAction.java (.../DisplayGroupAction.java) (revision 3f99af7413ffdfdf7f69c54fd2a773f9443ac899) @@ -54,6 +54,8 @@ import org.lamsfoundation.lams.usermanagement.User; import org.lamsfoundation.lams.usermanagement.UserOrganisationRole; import org.lamsfoundation.lams.usermanagement.service.IUserManagementService; +import org.lamsfoundation.lams.util.Configuration; +import org.lamsfoundation.lams.util.ConfigurationKeys; import org.lamsfoundation.lams.util.IndexUtils; import org.lamsfoundation.lams.util.WebUtil; import org.springframework.web.context.WebApplicationContext; @@ -196,7 +198,8 @@ } else {// CLASS_TYPE if (roles.contains(Role.ROLE_GROUP_MANAGER) || roles.contains(Role.ROLE_MONITOR)) { String name = org.getParentOrganisation().getEnableSingleActivityLessons() - ? "index.addlesson.single" : "index.addlesson"; + ? "index.addlesson.single" + : "index.addlesson"; links.add(new IndexLinkBean(name, "javascript:showAddLessonDialog(" + org.getOrganisationId() + ")", "fa fa-fw fa-plus", null)); } @@ -210,10 +213,15 @@ } } - links.add(new IndexLinkBean( - roles.contains(Role.ROLE_GROUP_MANAGER) || roles.contains(Role.ROLE_MONITOR) ? "index.kumalive.teacher" - : "index.kumalive", - "javascript:openKumalive(" + org.getOrganisationId() + ")", "fa fa-fw fa-bolt", "index.kumalive.tooltip")); + if (Configuration.getAsBoolean(ConfigurationKeys.ALLOW_KUMALIVE) && (roles.contains(Role.ROLE_GROUP_MANAGER) + || roles.contains(Role.ROLE_MONITOR) || roles.contains(Role.ROLE_LEARNER))) { + links.add(new IndexLinkBean( + roles.contains(Role.ROLE_GROUP_MANAGER) || roles.contains(Role.ROLE_MONITOR) + ? "index.kumalive.teacher" + : "index.kumalive", + "javascript:openKumalive(" + org.getOrganisationId() + ")", "fa fa-fw fa-bolt", + "index.kumalive.tooltip")); + } orgBean.setLinks(links); orgBean.setMoreLinks(moreLinks); Index: lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch20171023.sql =================================================================== diff -u --- lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch20171023.sql (revision 0) +++ lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch20171023.sql (revision 3f99af7413ffdfdf7f69c54fd2a773f9443ac899) @@ -0,0 +1,15 @@ +-- Turn off autocommit, so nothing is committed if there is an error +SET AUTOCOMMIT = 0; +SET FOREIGN_KEY_CHECKS=0; +----------------------Put all sql statements below here------------------------- + +-- LDEV-4447 Add "Allow Kumalive" to system settings +INSERT INTO lams_configuration (config_key, config_value, description_key, header_name, format, required) +VALUES ('AllowKumalive','true', 'config.allow.kumalive', 'config.header.features', 'BOOLEAN', 1); + +----------------------Put all sql statements above here------------------------- + +-- If there were no errors, commit and restore autocommit to on +COMMIT; +SET AUTOCOMMIT = 1; +SET FOREIGN_KEY_CHECKS=1; \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/util/ConfigurationKeys.java =================================================================== diff -u -r5d62f3e3ddf8ecead3be4c6bcabfa9a6d1596f20 -r3f99af7413ffdfdf7f69c54fd2a773f9443ac899 --- lams_common/src/java/org/lamsfoundation/lams/util/ConfigurationKeys.java (.../ConfigurationKeys.java) (revision 5d62f3e3ddf8ecead3be4c6bcabfa9a6d1596f20) +++ lams_common/src/java/org/lamsfoundation/lams/util/ConfigurationKeys.java (.../ConfigurationKeys.java) (revision 3f99af7413ffdfdf7f69c54fd2a773f9443ac899) @@ -114,6 +114,8 @@ public static String ALLOW_DIRECT_LESSON_LAUNCH = "AllowDirectLessonLaunch"; public static String ALLOW_EDIT_ON_FLY = "AllowLiveEdit"; + + public static String ALLOW_KUMALIVE = "AllowKumalive"; public static String SHOW_ALL_MY_LESSON_LINK = "ShowAllMyLessonLink"; Index: lams_learning/src/java/org/lamsfoundation/lams/learning/kumalive/KumaliveAction.java =================================================================== diff -u -r0f6221b6fd1a750f6bd1b6449138b740e1490640 -r3f99af7413ffdfdf7f69c54fd2a773f9443ac899 --- lams_learning/src/java/org/lamsfoundation/lams/learning/kumalive/KumaliveAction.java (.../KumaliveAction.java) (revision 0f6221b6fd1a750f6bd1b6449138b740e1490640) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/kumalive/KumaliveAction.java (.../KumaliveAction.java) (revision 3f99af7413ffdfdf7f69c54fd2a773f9443ac899) @@ -25,6 +25,8 @@ import org.lamsfoundation.lams.usermanagement.Organisation; import org.lamsfoundation.lams.usermanagement.Role; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; +import org.lamsfoundation.lams.util.Configuration; +import org.lamsfoundation.lams.util.ConfigurationKeys; import org.lamsfoundation.lams.util.ExcelCell; import org.lamsfoundation.lams.util.ExcelUtil; import org.lamsfoundation.lams.util.FileUtil; @@ -50,6 +52,12 @@ UserDTO userDTO = getUserDTO(); Integer currentUserId = userDTO.getUserID(); Integer organisationId = WebUtil.readIntParam(request, AttributeNames.PARAM_ORGANISATION_ID, false); + if (!Configuration.getAsBoolean(ConfigurationKeys.ALLOW_KUMALIVE)) { + String warning = "Kumalives are disabled"; + log.warn(warning); + response.sendError(HttpServletResponse.SC_FORBIDDEN, warning); + return null; + } if (!KumaliveAction.getSecurityService().hasOrgRole(organisationId, currentUserId, new String[] { Role.GROUP_MANAGER, Role.MONITOR }, "kumalive get rubrics", false)) { String warning = "User " + currentUserId + " is not a monitor of organisation " + organisationId; @@ -73,6 +81,12 @@ UserDTO userDTO = getUserDTO(); Integer currentUserId = userDTO.getUserID(); Integer organisationId = WebUtil.readIntParam(request, AttributeNames.PARAM_ORGANISATION_ID, false); + if (!Configuration.getAsBoolean(ConfigurationKeys.ALLOW_KUMALIVE)) { + String warning = "Kumalives are disabled"; + log.warn(warning); + response.sendError(HttpServletResponse.SC_FORBIDDEN, warning); + return null; + } if (!KumaliveAction.getSecurityService().hasOrgRole(organisationId, currentUserId, new String[] { Role.GROUP_MANAGER, Role.MONITOR }, "kumalive get report", false)) { String warning = "User " + currentUserId + " is not a monitor of organisation " + organisationId; @@ -89,6 +103,12 @@ UserDTO userDTO = getUserDTO(); Integer currentUserId = userDTO.getUserID(); Integer organisationId = WebUtil.readIntParam(request, AttributeNames.PARAM_ORGANISATION_ID, false); + if (!Configuration.getAsBoolean(ConfigurationKeys.ALLOW_KUMALIVE)) { + String warning = "Kumalives are disabled"; + log.warn(warning); + response.sendError(HttpServletResponse.SC_FORBIDDEN, warning); + return null; + } if (!KumaliveAction.getSecurityService().hasOrgRole(organisationId, currentUserId, new String[] { Role.GROUP_MANAGER, Role.MONITOR }, "kumalive get report organisation data", false)) { String warning = "User " + currentUserId + " is not a monitor of organisation " + organisationId; @@ -116,6 +136,12 @@ Long kumaliveId = WebUtil.readLongParam(request, "kumaliveId", false); Kumalive kumalive = KumaliveAction.getKumaliveService().getKumalive(kumaliveId); Organisation organisation = kumalive.getOrganisation(); + if (!Configuration.getAsBoolean(ConfigurationKeys.ALLOW_KUMALIVE)) { + String warning = "Kumalives are disabled"; + log.warn(warning); + response.sendError(HttpServletResponse.SC_FORBIDDEN, warning); + return null; + } if (!KumaliveAction.getSecurityService().hasOrgRole(organisation.getOrganisationId(), currentUserId, new String[] { Role.GROUP_MANAGER, Role.MONITOR }, "kumalive get report kumalive rubrics", false)) { String warning = "User " + currentUserId + " is not a monitor of organisation " @@ -144,6 +170,12 @@ Long kumaliveId = WebUtil.readLongParam(request, "kumaliveId", false); Kumalive kumalive = KumaliveAction.getKumaliveService().getKumalive(kumaliveId); Organisation organisation = kumalive.getOrganisation(); + if (!Configuration.getAsBoolean(ConfigurationKeys.ALLOW_KUMALIVE)) { + String warning = "Kumalives are disabled"; + log.warn(warning); + response.sendError(HttpServletResponse.SC_FORBIDDEN, warning); + return null; + } if (!KumaliveAction.getSecurityService().hasOrgRole(organisation.getOrganisationId(), currentUserId, new String[] { Role.GROUP_MANAGER, Role.MONITOR }, "kumalive get report kumalive data", false)) { String warning = "User " + currentUserId + " is not a monitor of organisation " @@ -170,6 +202,12 @@ Integer userId = WebUtil.readIntParam(request, "userId", false); Kumalive kumalive = KumaliveAction.getKumaliveService().getKumalive(kumaliveId); Organisation organisation = kumalive.getOrganisation(); + if (!Configuration.getAsBoolean(ConfigurationKeys.ALLOW_KUMALIVE)) { + String warning = "Kumalives are disabled"; + log.warn(warning); + response.sendError(HttpServletResponse.SC_FORBIDDEN, warning); + return null; + } if (!KumaliveAction.getSecurityService().hasOrgRole(organisation.getOrganisationId(), currentUserId, new String[] { Role.GROUP_MANAGER, Role.MONITOR }, "kumalive get report user data", false)) { String warning = "User " + currentUserId + " is not a monitor of organisation " @@ -202,6 +240,12 @@ organisationId = kumalive.getOrganisation().getOrganisationId(); } + if (!Configuration.getAsBoolean(ConfigurationKeys.ALLOW_KUMALIVE)) { + String warning = "Kumalives are disabled"; + log.warn(warning); + response.sendError(HttpServletResponse.SC_FORBIDDEN, warning); + return null; + } if (!KumaliveAction.getSecurityService().hasOrgRole(organisationId, currentUserId, new String[] { Role.GROUP_MANAGER, Role.MONITOR }, "kumalive export", false)) { String warning = "User " + currentUserId + " is not a monitor of organisation " + organisationId; @@ -238,6 +282,12 @@ UserDTO userDTO = getUserDTO(); Integer userId = userDTO.getUserID(); Integer organisationId = WebUtil.readIntParam(request, AttributeNames.PARAM_ORGANISATION_ID, false); + if (!Configuration.getAsBoolean(ConfigurationKeys.ALLOW_KUMALIVE)) { + String warning = "Kumalives are disabled"; + log.warn(warning); + response.sendError(HttpServletResponse.SC_FORBIDDEN, warning); + return null; + } if (!KumaliveAction.getSecurityService().hasOrgRole(organisationId, userId, new String[] { Role.GROUP_MANAGER, Role.MONITOR }, "kumalive get rubrics", false)) { String warning = "User " + userId + " is not a monitor of organisation " + organisationId; Index: lams_learning/src/java/org/lamsfoundation/lams/learning/kumalive/KumaliveWebsocketServer.java =================================================================== diff -u -rd370d27131a5cc99c714158be574703a26cd0416 -r3f99af7413ffdfdf7f69c54fd2a773f9443ac899 --- lams_learning/src/java/org/lamsfoundation/lams/learning/kumalive/KumaliveWebsocketServer.java (.../KumaliveWebsocketServer.java) (revision d370d27131a5cc99c714158be574703a26cd0416) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/kumalive/KumaliveWebsocketServer.java (.../KumaliveWebsocketServer.java) (revision 3f99af7413ffdfdf7f69c54fd2a773f9443ac899) @@ -29,6 +29,8 @@ import org.lamsfoundation.lams.usermanagement.User; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; import org.lamsfoundation.lams.usermanagement.service.IUserManagementService; +import org.lamsfoundation.lams.util.Configuration; +import org.lamsfoundation.lams.util.ConfigurationKeys; import org.lamsfoundation.lams.web.session.SessionManager; import org.lamsfoundation.lams.web.util.AttributeNames; import org.springframework.web.context.WebApplicationContext; @@ -130,6 +132,10 @@ @OnMessage public void receiveRequest(String input, Session session) throws JSONException, IOException { + if (!Configuration.getAsBoolean(ConfigurationKeys.ALLOW_KUMALIVE)) { + logger.warn("Kumalives are disabled"); + return; + } if (StringUtils.isBlank(input)) { return; }