Ejemplo n.º 1
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();
            }
        }
Ejemplo n.º 2
0
 public ADBackendStore(string rootpath, string name)
 {
     _storagePath = Path.Combine(PathEncoder.GetRootPath(rootpath), name);
     _content     = LoadContent();
 }
Ejemplo n.º 3
0
 public ADBackendStore(IHostingEnvironment hostingEnvironment, string rootpath, string name)
 {
     _storagePath = Path.Combine(PathEncoder.GetRootPath(hostingEnvironment, rootpath), name);
     _content     = LoadContent();
 }