Index: lams_central/src/java/org/lamsfoundation/lams/web/LoginRequestServlet.java =================================================================== diff -u -rf0924238dddb80210e0e088cda5fe967f66ef979 -rd81ac4dedc395c754e069d33a41b079cc82e0cf8 --- lams_central/src/java/org/lamsfoundation/lams/web/LoginRequestServlet.java (.../LoginRequestServlet.java) (revision f0924238dddb80210e0e088cda5fe967f66ef979) +++ lams_central/src/java/org/lamsfoundation/lams/web/LoginRequestServlet.java (.../LoginRequestServlet.java) (revision d81ac4dedc395c754e069d33a41b079cc82e0cf8) @@ -47,6 +47,7 @@ import org.lamsfoundation.lams.usermanagement.User; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; import org.lamsfoundation.lams.util.CentralConstants; +import org.lamsfoundation.lams.util.HashUtil; import org.lamsfoundation.lams.util.MessageService; import org.lamsfoundation.lams.util.WebUtil; import org.lamsfoundation.lams.web.util.AttributeNames; @@ -62,7 +63,7 @@ @SuppressWarnings("serial") public class LoginRequestServlet extends HttpServlet { private static Logger log = Logger.getLogger(LoginRequestServlet.class); - + private static final String URL_DEFAULT = "/index.jsp"; private static final String URL_AUTHOR = "/home/author.do"; @@ -79,7 +80,7 @@ private ILessonService lessonService; @Autowired private MessageService centralMessageService; - + /* * Request Spring to lookup the applicationContext tied to the current ServletContext and inject service beans * available in that applicationContext. @@ -144,52 +145,77 @@ ExtServer extServer = integrationService.getExtServer(serverId); boolean prefix = (usePrefix == null) ? true : Boolean.parseBoolean(usePrefix); try { - ExtUserUseridMap userMap = null; - if ((firstName == null) && (lastName == null)) { - userMap = integrationService.getExtUserUseridMap(extServer, extUsername, prefix); - } else { - userMap = integrationService.getImplicitExtUserUseridMap(extServer, extUsername, firstName, - lastName, locale, country, email, prefix, isUpdateUserDetails); - } - // in case of request for learner with strict authentication check cache should also contain lessonId if ((IntegrationConstants.METHOD_LEARNER_STRICT_AUTHENTICATION.equals(method) || IntegrationConstants.METHOD_MONITOR.equals(method)) && StringUtils.isBlank(lessonId)) { //show different messages for LTI learners (as this is a typical expected scenario) and all others String errorMessage = IntegrationConstants.METHOD_LEARNER_STRICT_AUTHENTICATION.equals(method) && extServer.isLtiConsumer() ? centralMessageService.getMessage("message.lesson.not.started.cannot.participate") - : "Login Failed - lsId parameter missing"; + : "Login Failed - lsid parameter missing"; response.sendError(HttpServletResponse.SC_BAD_REQUEST, errorMessage); return; } - + Authenticator.authenticateLoginRequest(extServer, timestamp, extUsername, method, lessonId, hash); + // LKC workflow automation + boolean isWorkflowAutomation = false; + if (method.equals(IntegrationConstants.WORKFLOW_AUTOMATION_METHOD_MONITOR)) { + method = IntegrationConstants.METHOD_MONITOR; + isWorkflowAutomation = true; + } else if (method.equals(IntegrationConstants.WORKFLOW_AUTOMATION_METHOD_LEARNER)) { + method = IntegrationConstants.METHOD_LEARNER; + isWorkflowAutomation = true; + } + + String waEventId = null; + String waLearningActivityId = null; + // if we are processing workflow automation call, check for required parameters + if (isWorkflowAutomation) { + waEventId = request.getParameter(IntegrationConstants.WORKFLOW_AUTOMATION_PARAM_EVENT_ID); + waLearningActivityId = request + .getParameter(IntegrationConstants.WORKFLOW_AUTOMATION_PARAM_LEARNING_ACTIVITY_ID); + if (StringUtils.isBlank(waEventId) || StringUtils.isBlank(waLearningActivityId)) { + response.sendError(HttpServletResponse.SC_BAD_REQUEST, + "Login Failed - Workflow Automation parameter eventId or learningActivityId is missing"); + return; + } + } + + ExtUserUseridMap userMap = null; + // do not create user if we are processing Workflow Automation call + if (isWorkflowAutomation || (firstName == null && lastName == null)) { + userMap = integrationService.getExtUserUseridMap(extServer, extUsername, prefix); + } else { + userMap = integrationService.getImplicitExtUserUseridMap(extServer, extUsername, firstName, lastName, + locale, country, email, prefix, isUpdateUserDetails); + } + if (extCourseId == null && StringUtils.isNotBlank(lessonId)) { // derive course ID from lesson ID ExtCourseClassMap classMap = integrationService.getExtCourseClassMap(extServer.getSid(), Long.parseLong(lessonId)); if (classMap == null) { - log.warn("Lesson " + lessonId + " is not mapped to any course for server " + extServer.getServername()); + log.warn("Lesson " + lessonId + " is not mapped to any course for server " + + extServer.getServername()); } else { extCourseId = classMap.getCourseid(); } } if (extCourseId != null) { // check if organisation, ExtCourseClassMap and user roles exist and up-to-date, and if not update them - integrationService.getExtCourseClassMap(extServer, userMap, extCourseId, courseName, method, - prefix); + integrationService.getExtCourseClassMap(extServer, userMap, extCourseId, courseName, method, prefix); } - + User user = userMap.getUser(); if (user == null) { String error = "Unable to add user to lesson class as user is missing from the user map"; log.error(error); throw new UserInfoFetchException(error); } - + //adds users to the lesson with respective roles if (StringUtils.isNotBlank(lessonId)) { if (IntegrationConstants.METHOD_LEARNER.equals(method) @@ -201,7 +227,7 @@ lessonService.addStaffMember(Long.parseLong(lessonId), user.getUserId()); } } - + String login = user.getLogin(); UserDTO loggedInUserDTO = (UserDTO) hses.getAttribute(AttributeNames.USER); String loggedInLogin = loggedInUserDTO == null ? null : loggedInUserDTO.getLogin(); @@ -210,7 +236,25 @@ ? IntegrationConstants.METHOD_LEARNER : method; // check if there is a redirect URL parameter already - String requestUrl = LoginRequestServlet.getRequestURL(request); + String requestUrl = null; + + if (isWorkflowAutomation) { + // build redirect URL which hashes event ID, learning activity ID, method and user ID + String waHash = new StringBuilder(waEventId).append(waLearningActivityId).append(method) + .append(user.getUserId()).append(extServer.getServerkey()).toString(); + waHash = HashUtil.sha1(waHash); + StringBuilder redirectURLBuilder = new StringBuilder("/lams/wa/home.do?") + .append(IntegrationConstants.WORKFLOW_AUTOMATION_PARAM_EVENT_ID).append("=").append(waEventId) + .append("&").append(IntegrationConstants.WORKFLOW_AUTOMATION_PARAM_LEARNING_ACTIVITY_ID) + .append("=").append(waLearningActivityId).append("&").append(IntegrationConstants.PARAM_METHOD) + .append("=").append(method).append("&").append(IntegrationConstants.PARAM_HASH).append("=") + .append(waHash); + requestUrl = redirectURLBuilder.toString(); + } + + if (requestUrl == null) { + requestUrl = LoginRequestServlet.getRequestURL(request); + } if ((loggedInLogin != null) && loggedInLogin.equals(login) && request.isUserInRole(role)) { response.sendRedirect(response.encodeRedirectURL(requestUrl)); return; @@ -261,7 +305,7 @@ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } - + /** * If there is a redirectURL parameter then this becomes the redirect, otherwise it * fetches the method parameter from HttpServletRequest and builds the redirect url. Index: lams_common/src/java/org/lamsfoundation/lams/integration/security/Authenticator.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rd81ac4dedc395c754e069d33a41b079cc82e0cf8 --- lams_common/src/java/org/lamsfoundation/lams/integration/security/Authenticator.java (.../Authenticator.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_common/src/java/org/lamsfoundation/lams/integration/security/Authenticator.java (.../Authenticator.java) (revision d81ac4dedc395c754e069d33a41b079cc82e0cf8) @@ -47,8 +47,8 @@ * @param hashValue * @throws AuthenticationException */ - public static void authenticate(ExtServer map, String datetime, String username, String method, - String hashValue) throws AuthenticationException { + public static void authenticate(ExtServer map, String datetime, String username, String method, String hashValue) + throws AuthenticationException { if (map == null) { throw new AuthenticationException("The third party server is not configured on LAMS server"); @@ -128,8 +128,7 @@ Authenticator.checkHash(plaintext, hashValue); } - public static void authenticate(ExtServer map, String datetime, String hashValue) - throws AuthenticationException { + public static void authenticate(ExtServer map, String datetime, String hashValue) throws AuthenticationException { if (map == null) { throw new AuthenticationException("The third party server is not configured on LAMS server"); } @@ -142,10 +141,9 @@ Authenticator.checkHash(plaintext, hashValue); } - private static void checkHash(String plaintext, String hashValue) throws AuthenticationException { + public static void checkHash(String plaintext, String hashValue) throws AuthenticationException { if (!hashValue.equals(HashUtil.sha1(plaintext))) { throw new AuthenticationException("Authentication failed!"); } } - -} +} \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/integration/service/IIntegrationService.java =================================================================== diff -u -r40de3afab4e8d589660daffb6efd6e568e87f8fa -rd81ac4dedc395c754e069d33a41b079cc82e0cf8 --- lams_common/src/java/org/lamsfoundation/lams/integration/service/IIntegrationService.java (.../IIntegrationService.java) (revision 40de3afab4e8d589660daffb6efd6e568e87f8fa) +++ lams_common/src/java/org/lamsfoundation/lams/integration/service/IIntegrationService.java (.../IIntegrationService.java) (revision d81ac4dedc395c754e069d33a41b079cc82e0cf8) @@ -27,18 +27,17 @@ import java.io.UnsupportedEncodingException; import java.util.List; -import org.apache.http.client.ClientProtocolException; -import org.imsglobal.lti.launch.LtiSigningException; import org.lamsfoundation.lams.integration.ExtCourseClassMap; -import org.lamsfoundation.lams.integration.ExtServerLessonMap; import org.lamsfoundation.lams.integration.ExtServer; +import org.lamsfoundation.lams.integration.ExtServerLessonMap; import org.lamsfoundation.lams.integration.ExtServerToolAdapterMap; import org.lamsfoundation.lams.integration.ExtUserUseridMap; import org.lamsfoundation.lams.integration.UserInfoFetchException; import org.lamsfoundation.lams.integration.UserInfoValidationException; import org.lamsfoundation.lams.integration.dto.ExtGroupDTO; import org.lamsfoundation.lams.integration.util.GroupInfoFetchException; import org.lamsfoundation.lams.lesson.Lesson; +import org.lamsfoundation.lams.usermanagement.Organisation; import org.lamsfoundation.lams.usermanagement.User; /** @@ -57,8 +56,7 @@ String prettyCourseName, String method) throws UserInfoValidationException; ExtCourseClassMap getExtCourseClassMap(ExtServer extServer, ExtUserUseridMap userMap, String extCourseId, - String extCourseName, String parentOrgId, String method, Boolean prefix) - throws UserInfoValidationException; + String extCourseName, String parentOrgId, String method, Boolean prefix) throws UserInfoValidationException; ExtUserUseridMap getExtUserUseridMap(ExtServer extServer, String extUsername, boolean prefix) throws UserInfoFetchException, UserInfoValidationException; @@ -98,23 +96,23 @@ /** * Returns integration server by its automatically-created sid. - * + * * @param serverId * @return */ ExtServer getExtServer(Integer sid); /** * Returns integration server by its human-entered serverId. - * + * * @param serverId * @return */ ExtServer getExtServer(String serverId); /** * Returns ExtServerLessonMap for the LTI Tool Consumer identified by serverId. - * + * * @param serverId * @param resourceLinkId * resource_link_id parameter from LTI request @@ -154,7 +152,7 @@ /** * Checks whether user was created via integrations. - * + * * @param userId * @return */ @@ -187,7 +185,7 @@ /** * Creates new ExtServerLessonMap object. Method is suitable for creating lessons via integration servers. - * + * * @param lessonId * @param extServer */ @@ -196,7 +194,7 @@ /** * Creates new ExtServerLessonMap object. Method is suitable for creating lessons via LTI tool consumers as long as * they provide resourceLinkId as a parameter and not lessonId. - * + * * @param lessonId * @param resourceLinkId * resource_link_id parameter sent by LTI tool consumer @@ -205,18 +203,19 @@ ExtServerLessonMap createExtServerLessonMap(Long lessonId, String resourceLinkId, ExtServer extServer); /** - * Checks whether the lesson was created from extServer (not an LTI consumer one) and returns lessonFinishCallbackUrl if it's not blank. + * Checks whether the lesson was created from extServer (not an LTI consumer one) and returns + * lessonFinishCallbackUrl if it's not blank. * * @param user * @param lesson * @return * @throws UnsupportedEncodingException */ String getLessonFinishCallbackUrl(User user, Lesson lesson) throws UnsupportedEncodingException; - + /** * Check whether specified lesson was created using LTI consumer, and if so - push user mark to that server - * + * * @param user * @param lesson */ @@ -232,36 +231,40 @@ */ boolean isIntegratedServerGroupFetchingAvailable(Long lessonId); - List getExtGroups(Long lessonId, String[] extGroupIds) throws GroupInfoFetchException, UserInfoValidationException, IOException; + List getExtGroups(Long lessonId, String[] extGroupIds) + throws GroupInfoFetchException, UserInfoValidationException, IOException; ExtCourseClassMap getExtCourseClassMap(Integer sid, Long lessonId); - + /** * Try to get users from ext server using membership service. - * - * @param lessonId if supplied, user will be added to the according lesson; and only to the course otherwise + * + * @param lessonId + * if supplied, user will be added to the according lesson; and only to the course otherwise */ void addUsersUsingMembershipService(ExtServer extServer, Long lessonId, String extCourseId, String resourceLinkId) throws IOException, UserInfoFetchException, UserInfoValidationException; - + /** * Adds an external user to the course with specified courseId. */ - ExtUserUseridMap addExtUserToCourse(ExtServer extServer, String method, String username, String firstName, String lastName, - String email, String extCourseId, String countryIsoCode, String langIsoCode) + ExtUserUseridMap addExtUserToCourse(ExtServer extServer, String method, String username, String firstName, + String lastName, String email, String extCourseId, String countryIsoCode, String langIsoCode) throws UserInfoFetchException, UserInfoValidationException; /** * Add an external user to the course with specified courseId and then adds it the the lesson with specified * lessonId. (This method makes internal call to addExtUserToCourse()). */ - ExtUserUseridMap addExtUserToCourseAndLesson(ExtServer extServer, String method, Long lessonId, String username, String firstName, - String lastName, String email, String extCourseId, String countryIsoCode, String langIsoCode) - throws UserInfoFetchException, UserInfoValidationException; + ExtUserUseridMap addExtUserToCourseAndLesson(ExtServer extServer, String method, Long lessonId, String username, + String firstName, String lastName, String email, String extCourseId, String countryIsoCode, + String langIsoCode) throws UserInfoFetchException, UserInfoValidationException; /** * Creates an external org and normal org. It does not set roles for the creator. */ ExtCourseClassMap createExtCourseClassMap(ExtServer extServer, Integer userId, String extCourseId, String extCourseName, String parentOrgId, Boolean prefix) throws UserInfoValidationException; + + void updateUserRoles(User user, Organisation org, String method); } \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/integration/service/IntegrationService.java =================================================================== diff -u -rd2d41bfb7652d3fbcfe21d152af14235eefdcbcb -rd81ac4dedc395c754e069d33a41b079cc82e0cf8 --- lams_common/src/java/org/lamsfoundation/lams/integration/service/IntegrationService.java (.../IntegrationService.java) (revision d2d41bfb7652d3fbcfe21d152af14235eefdcbcb) +++ lams_common/src/java/org/lamsfoundation/lams/integration/service/IntegrationService.java (.../IntegrationService.java) (revision d81ac4dedc395c754e069d33a41b079cc82e0cf8) @@ -44,7 +44,6 @@ import org.apache.commons.lang.StringUtils; import org.apache.http.HttpRequest; import org.apache.http.HttpResponse; -import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpResponseException; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; @@ -55,8 +54,6 @@ import org.imsglobal.lti.launch.LtiSigner; import org.imsglobal.lti.launch.LtiSigningException; import org.imsglobal.pox.IMSPOXRequest; -import org.lamsfoundation.lams.gradebook.GradebookUserLesson; -import org.lamsfoundation.lams.gradebook.service.IGradebookService; import org.lamsfoundation.lams.integration.ExtCourseClassMap; import org.lamsfoundation.lams.integration.ExtServer; import org.lamsfoundation.lams.integration.ExtServerLessonMap; @@ -94,6 +91,7 @@ import com.fasterxml.jackson.databind.node.ArrayNode; import oauth.signpost.exception.OAuthException; + /** *

* View Source @@ -224,12 +222,12 @@ * Updates user roles based on the provided method parameter. It method is "author" - we assign Role.ROLE_AUTHOR, * Role.ROLE_MONITOR, Role.ROLE_LEARNER; if method is "monitor" - we assign Role.ROLE_MONITOR; in all other cases * assign Role.ROLE_LEARNER. - * + * * @param user * @param org * @param method */ - private void updateUserRoles(User user, Organisation org, String method) { + public void updateUserRoles(User user, Organisation org, String method) { //create UserOrganisation if it doesn't exist UserOrganisation uo = service.getUserOrganisation(user.getUserId(), org.getOrganisationId()); @@ -239,14 +237,14 @@ user.addUserOrganisation(uo); service.saveUser(user); } - + Integer[] roles; if (StringUtils.equals(method, IntegrationConstants.METHOD_AUTHOR)) { roles = new Integer[] { Role.ROLE_AUTHOR, Role.ROLE_MONITOR, Role.ROLE_LEARNER }; - + } else if (StringUtils.equals(method, IntegrationConstants.METHOD_MONITOR)) { roles = new Integer[] { Role.ROLE_MONITOR }; - + } else { roles = new Integer[] { Role.ROLE_LEARNER }; } @@ -635,7 +633,7 @@ if (lesson == null) { return null; } - + // the callback url must contain %username%, %lessonid%, %timestamp% and %hash% eg: // "http://server.com/lams--bb/UserData?uid=%username%&lessonid=%lessonid%&ts=%timestamp%&hash=%hash%"; // where %username%, %lessonid%, %timestamp% and %hash% will be replaced with their real values @@ -669,7 +667,7 @@ return lessonFinishCallbackUrl; } - + @Override public void pushMarkToLtiConsumer(User user, Lesson lesson, Double userMark) { if (lesson == null) { @@ -680,7 +678,7 @@ ExtServer server = extServerLesson == null ? null : extServerLesson.getExtServer(); ExtUserUseridMap extUser = extServerLesson == null ? null : getExtUserUseridMapByUserId(server, user.getUserId()); - + // checks whether the lesson was created from extServer and whether it's a LTI Tool Consumer - create a new thread to report score back to LMS (in order to do this task in parallel not to slow down later work) if (extServerLesson != null && extUser != null && server.getServerTypeId().equals(ExtServer.LTI_CONSUMER_SERVER_TYPE) @@ -692,8 +690,7 @@ final String lessonFinishUrl = server.getLessonFinishUrl(); if (userMark != null && StringUtils.isNotBlank(lessonFinishUrl)) { Double score = lessonMaxPossibleMark.equals(0L) ? 0 : userMark / lessonMaxPossibleMark; - final String scoreStr = (userMark == null) || lessonMaxPossibleMark.equals(0L) ? "" - : score.toString(); + final String scoreStr = (userMark == null) || lessonMaxPossibleMark.equals(0L) ? "" : score.toString(); final String serverKey = server.getServerid(); final String serverSecret = server.getServerkey(); @@ -875,14 +872,15 @@ List list = service.findByProperties(ExtCourseClassMap.class, properties); return list == null || list.isEmpty() ? null : list.get(0); } - + @Override - public ExtUserUseridMap addExtUserToCourse(ExtServer extServer, String method, String username, String firstName, String lastName, - String email, String extCourseId, String countryIsoCode, String langIsoCode) + public ExtUserUseridMap addExtUserToCourse(ExtServer extServer, String method, String username, String firstName, + String lastName, String email, String extCourseId, String countryIsoCode, String langIsoCode) throws UserInfoFetchException, UserInfoValidationException { if (log.isDebugEnabled()) { - log.debug("Adding user '" + username + "' as " + method + " to course with extCourseId '" + extCourseId + "'."); + log.debug("Adding user '" + username + "' as " + method + " to course with extCourseId '" + extCourseId + + "'."); } ExtUserUseridMap userMap = null; @@ -903,19 +901,19 @@ return userMap; } - + @Override - public ExtUserUseridMap addExtUserToCourseAndLesson(ExtServer extServer, String method, Long lesssonId, String username, - String firstName, String lastName, String email, String extCourseId, String countryIsoCode, String langIsoCode) - throws UserInfoFetchException, UserInfoValidationException { + public ExtUserUseridMap addExtUserToCourseAndLesson(ExtServer extServer, String method, Long lesssonId, + String username, String firstName, String lastName, String email, String extCourseId, String countryIsoCode, + String langIsoCode) throws UserInfoFetchException, UserInfoValidationException { if (log.isDebugEnabled()) { log.debug("Adding user '" + username + "' as " + method + " to lesson with id '" + lesssonId + "'."); } - - ExtUserUseridMap userMap = addExtUserToCourse(extServer, method, username, firstName, lastName, email, extCourseId, - countryIsoCode, langIsoCode); + ExtUserUseridMap userMap = addExtUserToCourse(extServer, method, username, firstName, lastName, email, + extCourseId, countryIsoCode, langIsoCode); + User user = userMap.getUser(); if (user == null) { String error = "Unable to add user to lesson class as user is missing from the user map"; @@ -974,26 +972,26 @@ } @Override - public void addUsersUsingMembershipService(ExtServer extServer, Long lessonId, String courseId, String resourceLinkId) - throws IOException, UserInfoFetchException, UserInfoValidationException { - + public void addUsersUsingMembershipService(ExtServer extServer, Long lessonId, String courseId, + String resourceLinkId) throws IOException, UserInfoFetchException, UserInfoValidationException { + String membershipUrl = extServer.getMembershipUrl(); - //if tool consumer haven't provided membershipUrl (ToolProxyBinding.memberships.url parameter) we can't add any users + //if tool consumer haven't provided membershipUrl (ToolProxyBinding.memberships.url parameter) we can't add any users if (StringUtils.isBlank(membershipUrl)) { return; } membershipUrl += membershipUrl.contains("?") ? "&" : "?"; membershipUrl += "rlid=" + resourceLinkId; - - log.debug("Make a call to remote membershipUrl:" + membershipUrl); - HttpGet ltiServiceGetRequest = new HttpGet(membershipUrl); - ltiServiceGetRequest.setHeader("Accept", "application/vnd.ims.lis.v2.membershipcontainer+json"); + log.debug("Make a call to remote membershipUrl:" + membershipUrl); + HttpGet ltiServiceGetRequest = new HttpGet(membershipUrl); + ltiServiceGetRequest.setHeader("Accept", "application/vnd.ims.lis.v2.membershipcontainer+json"); + LtiSigner ltiSigner = new LtiOauthSigner(); try { HttpRequest httpRequest = ltiSigner.sign(ltiServiceGetRequest, extServer.getServerid(), - extServer.getServerkey()); + extServer.getServerkey()); } catch (LtiSigningException e) { throw new RuntimeException(e); } @@ -1004,17 +1002,17 @@ throw new HttpResponseException(response.getStatusLine().getStatusCode(), response.getStatusLine().getReasonPhrase()); } - + String responseString = EntityUtils.toString(response.getEntity()); log.debug("membershipUrl responded with the following message: " + responseString); JsonNode json = new ObjectMapper().readTree(responseString); - + //no users provided by membership service - if (json == null) { - return; - } - - //process users provided by membership service + if (json == null) { + return; + } + + //process users provided by membership service JsonNode memberships = json.get("pageOf").get("membershipSubject").get("membership"); for (int i = 0; i < memberships.size(); i++) { JsonNode membership = memberships.get(i); @@ -1049,7 +1047,7 @@ String method = LtiUtils.isStaff(roles, extServer) || LtiUtils.isAdmin(roles) ? IntegrationConstants.METHOD_MONITOR : IntegrationConstants.METHOD_LEARNER; - + //empty lessonId means we need to only add users to the course. Otherwise we add them to course AND lesson ExtUserUseridMap extUser = lessonId == null ? addExtUserToCourse(extServer, method, extUserId, firstName, lastName, email, courseId, @@ -1078,7 +1076,7 @@ } } } - + // --------------------------------------------------------------------- // Inversion of Control Methods - Method injection // --------------------------------------------------------------------- @@ -1094,7 +1092,7 @@ public void setToolService(ILamsCoreToolService toolService) { this.toolService = toolService; } - + public void setTimezoneService(ITimezoneService timezoneService) { this.timezoneService = timezoneService; } Index: lams_common/src/java/org/lamsfoundation/lams/integration/util/IntegrationConstants.java =================================================================== diff -u -rc975a1230b65f2245c5c77ba413afe97a2816df9 -rd81ac4dedc395c754e069d33a41b079cc82e0cf8 --- lams_common/src/java/org/lamsfoundation/lams/integration/util/IntegrationConstants.java (.../IntegrationConstants.java) (revision c975a1230b65f2245c5c77ba413afe97a2816df9) +++ lams_common/src/java/org/lamsfoundation/lams/integration/util/IntegrationConstants.java (.../IntegrationConstants.java) (revision d81ac4dedc395c754e069d33a41b079cc82e0cf8) @@ -68,4 +68,8 @@ public static final String PARAM_LESSON_ID = "lsid"; + public static final String WORKFLOW_AUTOMATION_METHOD_LEARNER = "wa_learner"; + public static final String WORKFLOW_AUTOMATION_METHOD_MONITOR = "wa_monitor"; + public static final String WORKFLOW_AUTOMATION_PARAM_EVENT_ID = "eventId"; + public static final String WORKFLOW_AUTOMATION_PARAM_LEARNING_ACTIVITY_ID = "learningActivityId"; }