It is possible in Nathean Analytics to add a link to a report from another system e.g. an intranet system. This is supported in Nathean Analytics by way of making a call to a specific URL.

It is based upon the default URL for executing reports so when you normally open the browser to execute a report, you will see the following URL constructed as follows:

http://localhost/analytics22/Report/PrepareExecute?ReportID=11

If you modify the URL to the following (the bolded text)

http://localhost/analytics22/Report/PrepareExecute FromExternal ?ReportID=11& Token=XXXXXXX (no spaces) .

Where XXXXXXX is a User Token generated by the api call api/Login

You can generate a token for a specific user using the api and is explained in the following documents

how to use the api
api reference

Also see the file LoginAPITest.html which contains example code for acquiring a token.

The server will decode the token, and logon to the server using the credentials of that user account specified in the decoded token into the platform.

The following code for _layout.cshtml is razor code for menu items taking server url from the app settings of web.config on the host application and taking the token from the current session.


<li class="dropdown">
                        <a class="dropdown-toggle" role="button" aria-expanded="false" href="#" data-toggle="dropdown">Reports<span class="caret"></span></a>
                        <ul class="dropdown-menu">
                            <li><a href="@System.Configuration.ConfigurationManager.AppSettings["LogixECOURL"]/Report/PrepareExecuteFromExternal?ReportID=3&Token=@System.Web.HttpContext.Current.Session["CurrentUserToken"]">Executive Remuneration Summary</a></li>
                            <li><a href="@System.Configuration.ConfigurationManager.AppSettings["LogixECOURL"]/Report/PrepareExecuteFromExternal?ReportID=4&Token=@System.Web.HttpContext.Current.Session["CurrentUserToken"]">Executive Remuneration Detailed</a></li>
                            <li><a href="@System.Configuration.ConfigurationManager.AppSettings["LogixECOURL"]/Report/PrepareExecuteFromExternal?ReportID=5&Token=@System.Web.HttpContext.Current.Session["CurrentUserToken"]">Executive Job Role Remuneration Summary</a></li>
                            <li><a href="@System.Configuration.ConfigurationManager.AppSettings["LogixECOURL"]/Report/PrepareExecuteFromExternal?ReportID=6&Token=@System.Web.HttpContext.Current.Session["CurrentUserToken"]">Executive Remuneration MD Report</a></li>
                        </ul>
                    </li>

The token is added to the current session using the following code in AccountController.cs in a MVC application which uses Nathean Analytics for user authentication and authorisation


        [HttpPost]
        [AllowAnonymous]
        [ValidateAntiForgeryToken]
        public async Task<ActionResult> Login(LoginViewModel model, string returnUrl)
        {
            if (!ModelState.IsValid)
            {
                return View(model);
            }
            string userToken = AuthenticateUser(model.Email, model.Password);
            // This doesn't count login failures towards account lockout
            // To enable password failures to trigger account lockout, change to shouldLockout: true
            if (!userToken.Contains("Error:"))
            {
                var result = await SignInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, shouldLockout: false);
                *System.Web.HttpContext.Current.Session["CurrentUserToken"] = userToken;*
                switch (result)
                {
                    case SignInStatus.Success:
                        return RedirectToLocal(returnUrl);
                    case SignInStatus.LockedOut:
                        return View("Lockout");
                    case SignInStatus.RequiresVerification:
                        return RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = model.RememberMe });
                    case SignInStatus.Failure:
                    default:
                        ModelState.AddModelError("", "Invalid login attempt.");
                        return View(model);
                }
            }
            else
            {
                ModelState.AddModelError("", "Unable to authenticate user with Logix. " + userToken);
                return View(model);
            }
        }

Note Configuration of this feature is intended for individuals with the required range of skill sets to implement based upon the advice above. This naturally includes coding in the customer’s own systems, therefore Nathean’s support is limited to access to this online documentation and is provided on an as-is basis. If you require additional support this would be chargeable on a Professional Services basis. Please contact your account manager for more details.

Revision: 27
Last modified: Jul 01, 2020

Feedback

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.

Post your comment on this topic.

Post Comment