LogMain() 공개 정적인 메소드

public static LogMain ( string msg ) : void
msg string
리턴 void
예제 #1
0
        /* ==================================================================================== AD -> portal : Public methods */
        /// <summary>
        /// Syncs all objects of all configured sync trees from Active Directory(ies).
        /// </summary>
        public void SyncFromAD()
        {
            IUser originalUser = User.Current;

            Common.ChangeToAdminAccount();


            // init portal objects
            AdLog.LogMain("Cacheing portal users...");
            _portalUsers = GetAllPortalObjects(ADObjectType.User);
            AdLog.LogMain("Cacheing portal groups...");
            _portalGroups = GetAllPortalObjects(ADObjectType.Group);
            AdLog.LogMain("Cacheing portal containers...");
            _portalContainers = GetAllPortalObjects(ADObjectType.AllContainers);


            foreach (SyncTree syncTree in _syncTrees)
            {
                try
                {
                    SyncContainersFromAD(syncTree);
                }
                catch (Exception ex)
                {
                    // syncing of the whole tree failed
                    AdLog.LogException(ex);
                }
            }
            foreach (SyncTree syncTree in _syncTrees)
            {
                try
                {
                    SyncUsersFromAD(syncTree);
                }
                catch (Exception ex)
                {
                    // syncing of the whole tree failed
                    AdLog.LogException(ex);
                }
            }
            foreach (SyncTree syncTree in _syncTrees)
            {
                try
                {
                    if (syncTree.SyncGroups)
                    {
                        SyncGroupsFromAD(syncTree);
                    }
                    else
                    {
                        AdLog.LogMainActivity("Groups under synctree are skipped", syncTree.ADPath, syncTree.PortalPath);
                    }
                }
                catch (Exception ex)
                {
                    // syncing of the whole tree failed
                    AdLog.LogException(ex);
                }
            }
            foreach (SyncTree syncTree in _syncTrees)
            {
                try
                {
                    DeletePortalUsers(syncTree);
                }
                catch (Exception ex)
                {
                    // syncing of the whole tree failed
                    AdLog.LogException(ex);
                }
            }
            foreach (SyncTree syncTree in _syncTrees)
            {
                try
                {
                    DeletePortalGroups(syncTree);
                }
                catch (Exception ex)
                {
                    // syncing of the whole tree failed
                    AdLog.LogException(ex);
                }
            }
            foreach (SyncTree syncTree in _syncTrees)
            {
                try
                {
                    DeletePortalContainers(syncTree);
                }
                catch (Exception ex)
                {
                    // syncing of the whole tree failed
                    AdLog.LogException(ex);
                }
            }

            // dispose synctrees (searchresultcollection objects contained in synctree)
            foreach (SyncTree syncTree in _syncTrees)
            {
                syncTree.Dispose();
            }

            AdLog.EndLog();

            Common.RestoreOriginalUser(originalUser);
        }