Skip to content

Commit

Permalink
SAK-45733 allow substitution of user timezone (sakaiproject#9428)
Browse files Browse the repository at this point in the history
  • Loading branch information
ottenhoff authored Jul 19, 2021
1 parent 51126ab commit 91490ed
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.util.HashSet;
import java.util.Map;
import java.util.Properties;
import java.util.TimeZone;
import java.util.TreeMap;

import javax.servlet.http.HttpServletRequest;
Expand Down Expand Up @@ -70,6 +71,7 @@
import org.sakaiproject.site.api.Site;
import org.sakaiproject.site.api.ToolConfiguration;
import org.sakaiproject.site.cover.SiteService;
import org.sakaiproject.time.api.UserTimeService;
import org.sakaiproject.tool.api.Placement;
import org.sakaiproject.tool.api.Session;
import org.sakaiproject.tool.cover.SessionManager;
Expand Down Expand Up @@ -517,6 +519,12 @@ public static void addUserInfo(Properties ltiProps, Properties lti13subst, Map<S
setProperty(lti13subst, LTICustomVars.USER_USERNAME, user.getEid());
setProperty(lti13subst, LTICustomVars.PERSON_SOURCEDID, user.getEid());

UserTimeService userTimeService = ComponentManager.get(UserTimeService.class);
TimeZone tz = userTimeService.getLocalTimeZone(user.getId());
if (tz != null) {
setProperty(lti13subst, LTICustomVars.PERSON_ADDRESS_TIMEZONE, tz.getID());
}

if (releasename == 1) {
setProperty(ltiProps, BasicLTIConstants.LIS_PERSON_NAME_GIVEN, user.getFirstName());
setProperty(ltiProps, BasicLTIConstants.LIS_PERSON_NAME_FAMILY, user.getLastName());
Expand Down

0 comments on commit 91490ed

Please sign in to comment.