diff --git a/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Centre/SelfAssessmentReports/SelfAssessmentReportsController.cs b/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Centre/SelfAssessmentReports/SelfAssessmentReportsController.cs index 0491429fd3..54699c02da 100644 --- a/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Centre/SelfAssessmentReports/SelfAssessmentReportsController.cs +++ b/DigitalLearningSolutions.Web/Controllers/TrackingSystem/Centre/SelfAssessmentReports/SelfAssessmentReportsController.cs @@ -87,7 +87,10 @@ public IActionResult DownloadSelfAssessmentReport(int selfAssessmentId) public IActionResult TableauCompetencyDashboard() { var userEmail = User.GetUserPrimaryEmail(); - var jwt = tableauConnectionHelper.GetTableauJwt(userEmail); + var adminId = User.GetAdminId(); + var jwt = tableauConnectionHelper.GetTableauJwt(); + ViewBag.Email = userEmail; + ViewBag.AdminId = adminId; ViewBag.SiteName = tableauSiteName; ViewBag.TableauServerUrl = tableauUrl; ViewBag.WorkbookName = workbookName; diff --git a/DigitalLearningSolutions.Web/Helpers/ExternalApis/TableauConnectionHelper.cs b/DigitalLearningSolutions.Web/Helpers/ExternalApis/TableauConnectionHelper.cs index ffe5240748..b04528cf44 100644 --- a/DigitalLearningSolutions.Web/Helpers/ExternalApis/TableauConnectionHelper.cs +++ b/DigitalLearningSolutions.Web/Helpers/ExternalApis/TableauConnectionHelper.cs @@ -9,7 +9,7 @@ public interface ITableauConnectionHelperService { - string GetTableauJwt(string email); + string GetTableauJwt(); } public class TableauConnectionHelper : ITableauConnectionHelperService { @@ -24,7 +24,7 @@ public TableauConnectionHelper(IConfiguration config) connectedAppSecretKey = config.GetTableauClientSecret(); user = config.GetTableauUser(); } - public string GetTableauJwt(string email) + public string GetTableauJwt() { var key = Encoding.UTF8.GetBytes(connectedAppSecretKey); var signingCredentials = new SigningCredentials(new SymmetricSecurityKey(key), SecurityAlgorithms.HmacSha256); @@ -41,8 +41,7 @@ public string GetTableauJwt(string email) { "aud", "tableau" }, { "exp", new DateTimeOffset(DateTime.UtcNow.AddMinutes(5)).ToUnixTimeSeconds() }, { "sub", user }, - { "scp", new[] { "tableau:views:embed" } }, - { "ExernalUserEmail", new [] { email } } + { "scp", new[] { "tableau:views:embed" } } }; var token = new JwtSecurityToken(header, payload); var tokenHandler = new JwtSecurityTokenHandler(); diff --git a/DigitalLearningSolutions.Web/Views/TrackingSystem/Centre/SelfAssessmentReports/TableauCompetencyDashboard.cshtml b/DigitalLearningSolutions.Web/Views/TrackingSystem/Centre/SelfAssessmentReports/TableauCompetencyDashboard.cshtml index 163d6d7b46..c9b29164f1 100644 --- a/DigitalLearningSolutions.Web/Views/TrackingSystem/Centre/SelfAssessmentReports/TableauCompetencyDashboard.cshtml +++ b/DigitalLearningSolutions.Web/Views/TrackingSystem/Centre/SelfAssessmentReports/TableauCompetencyDashboard.cshtml @@ -5,6 +5,8 @@ var viewName = ViewBag.ViewName; var jwtToken = ViewBag.JwtToken; var siteName = ViewBag.SiteName; + var aid = ViewBag.AdminId; + var email = ViewBag.Email; var srcUrl = $"{tableauServerUrl}/t/{siteName}/views/{workbookName}/{viewName}"; ViewData["Title"] = "Supervised self assessments dashboard"; } @@ -21,6 +23,8 @@ If the dashboard doesn't appear after a few seconds, reload the page + + @section scripts { @* We are not using Yarn/npm for the Tableau JS becaue of errors during installation relating to a missing dependency *@