예제 #1
0
        public bool redirectTo_DownloadLibrary(string data)
        {
            var uploadToken = new TM_WebServices().GetUploadToken();

            context.Response.Redirect("/Aspx_Pages/Library_Download.ashx?library={0}&uploadToken={1}".format(data, uploadToken));
            return(false);
        }
        public HandleUrlRequest()
        { 
            tmWebServices  = new TM_WebServices();
            tmWebServices.tmAuthentication = new TM_Authentication(tmWebServices);
            tmWebServices.tmAuthentication.disable_CSRF_Check = true;
			tmWebServices.tmAuthentication.mapUserRoles();
        }
예제 #3
0
        private Guid _sessionID; // for unit tests

        #endregion Fields

        #region Constructors

        public TM_Authentication(TM_WebServices _tmWebServices)
        {
            tmWebServices = _tmWebServices;
            disable_CSRF_Check = false;
            try
            {
                tmWebServices.javascriptProxy.adminSessionID = this.sessionID;
            }
            catch (Exception ex)	// this will happen on the unit tests
            {
                "TM_WebServices.ctor: {0}".error(ex.Message);
            }
        }
예제 #4
0
 public TM_Authentication(TM_WebServices _tmWebServices)
 {
     tmWebServices      = _tmWebServices;
     disable_CSRF_Check = false;
     try
     {
         tmWebServices.javascriptProxy.adminSessionID = this.sessionID;
     }
     catch (Exception ex)                // this will happen on the unit tests
     {
         "TM_WebServices.ctor: {0}".error(ex.Message);
     }
 }
예제 #5
0
        //All mappings are here
        public bool handleRequest(string action, string data)
        {
            try
            {
                tmWebServices = new TM_WebServices(true);       // enable webservices access (and security checks with CSRF disabled)
                action        = Encoder.HtmlEncode(action);
                data          = Encoder.HtmlEncode(data).replace("%20", " ");
                if (action.isGuid() & data.inValid())
                {
                    return(redirectTo_Article(action));
                }
                switch (action.lower())
                {
                case "gui":
                case "teammentor":
                    return(transfer_TeamMentorGui());

                case "raw":
                    return(handleAction_Raw(data));

                case "html":
                    return(handleAction_Html(data));

                case "content":
                    return(handleAction_Content(data));

                case "xml":
                    return(handleAction_Xml(data));

                case "xsl":
                    return(handleAction_Xsl(data, "TeamMentor_Article.xslt"));

                case "creole":
                    return(handleAction_Xsl(data, "JsCreole_Article.xslt"));

                case "notepad":
                    return(handleAction_Xsl(data, "Notepad_Edit.xslt"));

                case "viewer":
                case "article":
                    return(handle_ArticleViewRequest(data));

                case "edit":
                case "editor":
                    return(transfer_ArticleEditor(data));

                case "create":
                    return(handleAction_Create(data));

                case "admin":
                    return(redirectTo_ControlPanel(false));

                case "admin_extra":
                    return(redirectTo_ControlPanel(true));

                case "reload_config":
                    return(reload_Config());

                case "login":
                    return(transfer_Login());

                case "login_ok":
                    return(handle_LoginOK());

                case "logout":
                    return(redirectTo_Logout());

                case "wsdl":
                    return(redirectTo_Wsdl());

                case "reload":
                    return(reloadCache_and_RedirectToHomePage());

                case "home":
                    return(redirectTo_HomePage());

                //case "images":
                case "image":
                    return(handleAction_Image(data));

                case "jsonp":
                    return(handleAction_JsonP(data));

                case "debug":
                    return(redirectTo_DebugPage());

                case "library":
                    return(redirectTo_SetLibrary(data));

                case "library_download":
                case "download_library":
                    return(redirectTo_DownloadLibrary(data));

                case "sso":
                    return(handleAction_SSO(data));
                }

                tmWebServices.tmAuthentication.mapUserRoles(false);                                      // enable  CSRF protection
                switch (action.lower())
                {
                case "external":
                    return(showVirtualArticleExternal(data));

                case "virtualarticles":
                    return(showVirtualArticles());

                case "addvirtualarticle":
                    return(addVirtualArticleMapping(data));

                case "removevirtualarticle":
                    return(removeVirtualArticleMapping(data));

                default:
                    return(false);
                }
            }
            catch (Exception ex)
            {
                if (ex is SecurityException)
                {
                    return(transfer_Login());
                }
                //      return redirectTo_Login();
                if (ex.Message != "Thread was being aborted.")
                {
                    ex.log();
                    //context.Response.Write("<h2>Error: {0} </h2>".format(ex.Message));
                }
            }
            return(false);
        }
 public bool redirectTo_DownloadLibrary(string data)
 {
     var uploadToken = new TM_WebServices().GetUploadToken();
     context.Response.Redirect("/Aspx_Pages/Library_Download.ashx?library={0}&uploadToken={1}".format(data, uploadToken));
     return false;
 }
 //All mappings are here
 public bool handleRequest(string action , string data)
 {
     try
     {
         tmWebServices = new TM_WebServices();       // enable webservices access (and security checks)
         action = Encoder.HtmlEncode(action);
         data = Encoder.HtmlEncode(data).replace("%20"," ");
         if (action.isGuid() & data.inValid())
             return redirectTo_Article(action);
         switch (action.lower())
         {
             case "gui":
             case "teammentor":
                 return transfer_TeamMentorGui();
             case "raw":
                 return handleAction_Raw(data);
             case "html":
                 return handleAction_Html(data);
             case "content":
                 return handleAction_Content(data);
             case "xml":
                 return handleAction_Xml(data);
             case "xsl":
                 return handleAction_Xsl(data,"TeamMentor_Article.xslt");
             case "creole":
                 return handleAction_Xsl(data,"JsCreole_Article.xslt");
             case "notepad":
                 return handleAction_Xsl(data, "Notepad_Edit.xslt");
             case "viewer":
             case "article":
                 return handle_ArticleViewRequest(data);
             case "edit":
             case "editor":
                 return transfer_ArticleEditor(data);
             case "create":
                 return handleAction_Create(data);
             case "admin":
                 return redirectTo_ControlPanel(false);
             case "admin_extra":
                 return redirectTo_ControlPanel(true);
             case "reload_config":
                 return reload_Config();
             case "login":
                 return transfer_Login();
             case "login_ok":
                 return handle_LoginOK();
             case "logout":
                 return redirectTo_Logout();
             case "wsdl":
                 return redirectTo_Wsdl();
             case "reload":
                 return reloadCache_and_RedirectToHomePage();
             case "home":
                 return redirectTo_HomePage();
             //case "images":
             case "image":
                 return handleAction_Image(data);
             case "jsonp":
                 return handleAction_JsonP(data);
             case "debug":
                 return redirectTo_DebugPage();
             case "library":
                 return redirectTo_SetLibrary(data);
             case "library_download":
             case "download_library":
                 return redirectTo_DownloadLibrary(data);
             case "sso":
                 return handleAction_SSO(data);
             case "external":
                 return showVirtualArticleExternal(data);
             case "virtualarticles":
                 return showVirtualArticles();
             case "addvirtualarticle":
                 return addVirtualArticleMapping(data);
             case "removevirtualarticle":
                 return removeVirtualArticleMapping(data);
             default:
                 return false;
         }
     }
     catch (Exception ex)
     {
         if (ex is SecurityException)
             return transfer_Login();
       //      return redirectTo_Login();
         if (ex.Message != "Thread was being aborted.")
         {
             ex.log();
             //context.Response.Write("<h2>Error: {0} </h2>".format(ex.Message));
         }
     }
     return false;
 }
예제 #8
0
		public static void testsSetUp()
		{			
			"in testsSetUp".info();
    		ActivityDB.DontLog = true;     		    		    		
			//TM_Xml_Database.setDataFromCurrentScript("..\\..");
			tmXmlDatabase_JavascriptProxy = UnityInjection.useEnvironment_XmlDatabase();
			tmXmlDatabase = tmXmlDatabase_JavascriptProxy.tmXmlDatabase;			
			moq_Container = UnityInjection.container;	
			tmWebServices = moq_Container.Resolve<TM_WebServices>();  // new TM_WebServices(); 
			"done in testsSetUp".info();
		}