Exemple #1
0
 public ADTestSupport()
 {
     _testDirectory = Path.Combine(Path.GetTempPath(), "BonoboAdTest");
     SafelyDeleteTestData();
     ConfigurationManager.AppSettings["ActiveDirectoryBackendPath"] = _testDirectory;
     ActiveDirectorySettings.LoadSettings();
     ADBackend.ResetSingletonForTesting();
 }
Exemple #2
0
        // Before 6.0.0 the mapping was done via the name property. After that the Guid is used.
        public static void UpdateADBackend()
        {
            // Make a copy of the current backendfolder if it exists, so we can use the modern models for saving
            // it all to the correct location directly
            var backendDirectory = PathEncoder.GetRootPath(ActiveDirectorySettings.BackendPath);
            var backupDirectory  = PathEncoder.GetRootPath(ActiveDirectorySettings.BackendPath + "_pre6.0.0_" + DateTime.UtcNow.ToString("yyyyMMdd_HHmmss"));

            if (Directory.Exists(backendDirectory) && BackEndNeedsUpgrade(backendDirectory))
            {
                MakeBackupOfBackendDirectory(backendDirectory, backupDirectory);

                // We must create one that will not automatically update the items while we update them
                ADBackend.ResetSingletonWithoutAutomaticUpdate();

                var newUsers = UpdateUsers(Path.Combine(backupDirectory, "Users"));
                var newTeams = UpdateTeams(Path.Combine(backupDirectory, "Teams"), newUsers);
                UpdateRoles(Path.Combine(backupDirectory, "Roles"), newUsers);
                UpdateRepos(Path.Combine(backupDirectory, "Repos"), newUsers, newTeams);

                // We are done, enable automatic update again.
                ADBackend.ResetSingletonWithAutomaticUpdate();
            }
        }