/** * Format a from address from the service, no reply. * * @return a from address from the service, no reply. */ protected String getFromService() { return "\"" + ServerConfigurationService.getString("ui.service", "Sakai") + "\" <"+ ServerConfigurationService.getString("setup.request","no-reply@"+ ServerConfigurationService.getServerName()) + ">"; }
protected void logoutFromSakai() { String serverName = ServerConfigurationService.getServerName(); log.debug(" AutoSubmitAssessmentsJob Logging out of Sakai on " + serverName); EventTrackingService.post(EventTrackingService.newEvent(UsageSessionService.EVENT_LOGOUT, null, true)); UsageSessionService.logout(); // safe to logout? what if other jobs are running? }
protected void logoutFromSakai() { String serverName = ServerConfigurationService.getServerName(); log.debug(" AutoSubmitAssessmentsJob Logging out of Sakai on " + serverName); EventTrackingService.post(EventTrackingService.newEvent(UsageSessionService.EVENT_LOGOUT, null, true)); UsageSessionService.logout(); // safe to logout? what if other jobs are running? }
+ "\" <"+ServerConfigurationService.getString("setup.request","no-reply@" + ServerConfigurationService.getServerName()) + ">";
if (userEmail == null) userEmail = "no-reply@" + ServerConfigurationService.getServerName(); if (userDisplay == null) userDisplay = ServerConfigurationService.getString("ui.service", "Sakai");
{} String userEmail = ServerConfigurationService.getString("setup.request","no-reply@" + ServerConfigurationService.getServerName()); String userDisplay = ServerConfigurationService.getString("ui.service", "Sakai"); M_log.warn("Failed to load user from announcement header: " + userId + ". Will send from no-reply@" + ServerConfigurationService.getServerName() + " instead."); if (userEmail == null) userEmail = ServerConfigurationService.getString("setup.request","no-reply@" + ServerConfigurationService.getServerName()); if (userDisplay == null) userDisplay = ServerConfigurationService.getString("ui.service", "Sakai"); from="From: \"" + userDisplay + "\" <" + userEmail + ">";
String rv = "\"" + title + "\" <" + email + "@" + ServerConfigurationService.getServerName() + ">";
/** * <p>Login to sakai and start a user session. This users is intended * to be one of the 'hard wired' users; admin, postmaster, or synchrobot.</p> * <p>( this list of users can be extended; add the user via UI, update * the sakai_users table so their EID matches ID, add them to the * admin realm, restart )</p> * @param whoAs - who to log in as */ protected void loginToSakai(String whoAs) { serverName = ServerConfigurationService.getServerName(); log.debug(" AutoSubmitAssessmentsJob Logging into Sakai on " + serverName + " as " + whoAs); UsageSession session = UsageSessionService.startSession(whoAs, serverName, "AutoSubmitAssessmentsJob"); if (session == null) { EventTrackingService.post(EventTrackingService.newEvent(SamigoConstants.EVENT_AUTO_SUBMIT_JOB_ERROR, whoAs + " unable to log into " + serverName, true)); return; } Session sakaiSession = SessionManager.getCurrentSession(); sakaiSession.setUserId(whoAs); sakaiSession.setUserEid(whoAs); // update the user's externally provided realm definitions authzGroupService.refreshUser(whoAs); // post the login events EventTrackingService.post(EventTrackingService.newEvent(UsageSessionService.EVENT_LOGIN, whoAs + " running " + serverName, true)); }
/** * <p>Login to sakai and start a user session. This users is intended * to be one of the 'hard wired' users; admin, postmaster, or synchrobot.</p> * <p>( this list of users can be extended; add the user via UI, update * the sakai_users table so their EID matches ID, add them to the * admin realm, restart )</p> * @param whoAs - who to log in as */ protected void loginToSakai(String whoAs) { serverName = ServerConfigurationService.getServerName(); log.debug(" AutoSubmitAssessmentsJob Logging into Sakai on " + serverName + " as " + whoAs); UsageSession session = UsageSessionService.startSession(whoAs, serverName, "AutoSubmitAssessmentsJob"); if (session == null) { EventTrackingService.post(EventTrackingService.newEvent(SamigoConstants.EVENT_AUTO_SUBMIT_JOB_ERROR, whoAs + " unable to log into " + serverName, true)); return; } Session sakaiSession = SessionManager.getCurrentSession(); sakaiSession.setUserId(whoAs); sakaiSession.setUserEid(whoAs); // update the user's externally provided realm definitions authzGroupService.refreshUser(whoAs); // post the login events EventTrackingService.post(EventTrackingService.newEvent(UsageSessionService.EVENT_LOGIN, whoAs + " running " + serverName, true)); }
/** * Format a to address, to the related site, but with no reply. * * @param event * The event that matched criteria to cause the notification. * @return a to address, to the related site, but with no reply. */ protected String getToSiteNoReply(Event event) { Reference ref = EntityManager.newReference(event.getResource()); // use either the configured site, or if not configured, the site (context) of the resource String siteId = (getSite() != null) ? getSite() : ref.getContext(); // get a site title String title = siteId; try { Site site = SiteService.getSite(siteId); title = site.getTitle(); } catch (Exception ignore) { } return "\"" + title + "\" <"+ ServerConfigurationService.getString("setup.request","no-reply@" + ServerConfigurationService.getServerName()) + ">"; }