public ActionResult Hub() { ViewBag.PageType = "Hub"; string ambitoNode = Request["AmbitoList"]; if (string.IsNullOrEmpty(ambitoNode) || !ambitoNode.Contains("|")) { return(RedirectToAction("Index")); } int ambitoId = Convert.ToInt32(ambitoNode.Split('|')[0]); int nodeId = Convert.ToInt32(ambitoNode.Split('|')[1]); var node = AmbitiUtility.GetAmbitoNode(ambitoId, nodeId); var ambito = AmbitiUtility.GetAmbitoById(new List <string>() { ambitoId.ToString() }); SetCookie("AmbitoId", ambitoNode.Split('|')[0]); SetCookie("NodeId", ambitoNode.Split('|')[1]); SetCookie("AmbitoName", ambito.FirstOrDefault().Name + " - " + node.Name); SetCookie("UrlWebTicket", node.UrlWebTicket); ViewBag.AmbitoName = GetCookie("AmbitoName"); ViewBag.Server = node.Server; ViewBag.VirtualProxy = node.VirtualProxy; ViewBag.UserIdentity = GetCookie("UserIdentity"); return(View()); }
// GET: Publish public ActionResult Index() { ViewBag.PageType = "InternalAction"; ViewBag.AmbitoName = GetCookie("AmbitoName"); ViewBag.UserIdentity = GetCookie("UserIdentity"); ViewBag.AmbitoList = GetCookie("AmbitoId") + "|" + GetCookie("NodeId"); string path = Server.MapPath("~/cert/client.pfx"); ReportViewModel model = new ReportViewModel(); List <SenseStream> myStreams; QRSQlikAPI QRSqlikAPI = new QRSQlikAPI(AmbitiUtility.GetAmbitoNode(GetCookie("AmbitoId"), GetCookie("NodeId")).Server, path); List <SenseApplication> notPublishedApps = new List <SenseApplication>(); string errorMessage = ""; ViewBag.Error = ""; var ambito = AmbitiUtility.GetAmbitoById(GetCookie("AmbitoId")); if (QRSqlikAPI.GetStreamsByCustomProperty(GetCookie("UserID"), GetCookie("UserDirectory"), "StreamType", "Self-Service", ambito.customproperty, out myStreams, out errorMessage)) { model = ReportViewModel.CreateReportViewModel(notPublishedApps, myStreams); } else { ViewBag.Error = "Errore nel reperimento degli streams. " + errorMessage; } if (string.IsNullOrEmpty(ViewBag.Error) && (myStreams == null || myStreams.Count == 0)) { ViewBag.Error = "Non sei abilitato a nessuno stream dell'ambito Report Self-Service BI su cui distribuire il report."; } return(View(model)); }
public ActionResult CreateReport(string Name, string Description, string AmbitoList, string SelectedTemplate) { ViewBag.PageType = "InternalAction"; string appId = ""; string path = Server.MapPath("~/cert/client.pfx"); if (string.IsNullOrEmpty(SelectedTemplate) || SelectedTemplate == "void") { QlikAPI qlikAPI = new QlikAPI(AmbitiUtility.GetAmbitoNode(GetCookie("AmbitoId"), GetCookie("NodeId")).Link, GetCookie("UserID"), GetCookie("UserDirectory"), path); qlikAPI.CreateApp(Name, Description, out appId); } else { // Duplico l'app QRSSenseApp newApp = new QRSSenseApp(); string errorMessage = ""; QRSQlikAPI QRSqlikAPI = new QRSQlikAPI(AmbitiUtility.GetAmbitoNode(GetCookie("AmbitoId"), GetCookie("NodeId")).Server, path); QRSqlikAPI.CopyApp(GetCookie("UserID"), GetCookie("UserDirectory"), SelectedTemplate, Name, out newApp, out errorMessage); QlikAPI qlikAPI = new QlikAPI(AmbitiUtility.GetAmbitoNode(GetCookie("AmbitoId"), GetCookie("NodeId")).Link, GetCookie("UserID"), GetCookie("UserDirectory"), path); qlikAPI.RenameApp(newApp.id, Description); } return(RedirectToAction("Hub", "Home", new { AmbitoList = AmbitoList })); }
public ActionResult ToPublish(string AppId, string AppName, string AppOldName, string OverwriteRequired, string StreamID, string StreamName, string AppToOverwriteId, string checkOverwrite, string AmbitoList) { string path = Server.MapPath("~/cert/client.pfx"); var ambito = AmbitiUtility.GetAmbitoById(GetCookie("AmbitoId")); if (OverwriteRequired.ToLower() == "false") { // Duplico l'app QRSSenseApp newApp = new QRSSenseApp(); string errorMessage = ""; QRSQlikAPI QRSqlikAPI = new QRSQlikAPI(AmbitiUtility.GetAmbitoNode(GetCookie("AmbitoId"), GetCookie("NodeId")).Server, path); QRSqlikAPI.CopyApp(GetCookie("UserID"), GetCookie("UserDirectory"), AppId, AppOldName, out newApp, out errorMessage); // Pubblico l'app QlikAPI qlikAPI = new QlikAPI(AmbitiUtility.GetAmbitoNode(GetCookie("AmbitoId"), GetCookie("NodeId")).Link, ambito.superuserid, ambito.superuserdom, path); qlikAPI.PublishApp(AppId, AppName, StreamID); } else { string errorMessage = ""; QlikAPI qlikAPI = new QlikAPI(AmbitiUtility.GetAmbitoNode(GetCookie("AmbitoId"), GetCookie("NodeId")).Link, ambito.superuserid, ambito.superuserdom, path); qlikAPI.ReplaceApp(AppId, AppToOverwriteId); } return(RedirectToAction("Hub", "Home", new { AmbitoList = AmbitoList })); }
public ActionResult ToShare(string AppId, string AppName, string OverwriteRequired, string StreamID, string StreamName, string AppToOverwriteId, string checkOverwrite, string AmbitoList) { string path = Server.MapPath("~/cert/client.pfx"); // Prendo il nodo dei Report Distribuiti var ambito = AmbitiUtility.GetAmbitoById(GetCookie("AmbitoId")); var distrNode = (from f in ambito.Nodes where f.NodeType == "D" select f).FirstOrDefault(); // // Duplico l'app QRSSenseApp newApp = new QRSSenseApp(); string errorMessage = ""; QRSQlikAPI QRSqlikAPI = new QRSQlikAPI(AmbitiUtility.GetAmbitoNode(GetCookie("AmbitoId"), GetCookie("NodeId")).Server, path); QRSqlikAPI.CopyApp(GetCookie("UserID"), GetCookie("UserDirectory"), AppId, AppName, out newApp, out errorMessage); bool publishResult = true; if (OverwriteRequired.ToLower() == "false") { // Pubblico l'app QlikAPI qlikAPI = new QlikAPI(AmbitiUtility.GetAmbitoNode(GetCookie("AmbitoId"), GetCookie("NodeId")).Link, ambito.superuserid, ambito.superuserdom, path); publishResult = qlikAPI.PublishApp(newApp.id, AppName, StreamID, out errorMessage); } else { // Rimpiazzo l'app QlikAPI qlikAPI = new QlikAPI(ambito.centralnode, ambito.superuserid, ambito.superuserdom, path); publishResult = qlikAPI.ReplaceApp(newApp.id, AppToOverwriteId, out errorMessage); qlikAPI.DeleteApp(newApp.id); } return(RedirectToAction("Hub", "Home", new { AmbitoList = AmbitoList })); }
public IHttpActionResult GetFarmNode(int id, int node) { //To Do : check if user has permission first var requested = AmbitiUtility.GetAmbitoNode(id, node); if (requested == null) { return(NotFound()); } return(Ok(requested)); }
public ActionResult GetReportsGrid(string idStream, string desStream) { ViewBag.idStream = idStream; ViewBag.desStream = desStream; string path = Server.MapPath("~/cert/client.pfx"); ReportViewModel model = new ReportViewModel(); QlikAPI qlikAPI = new QlikAPI(AmbitiUtility.GetAmbitoNode(GetCookie("AmbitoId"), GetCookie("NodeId")).Link, GetCookie("UserID"), GetCookie("UserDirectory"), path); List <SenseApplication> notPublishedApps; List <SenseStream> myStreams = new List <SenseStream>(); if (qlikAPI.GetMyReportsNotPublished(out notPublishedApps)) { model = ReportViewModel.CreateReportViewModel(notPublishedApps, myStreams); } return(PartialView("ReportsGrid", model)); }
public ActionResult GetReportsGrid(string idStream, string desStream) { ViewBag.idStream = idStream; ViewBag.desStream = desStream; string path = Server.MapPath("~/cert/client.pfx"); ReportViewModel model = new ReportViewModel(); List <SenseApplication> publishedApps; List <SenseStream> streams = new List <SenseStream>(); string errorMessage = ""; // Prendo gli stream di self-service e creo una lista QRSQlikAPI QRSqlikAPIMaster = new QRSQlikAPI(AmbitiUtility.GetAmbitoNode(GetCookie("AmbitoId"), GetCookie("NodeId")).Server, path); var ambito = AmbitiUtility.GetAmbitoById(GetCookie("AmbitoId")); QRSqlikAPIMaster.GetStreamsByCustomProperty(GetCookie("UserID"), GetCookie("UserDirectory"), "StreamType", "Self-Service", ambito.customproperty, out streams, out errorMessage); List <string> streamIdList = new List <string>(); if (streams != null) { streamIdList = (from s in streams select s.Id).ToList(); } // // Prendo le app pubblicate in self-service controllando che siano nella lista creata prima QlikAPI qlikAPIMaster = new QlikAPI(AmbitiUtility.GetAmbitoNode(GetCookie("AmbitoId"), GetCookie("NodeId")).Link, GetCookie("UserID"), GetCookie("UserDirectory"), path); if (qlikAPIMaster.GetPublishedAppsInSelectedStreams(streamIdList, out publishedApps)) { foreach (var app in publishedApps) { errorMessage = ""; QRSSenseAppDetail appDetail = new QRSSenseAppDetail(); //if (QRSqlikAPIMaster.GetAppDetail(ConfigurationManager.AppSettings["QlikUser"], ConfigurationManager.AppSettings["QlikUserDirectory"], app.AppId, out appDetail, out errorMessage)) if (QRSqlikAPIMaster.GetAppDetail(GetCookie("UserID"), GetCookie("UserDirectory"), app.AppId, out appDetail, out errorMessage)) { app.OwnerUserName = appDetail.owner.name; } } model = ReportViewModel.CreateReportViewModel(publishedApps, streams); } return(PartialView("ReportsGrid", model)); }
public ActionResult Detail(string AppName, string AppId, string StreamId, string AmbitoList, string StreamName, string dummy) { AppToPublishViewModel model = new AppToPublishViewModel(); model.AppId = AppId; model.AppName = AppName; model.StreamName = StreamName; model.StreamID = StreamId; ViewBag.AmbitoList = AmbitoList; string path = Server.MapPath("~/cert/client.pfx"); QRSSenseAppDetail detail = new QRSSenseAppDetail(); QRSSenseApp newApp = new QRSSenseApp(); // Prendo il nodo dei Report Distribuiti var ambito = AmbitiUtility.GetAmbitoById(new List <string>() { GetCookie("AmbitoId") }).FirstOrDefault(); var distrNode = (from f in ambito.Nodes where f.NodeType == "D" select f).FirstOrDefault(); // // Prendo le app pubblicate nel nodo dei Report Distribuiti List <SenseApplication> publishedApps; QlikAPI qlikAPIMaster = new QlikAPI(AmbitiUtility.GetAmbitoNode(GetCookie("AmbitoId"), distrNode.Id.ToString()).Link, GetCookie("UserID"), GetCookie("UserDirectory"), path); qlikAPIMaster.GetPublishedApps(out publishedApps); model.OverwriteRequired = false; // Controllo se c'è già un'app nello stream che si chiama così foreach (var publishedApp in publishedApps) { if (publishedApp.StreamID == StreamId && publishedApp.Name == AppName) { model.OverwriteRequired = true; model.AppToOverwriteId = publishedApp.AppId; } } return(View("ToShare", model)); }
// GET: CreateReport public ActionResult CreateReport() { ViewBag.PageType = "InternalAction"; ViewBag.AmbitoName = GetCookie("AmbitoName"); ViewBag.UserIdentity = GetCookie("UserIdentity"); ViewBag.AmbitoList = GetCookie("AmbitoId") + "|" + GetCookie("NodeId"); CreateReport model = new CreateReport() { Name = "", Description = "" }; model.TemplateItems = new List <ReportTemplate>(); string path = Server.MapPath("~/cert/client.pfx"); var ambito = AmbitiUtility.GetAmbitoById(GetCookie("AmbitoId")); QRSQlikAPI qrsQlikApi = new QRSQlikAPI(AmbitiUtility.GetAmbitoNode(GetCookie("AmbitoId"), GetCookie("NodeId")).Server, path); List <SenseStream> myStreams; string errorMessage = ""; qrsQlikApi.GetStreamsByCustomProperty(GetCookie("UserID"), GetCookie("UserDirectory"), "StreamType", "Template", ambito.customproperty, out myStreams, out errorMessage); if (myStreams != null && myStreams.Count > 0) { QlikAPI qlikApi = new QlikAPI(AmbitiUtility.GetAmbitoNode(GetCookie("AmbitoId"), GetCookie("NodeId")).Link, ambito.superuserid, ambito.superuserdom, path); List <SenseApplication> apps = new List <SenseApplication>(); if (qlikApi.GetPublishedAppsInSelectedStreams(myStreams.Select(s => s.Id).ToList(), out apps)) { if (apps != null && apps.Count > 0) { foreach (var app in apps) { model.TemplateItems.Add(new ReportTemplate() { TemplateStreamID = app.StreamID, TemplateID = app.AppId, TemplateDescription = app.Name }); } } } } return(View(model)); }
// GET: Share public ActionResult Index() { ViewBag.PageType = "InternalAction"; ViewBag.AmbitoName = GetCookie("AmbitoName"); ViewBag.UserIdentity = GetCookie("UserIdentity"); ViewBag.AmbitoList = GetCookie("AmbitoId") + "|" + GetCookie("NodeId"); string path = Server.MapPath("~/cert/client.pfx"); ReportViewModel model = new ReportViewModel(); // Prendo il nodo dei Report Distribuiti var ambito = AmbitiUtility.GetAmbitoById(new List <string>() { GetCookie("AmbitoId") }).FirstOrDefault(); var distrNode = (from f in ambito.Nodes where f.NodeType == "D" select f).FirstOrDefault(); // // Prendo tutti gli stream del nodo dei report distribuiti QRSQlikAPI QRSqlikAPIMaster = new QRSQlikAPI(AmbitiUtility.GetAmbitoNode(GetCookie("AmbitoId"), distrNode.Id.ToString()).Server, path); List <SenseApplication> publishedApps = new List <SenseApplication>(); List <SenseStream> streams; string errorMessage = ""; //if (QRSqlikAPIMaster.GetStreamsBuCustomProperty(ConfigurationManager.AppSettings["QlikUser"], ConfigurationManager.AppSettings["QlikUserDirectory"], "StreamType", "Production", out streams, out errorMessage)) if (QRSqlikAPIMaster.GetStreamsByCustomProperty(GetCookie("UserID"), GetCookie("UserDirectory"), "StreamType", "Production", ambito.customproperty, out streams, out errorMessage)) { model = ReportViewModel.CreateReportViewModel(publishedApps, streams); } else { ViewBag.Error = "Errore nel reperimento degli stream di distribuzione." + errorMessage; } if (string.IsNullOrEmpty(ViewBag.Error) && (streams == null || streams.Count == 0)) { ViewBag.Error = "Non sei abilitato a nessuno stream dell'ambito Report Distribuiti su cui distribuire il report."; } return(View(model)); }
public ActionResult OpenFrame(string server, string vp) { string UserID = GetCookie("UserID"); string UserDirectory = GetCookie("UserDirectory"); string UrlWebTicket = GetCookie("UrlWebTicket"); var ambito = AmbitiUtility.GetAmbitoById(GetCookie("AmbitoId")); SetCookie("Server", server); SetCookie("VirtualProxy", vp); try { QSession qSession = new QSession("POST", server, vp, UserID, UserDirectory, UrlWebTicket, ambito.customproperty); qSession.OpenSession(HttpContext.ApplicationInstance.Context); Request.Cookies.Add(qSession.GetCookie(server, true)); Response.Cookies.Add(qSession.GetCookie(server, true)); return(Redirect(qSession.GetHubURL())); } catch (Exception ex) { throw new Exception(string.Format("{0} - {1}", UserID, UserDirectory), ex); } }
public ActionResult Detail(string AppName, string AppId, string StreamId, string AmbitoList, string StreamName, string AppOldName, string dummy) { AppToPublishViewModel model = new AppToPublishViewModel(); model.AppId = AppId; model.AppName = AppName; model.StreamName = StreamName; model.StreamID = StreamId; model.AppOldName = AppOldName; ViewBag.AmbitoList = AmbitoList; string path = Server.MapPath("~/cert/client.pfx"); QRSSenseAppDetail detail = new QRSSenseAppDetail(); QRSSenseApp newApp = new QRSSenseApp(); // Prendo la lista delle app pubblicate List <SenseApplication> publishedApps; QlikAPI qlikAPIMaster = new QlikAPI(AmbitiUtility.GetAmbitoNode(GetCookie("AmbitoId"), GetCookie("NodeId")).Link, GetCookie("UserID"), GetCookie("UserDirectory"), path); qlikAPIMaster.GetPublishedApps(out publishedApps); model.OverwriteRequired = false; // Controllo se c'è già un'app nello stream che si chiama così foreach (var publishedApp in publishedApps) { if (publishedApp.StreamID == StreamId && publishedApp.Name == AppName) { model.OverwriteRequired = true; model.AppToOverwriteId = publishedApp.AppId; } } return(View("ToPublish", model)); }
public ActionResult Index() { ViewBag.PageType = "HomePage"; #if DEBUG //if (!Request.Cookies.AllKeys.Contains("IsAuthenticated")) //{ SetCookie("IsAuthenticated", "true"); SetCookie("UserID", "Test"); SetCookie("UserDirectory", "desktop-29ba4mu"); //SetCookie("UserID", "ftrevisani"); //SetCookie("UserDirectory", "METSYS"); SetCookie("UserIdentity", "Fabrizio Trevisani"); Roles = new List <string>(); Roles.Add("YA2C03"); Roles.Add("YA3C03"); SetRolesCookie(Roles); //} //else { Roles = GetRolesCookie(); } ViewBag.UserIdentity = GetCookie("UserIdentity"); #else // Da utilizzare se NON c'è SWA SWP SetCookie("IsAuthenticated", "true"); //// Per sviluppi su mia macchina //SetCookie("IsAuthenticated", "true"); SetCookie("UserID", "Test"); SetCookie("UserDirectory", "desktop-29ba4mu"); SetCookie("UserIdentity", "Test"); Roles = new List <string>(); Roles.Add("YA2C03"); Roles.Add("YA3C03"); SetRolesCookie(Roles); ViewBag.UserIdentity = GetCookie("UserIdentity"); //// //////Per sviluppi su macchina Intesa SCWAMOT0027.syssede.systest.sanpaoloimi.com ////SetCookie("UserID", "U0I4169"); ////SetCookie("UserDirectory", "SYSSPIMI"); ////SetCookie("UserIdentity", "Davide Carbone"); ////Roles = new List<string>(); ////Roles.Add("YA2C03"); ////Roles.Add("YA3C03"); ////SetRolesCookie(Roles); ////ViewBag.UserIdentity = GetCookie("UserIdentity"); //// oppure ////SetCookie("UserID", "U0J1748"); ////SetCookie("UserDirectory", "SYSSPIMI"); ////SetCookie("UserIdentity", "Fabrizio Trevisani"); ////Roles = new List<string>(); ////Roles.Add("YA2C03"); ////Roles.Add("YA3C03"); ////SetRolesCookie(Roles); ////ViewBag.UserIdentity = GetCookie("UserIdentity"); ////// ////FINE NON SWA SWP ////// Da utilizzare se c'è SWA SWP //UserProfile userProfile = null; //UserRequest userRequest = new UserRequest(Request.Headers.AllKeys.Count(), Request.Headers.AllKeys, Request.Headers); //if (userRequest.IsValid) //{ // SetCookie("IsAuthenticated", "true"); // SetCookie("UserID", userRequest.UserID); // SetCookie("UserDirectory", userRequest.UserDirectory); // SetCookie("UserIdentity", userRequest.UserIdentity); // SetCookie("SWAProfileID", userRequest.SWAProfileID); // SetCookie("LinkSWP", userRequest.LinkSWP); // ViewBag.UserIdentity = userRequest.UserIdentity; // userProfile = new UserProfile(userRequest.UserID, userRequest.LinkSWP); //} //else //{ // if (!Request.Cookies.AllKeys.Contains("IsAuthenticated")) // { // SetCookie("UserIdentity", "Utenza non riconosciuta"); // ViewBag.UserIdentity = GetCookie("UserIdentity"); // } // else // { // userProfile = new UserProfile(GetCookie("SWAProfileID"), GetCookie("LinkSWP")); // } //} //if (userProfile != null && userProfile.IsValid) //{ // Roles = new List<string>(); // foreach (var role in userProfile.Profiles) // { // Roles.Add(role.RoleID); // } // SetRolesCookie(Roles); //} ////// FINE SWA SWP // Da usare solo per test!!!! //if (userProfile == null) { throw new Exception("User Profile Null"); } //if (userProfile != null && !userProfile.IsValid) { throw new Exception("User Profile Invalid. " + userProfile.ErrorMessage); } #endif string path = Server.MapPath(Url.Content(FilePaths.RolesXML)); XDocument root = AmbitiUtility.GetXmlDocument(path); List <AmbitoRoles> AmbitoRoles = new List <AmbitoRoles>(); if (Roles != null) { AmbitoRoles = RolesUtility.GetRoles(root, Roles); } if (AmbitoRoles.Count != 0) { List <Ambiti> AmbitoList = new List <Ambiti>(RolesUtility.AssignAmbitoRoles(AmbitoRoles)); var viewModel = new AmbitiViewModel() { AmbitoList = AmbitoList }; return(View(viewModel)); } return(View()); }