Inheritance: System.MarshalByRefObject
コード例 #1
0
ファイル: TM_Config_Utils.cs プロジェクト: TeamMentor/Dev
 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();
 }
コード例 #2
0
 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());
 }
コード例 #3
0
 public static string    virtualPathMapping(this TMConfig tmConfig)
 {
     if (tmConfig.TMSetup.TMLibraryDataVirtualPath.valid())
     {
         return(tmConfig.TMSetup.TMLibraryDataVirtualPath);
     }
     return(TMConsts.VIRTUAL_PATH_MAPPING);
 }
コード例 #4
0
 public static bool  newAccountsEnabled(this TMConfig tmConfig)
 {
     if (tmConfig.notNull() && tmConfig.TMSecurity.notNull())
     {
         return(tmConfig.TMSecurity.NewAccounts_Enabled);
     }
     return(false);
 }
コード例 #5
0
 public static bool  emailAdminOnNewUsers(this TMConfig tmConfig)
 {
     if (tmConfig.notNull() && tmConfig.TMSecurity.notNull())
     {
         return(tmConfig.TMSecurity.EmailAdmin_On_NewUsers);
     }
     return(false);
 }
コード例 #6
0
 public static bool  windowsAuthentication_Enabled(this TMConfig tmConfig)
 {
     if (tmConfig.notNull() && tmConfig.WindowsAuthentication.notNull())
     {
         return(tmConfig.WindowsAuthentication.Enabled);
     }
     return(false);
 }
コード例 #7
0
 public static bool  enable304Redirects(this TMConfig tmConfig)
 {
     if (tmConfig.notNull() && tmConfig.TMSetup.notNull())
     {
         return(tmConfig.TMSetup.Enable304Redirects);
     }
     return(false);
 }
コード例 #8
0
 public static bool showDetailedErrorMessages(this TMConfig tmConfig)
 {
     if (tmConfig.notNull() && tmConfig.TMSetup.notNull())
     {
         return(tmConfig.TMSetup.ShowDetailedErrorMessages);
     }
     return(false);
 }
コード例 #9
0
 public static bool  show_LibraryToAnonymousUsers(this TMConfig tmConfig)
 {
     if (tmConfig.notNull() && tmConfig.TMSecurity.notNull())
     {
         return(tmConfig.TMSecurity.Show_LibraryToAnonymousUsers);
     }
     return(false);
 }
コード例 #10
0
 public static bool  enableGZipForWebServices(this TMConfig tmConfig)
 {
     if (tmConfig.notNull() && tmConfig.TMSetup.notNull())
     {
         return(tmConfig.TMSetup.EnableGZipForWebServices);
     }
     return(false);
 }
コード例 #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();
 }
コード例 #12
0
        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
        }
コード例 #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();
        }
コード例 #14
0
ファイル: TM_XmlDatabase_InMemory.cs プロジェクト: sempf/Dev
        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
        }
コード例 #15
0
        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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #20
0
 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);
     }
 }
コード例 #21
0
ファイル: TM_Config_InMemory.cs プロジェクト: TeamMentor/Dev
 public TM_Config_InMemory()
 {
     tmConfig = TMConfig.Current = new TMConfig();
 }
コード例 #22
0
 [WebMethod(EnableSession = true)][Admin]           public bool           SetTMConfigFile(TMConfig tmConfig)
 {
     admin.demand(); return(userData.tmConfig_SetCurrent(tmConfig));
 }
コード例 #23
0
 public bool SetTMConfigFile(TMConfig tmConfig)
 {
     admin.demand(); return userData.tmConfig_SetCurrent(tmConfig);
 }
コード例 #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);
 }
コード例 #25
0
ファイル: TM_Customization.cs プロジェクト: sempf/Dev
 public TM_Customization()
 {
     tmConfig = TMConfig.Current;
 }
コード例 #26
0
ファイル: Users_Creation.cs プロジェクト: TeamMentor/Dev
        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;
        }
コード例 #27
0
 [WebMethod(EnableSession = true)][Admin]                   public bool             SetTMConfigFile(TMConfig tmConfig)
 {
     return(TMConfig.setCurrent(tmConfig));
 }
コード例 #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;
        }
コード例 #29
0
ファイル: Users_Creation.cs プロジェクト: TeamMentor/Dev
        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;
        }
コード例 #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));
 }
コード例 #31
0
 public static string    getGitUserConfigFile(this TMConfig tmConfig)
 {
     return(TMConfig.BaseFolder.pathCombine("gitUserData.config"));
 }
コード例 #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;
        }
コード例 #33
0
ファイル: TM_WebServices.Config.cs プロジェクト: roman87/Dev
 public bool SetTMConfigFile(TMConfig tmConfig)
 {
     TMConfig.Current = tmConfig;
                                                                                 return TMConfig.Current.SaveTMConfig();
 }
コード例 #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;
 }
コード例 #35
0
 [WebMethod(EnableSession = true)][Admin]                   public bool             SetTMConfigFile(TMConfig tmConfig)
 {
     TMConfig.Current = tmConfig;
     return(TMConfig.Current.SaveTMConfig());
 }
コード例 #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
        }
コード例 #37
0
ファイル: Users_Creation.cs プロジェクト: TeamMentor/Dev
 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;
 }