Пример #1
0
        public void DoAction(SynchronizeContext synchronizeContext)
        {
            using (DirectoryEntry parentEntry = synchronizeContext.ADHelper.NewEntry(parentDn))
            {
                using (DirectoryEntry targetObject = SynchronizeHelper.GetSearchResultByID(this.targetObjectID).GetDirectoryEntry())
                {
                    try
                    {
                        targetObject.MoveTo(parentEntry);
                    }
                    catch (DirectoryServicesCOMException comEx)
                    {
                        switch (comEx.ErrorCode)
                        {
                        case -2147019886:
                            //重名
                            SynchronizeHelper.SolveConflictAboutMove(oguObject, targetObject, parentEntry);
                            break;

                        default:
                            WriteLog(synchronizeContext, comEx.Message);
                            break;
                        }
                    }
                }
            }
        }
Пример #2
0
 public void WriteLog(SynchronizeContext context)
 {
     context.ExceptionCount++;
     SynchronizeHelper.WithDirectoryEntry(context.ADHelper, this.adObjectID, targetObject =>
     {
         LogHelper.WriteSynchronizeDBLogDetail(SynchronizeContext.Current.SynchronizeID, "重命名", oguObject.ID, oguObject.Name,
                                               context.ADHelper.GetPropertyStrValue("objectGuid", targetObject),
                                               context.ADHelper.GetPropertyStrValue("distinguishedName", targetObject),
                                               string.Format("延迟修改:登录名修改执行错误 AD对象:{0},权限中心对象:{1}。", targetObject.Name, this.oguObject.Name));
     }, null);
 }
Пример #3
0
 public void WriteLog(SynchronizeContext context, string message)
 {
     context.ExceptionCount++;
     SynchronizeHelper.WithDirectoryEntry(this.targetObjectID, targetObject =>
     {
         LogHelper.WriteDBLogDetail(SynchronizeContext.Current.SynchronizeID, "移动对象", this.oguObject.ID, this.oguObject.Name,
                                    context.ADHelper.GetPropertyStrValue("objectGuid", targetObject),
                                    context.ADHelper.GetPropertyStrValue("distinguishedName", targetObject),
                                    string.Format("无法移动{0}到{1},错误消息{2}。", this.oguObject.Name, this.parentDn, message));
     }, null);
 }
Пример #4
0
 public void DoAction(SynchronizeContext context)
 {
     try
     {
         var result = SynchronizeHelper.GetSearchResultByID(context.ADHelper, this.adObjectID);
         using (System.DirectoryServices.DirectoryEntry ent = result.GetDirectoryEntry())
         {
             ent.Properties[this.adPropertyName].Value = oguObject.Properties[oguPropertyName];
             ent.CommitChanges();
         }
     }
     catch
     {
         this.WriteLog(context);
     }
 }
Пример #5
0
 public void DoAction(SynchronizeContext context)
 {
     try
     {
         var result = SynchronizeHelper.GetSearchResultByID(context.ADHelper, this.adObjectID);
         using (System.DirectoryServices.DirectoryEntry ent = result.GetDirectoryEntry())
         {
             ent.Rename(oguObject.ObjectType.SchemaTypeToPrefix() + "=" + ADHelper.EscapeString(oguObject.Name));
             ent.CommitChanges();
         }
     }
     catch
     {
         this.WriteLog(context);
     }
 }
Пример #6
0
        internal bool IsIncluded(IOguObject obj)
        {
            if (obj.FullPath == this.StartPath)
            {
                return(true);
            }
            else
            {
                bool result = false;
                foreach (string item in this.includePathsCache)
                {
                    if (SynchronizeHelper.IsOrInPath(obj.FullPath, item))
                    {
                        result = true;
                        break;
                    }
                }

                return(result);
            }
        }