Inheritance: System.MarshalByRefObject
Exemplo n.º 1
0
 public static bool tmConfig_SetCurrent(this TM_UserData userData, TMConfig tmConfig)
 {
     if (userData.isNull() || tmConfig.isNull())
         return false;
     TMConfig.Current = tmConfig;
     return userData.event_TM_Config_Changed();   //return userData.tmConfig_Save();
 }
 public static string    xmlDatabasePath(this TMConfig tmConfig)
 {
     if (tmConfig.TMSetup.UseAppDataFolder)
     {
         return(TMConfig.AppData_Folder.pathCombine(TMConsts.XML_DATABASE_VIRTUAL_PATH));
     }
     return(tmConfig.librarDataRootFolder().pathCombine(TMConsts.XML_DATABASE_VIRTUAL_PATH_LEGACY).fullPath());
 }
 public static string    virtualPathMapping(this TMConfig tmConfig)
 {
     if (tmConfig.TMSetup.TMLibraryDataVirtualPath.valid())
     {
         return(tmConfig.TMSetup.TMLibraryDataVirtualPath);
     }
     return(TMConsts.VIRTUAL_PATH_MAPPING);
 }
Exemplo n.º 4
0
 public static bool  newAccountsEnabled(this TMConfig tmConfig)
 {
     if (tmConfig.notNull() && tmConfig.TMSecurity.notNull())
     {
         return(tmConfig.TMSecurity.NewAccounts_Enabled);
     }
     return(false);
 }
Exemplo n.º 5
0
 public static bool  emailAdminOnNewUsers(this TMConfig tmConfig)
 {
     if (tmConfig.notNull() && tmConfig.TMSecurity.notNull())
     {
         return(tmConfig.TMSecurity.EmailAdmin_On_NewUsers);
     }
     return(false);
 }
Exemplo n.º 6
0
 public static bool  windowsAuthentication_Enabled(this TMConfig tmConfig)
 {
     if (tmConfig.notNull() && tmConfig.WindowsAuthentication.notNull())
     {
         return(tmConfig.WindowsAuthentication.Enabled);
     }
     return(false);
 }
Exemplo n.º 7
0
 public static bool  enable304Redirects(this TMConfig tmConfig)
 {
     if (tmConfig.notNull() && tmConfig.TMSetup.notNull())
     {
         return(tmConfig.TMSetup.Enable304Redirects);
     }
     return(false);
 }
Exemplo n.º 8
0
 public static bool showDetailedErrorMessages(this TMConfig tmConfig)
 {
     if (tmConfig.notNull() && tmConfig.TMSetup.notNull())
     {
         return(tmConfig.TMSetup.ShowDetailedErrorMessages);
     }
     return(false);
 }
Exemplo n.º 9
0
 public static bool  show_LibraryToAnonymousUsers(this TMConfig tmConfig)
 {
     if (tmConfig.notNull() && tmConfig.TMSecurity.notNull())
     {
         return(tmConfig.TMSecurity.Show_LibraryToAnonymousUsers);
     }
     return(false);
 }
Exemplo n.º 10
0
 public static bool  enableGZipForWebServices(this TMConfig tmConfig)
 {
     if (tmConfig.notNull() && tmConfig.TMSetup.notNull())
     {
         return(tmConfig.TMSetup.EnableGZipForWebServices);
     }
     return(false);
 }
Exemplo n.º 11
0
 public static bool tmConfig_SetCurrent(this TM_UserData userData, TMConfig tmConfig)
 {
     if (userData.isNull() || tmConfig.isNull())
     {
         return(false);
     }
     TMConfig.Current = tmConfig;
     return(userData.event_TM_Config_Changed());   //return userData.tmConfig_Save();
 }
        public void testFixtureSetUp()
        {
            nUnitTests_Cassini = new NUnitTests_Cassini_TeamMentor().start();
            tmProxy            = nUnitTests_Cassini.tmProxy();
            ieTeamMentor       = nUnitTests_Cassini.new_IE_TeamMentor(true);
            ie                 = ieTeamMentor.ie;

            nUnitTests_Cassini.siteUri.GET().assert_Contains("TeamMentor");     // make a request to trigger Asp.NET pipeline and TM Startup
            tmProxy.map_ReferencesToTmObjects();                                // these should be alive after startup
            tmConfig = tmProxy.TmConfig     .assert_Not_Null();                 // specially the TMConfig object
        }
Exemplo n.º 13
0
        public TM_XmlDatabase_FileStorage()
        {
            SendEmails.Disable_EmailEngine = true;

            UserGroup.Admin.assert();
            tmFileStorage   = new TM_FileStorage();
            tmXmlDatabase   = tmFileStorage.TMXmlDatabase; //new TM_Xml_Database().setup();
            userData        = tmFileStorage.UserData;
            tmServer        = tmFileStorage.Server;
            tmConfig        = TMConfig.Current;

            CheckDatabaseSetup();
            UserGroup.None.assert();
        }
Exemplo n.º 14
0
        public void SetupDatabase()
        {
            tmXmlDatabase   = new TM_Xml_Database();
            userData        = tmXmlDatabase.UserData;
            tmConfig        = TMConfig.Current = new TMConfig();
            //new TM_TestLibrary().CreateTestDatabase(tmXmlDatabase);

            //all these values should be null since we are running TM memory (default setting)
            Assert.IsNull(tmXmlDatabase.Path_XmlDatabase		    , "Path_XmlDatabase");
            Assert.IsNull(tmXmlDatabase.Path_XmlLibraries		    , "Path_XmlLibraries");
            Assert.IsEmpty(tmXmlDatabase.Cached_GuidanceItems	    , "Cached_GuidanceItems");
            Assert.IsEmpty(tmXmlDatabase.UserData.ActiveSessions    , "ActiveSessions");
            Assert.AreEqual(tmXmlDatabase.UserData.TMUsers.size()   ,1 , "TMUsers");				// there should be admin
        }
        public static string    librarDataRootFolder(this TMConfig tmConfig)
        {
            //set xmlDatabasePath based on virtualPathMapping
            var virtualPathMapping = tmConfig.virtualPathMapping();
            var xmlDatabasePath    = TMConfig.WebRoot.pathCombine(virtualPathMapping).fullPath();

            //check if we can write to xmlDatabasePath (and default to App_Data if we can't write to provided direct)
            if (xmlDatabasePath.canNotWriteToPath())
            {
                xmlDatabasePath = TMConfig.AppData_Folder;
            }

            return(xmlDatabasePath);
        }
Exemplo n.º 16
0
        private static Login_Result AccountDisabledResponse(TMConfig tmConfig)
        {
            var response = new Login_Result {
                Login_Status = Login_Result.LoginStatus.Validation_Failed
            };

            if (tmConfig.showDetailedErrorMessages())
            {
                response.Validation_Results.Add(new Validation_Results
                {
                    Field   = "UserEnabled",
                    Message = TMConfig.Current.TMErrorMessages.AccountDisabledErrorMessage
                });
            }
            else
            {
                response.Simple_Error_Message = tmConfig.TMErrorMessages.General_Login_Error_Message;
            }
            return(response);
        }
Exemplo n.º 17
0
        private static Login_Result BadUsernameResponse(TMConfig tmConfig)
        {
            var response = new Login_Result {
                Login_Status = Login_Result.LoginStatus.Login_Fail
            };

            if (tmConfig.showDetailedErrorMessages())
            {
                response.Validation_Results.Add(new Validation_Results
                {
                    Field   = "Username",
                    Message = TMConfig.Current.TMErrorMessages.UserNameDoNotExistErrorMessage
                });
            }
            else
            {
                response.Simple_Error_Message = tmConfig.TMErrorMessages.General_Login_Error_Message;
            }
            return(response);
        }
Exemplo n.º 18
0
        private static Login_Result BadPasswordResponse(TMConfig tmConfig)
        {
            var response = new Login_Result {
                Login_Status = Login_Result.LoginStatus.Login_Fail
            };

            if (tmConfig.showDetailedErrorMessages())
            {
                response.Validation_Results.Add(new Validation_Results
                {
                    Field   = "Password",
                    Message = TMConfig.Current.TMErrorMessages.Login_PasswordDoNotMatch
                });
            }
            else
            {
                response.Simple_Error_Message = tmConfig.TMErrorMessages.General_Login_Error_Message;
            }

            return(response);
        }
Exemplo n.º 19
0
        public static TM_UserData   handle_UserData_ConfigActions(this TM_UserData userData)
        {
            var userConfigFile = userData.Path_UserData.pathCombine("TMConfig.config");

            if (userConfigFile.fileExists())
            {
                var newConfig = userConfigFile.load <TMConfig>();    // to check that the new TMConfig is not corrupted
                if (newConfig.isNull())
                {
                    "[handleUserDataConfigActions] failed to load config file from: {0}".error(userConfigFile);
                }
                else
                {
                    TMConfig.Location = userConfigFile;                         // update the value of TMConfig.config location
                    TMConfig.loadConfig();                                      // reload the TMConfig from the updated location
                    //TMConfig.Current = newConfig;
                    userData.AutoGitCommit = newConfig.Git.AutoCommit_UserData; // in case this changed
                }
            }
            return(userData);
        }
 public static bool      setGitUserConfigFile(this TMConfig tmConfig, string gitUserConfig_Data)
 {
     try
     {
         var gitUserConfigFile = tmConfig.getGitUserConfigFile();
         if (gitUserConfig_Data.notValid() && gitUserConfigFile.fileExists())
         {
             "[setGitUserConfigFile] Deleting current gitUserconfigFile: {0}".info(gitUserConfigFile);
             gitUserConfigFile.file_Delete();
         }
         else
         {
             gitUserConfig_Data.saveAs(gitUserConfigFile);
         }
         return(true);
     }
     catch (Exception ex)
     {
         ex.log("[setGitUserConfigFile]");
         return(false);
     }
 }
Exemplo n.º 21
0
 public TM_Config_InMemory()
 {
     tmConfig = TMConfig.Current = new TMConfig();
 }
Exemplo n.º 22
0
 [WebMethod(EnableSession = true)][Admin]           public bool           SetTMConfigFile(TMConfig tmConfig)
 {
     admin.demand(); return(userData.tmConfig_SetCurrent(tmConfig));
 }
Exemplo n.º 23
0
 public bool SetTMConfigFile(TMConfig tmConfig)
 {
     admin.demand(); return userData.tmConfig_SetCurrent(tmConfig);
 }
Exemplo n.º 24
0
 [Admin] public bool          Reload_TMConfig()
 {
     TMConfig.loadConfig();                                  // load default one
     TM_UserData.Current.handle_UserData_ConfigActions();    // load (if available) from current UserData location
     return(true);
 }
Exemplo n.º 25
0
 public TM_Customization()
 {
     tmConfig = TMConfig.Current;
 }
Exemplo n.º 26
0
        private static Signup_Result ValidateUserName(TMConfig config)
        {
            var signupResponse = new Signup_Result
            {
                Signup_Status = Signup_Result.SignupStatus.Validation_Failed,
                UserCreated = 0
            };
            if (config.showDetailedErrorMessages())
            {
                signupResponse.Validation_Results.Add(new Validation_Results { Field = "Username", Message = TMConfig.Current.TMErrorMessages.SignUpUsernameAlreadyExist });
            }
            else
            {
                signupResponse.Simple_Error_Message = config.TMErrorMessages.General_SignUp_Error_Message;
            }

            return signupResponse;
        }
Exemplo n.º 27
0
 [WebMethod(EnableSession = true)][Admin]                   public bool             SetTMConfigFile(TMConfig tmConfig)
 {
     return(TMConfig.setCurrent(tmConfig));
 }
Exemplo n.º 28
0
        private static Login_Result BadPasswordResponse(TMConfig tmConfig)
        {
            var response = new Login_Result {Login_Status = Login_Result.LoginStatus.Login_Fail};
            if (tmConfig.showDetailedErrorMessages())
            {
                response.Validation_Results.Add(new Validation_Results
                {
                    Field = "Password",
                    Message = TMConfig.Current.TMErrorMessages.Login_PasswordDoNotMatch
                });
            }
            else
                response.Simple_Error_Message = tmConfig.TMErrorMessages.General_Login_Error_Message;

            return response;
        }
Exemplo n.º 29
0
        private static Signup_Result ValidationFailed(TMConfig config, NewUser newUser)
        {
            var sigupResponse = new Signup_Result();
            var validationList = newUser.validate();
            sigupResponse.Signup_Status = Signup_Result.SignupStatus.Validation_Failed;
            sigupResponse.UserCreated = 0;
            if (config.showDetailedErrorMessages())
            {
                foreach (var validation in validationList)
                {
                    var field = validation.MemberNames.FirstOrDefault();

                    sigupResponse.Validation_Results.Add(new Validation_Results
                    {
                        Field = field,
                        Message = validation.ErrorMessage
                    });
                }
            }
            else
                sigupResponse.Simple_Error_Message = config.TMErrorMessages.General_SignUp_Error_Message;
            return  sigupResponse;
        }
Exemplo n.º 30
0
 public static DateTime  currentExpirationDate(this TMConfig tmConfig)
 {
     return((tmConfig.notNull() && tmConfig.TMSecurity.EvalAccounts_Enabled)
                ? DateTime.Now.AddDays(tmConfig.TMSecurity.EvalAccounts_Days)
                : default(DateTime));
 }
 public static string    getGitUserConfigFile(this TMConfig tmConfig)
 {
     return(TMConfig.BaseFolder.pathCombine("gitUserData.config"));
 }
Exemplo n.º 32
0
        private static Login_Result AccountExpiredResponse(TMConfig tmConfig)
        {
            var response = new Login_Result {Login_Status = Login_Result.LoginStatus.Validation_Failed};
            if (tmConfig.showDetailedErrorMessages())
            {
                response.Validation_Results.Add(new Validation_Results
                {
                    Field = "ExpirationDate",
                    Message = TMConfig.Current.TMErrorMessages.AccountExpiredErrorMessage
                });
            }
            else
                response.Simple_Error_Message = tmConfig.TMErrorMessages.General_Login_Error_Message;

            return response;
        }
Exemplo n.º 33
0
 public bool SetTMConfigFile(TMConfig tmConfig)
 {
     TMConfig.Current = tmConfig;
                                                                                 return TMConfig.Current.SaveTMConfig();
 }
Exemplo n.º 34
0
 private static Login_Result BadUsernameResponse(TMConfig tmConfig)
 {
     var response = new Login_Result {Login_Status = Login_Result.LoginStatus.Login_Fail};
     if (tmConfig.showDetailedErrorMessages())
     {
         response.Validation_Results.Add(new Validation_Results
         {
             Field = "Username",
             Message = TMConfig.Current.TMErrorMessages.UserNameDoNotExistErrorMessage
         });
     }
     else
     {
         response.Simple_Error_Message = tmConfig.TMErrorMessages.General_Login_Error_Message;
     }
     return response;
 }
 [WebMethod(EnableSession = true)][Admin]                   public bool             SetTMConfigFile(TMConfig tmConfig)
 {
     TMConfig.Current = tmConfig;
     return(TMConfig.Current.SaveTMConfig());
 }
Exemplo n.º 36
0
        public void SetupDatabase()
        {
            1.set_DEFAULT_PBKDF2_INTERACTIONS();                    // improve performance of tests that create users

            tmXmlDatabase   = new TM_Xml_Database();
            userData        = tmXmlDatabase.UserData;
            tmConfig        = TMConfig.Current = new TMConfig();

            Assert.IsNull(tmXmlDatabase.Path_XmlDatabase		    , "Path_XmlDatabase");          // null since we are running TM memory (default setting)
            Assert.IsNull(tmXmlDatabase.Path_XmlLibraries		    , "Path_XmlLibraries");         // null since we are running TM memory (default setting)
            Assert.IsEmpty(tmXmlDatabase.Cached_GuidanceItems	    , "Cached_GuidanceItems");
            Assert.IsEmpty(tmXmlDatabase.UserData.validSessions()   , "ActiveSessions");
            Assert.AreEqual(tmXmlDatabase.UserData.TMUsers.size(),1 , "TMUsers");	                 // there should be admin
        }
Exemplo n.º 37
0
 private static Signup_Result UserTags_Validation(TMConfig config, UserTag tag)
 {
     var signupResponse = new Signup_Result();
     var validationList = tag.validate();
     signupResponse.Signup_Status = Signup_Result.SignupStatus.Validation_Failed;
     signupResponse.UserCreated = 0;
     if (!config.showDetailedErrorMessages())
     {
         signupResponse.Simple_Error_Message = config.TMErrorMessages.General_SignUp_Error_Message;
     }
     else
     {
         foreach (var validation in validationList)
         {
             signupResponse.Validation_Results.Add(new Validation_Results { Field = validation.ToString(), Message = validation.ErrorMessage });
         }
     }
     return signupResponse;
 }