Exemplo n.º 1
0
        public ActionResult Del(string userName)
        {
            RtxUserManager rum = new RtxUserManager();

            if (rum.RemoveUser(userName))
            {
                return(Json(new AjaxResult {
                    Status = "ok", Msg = "删除成功", Data = userName
                }));
            }
            return(Json(new AjaxResult {
                Status = "error", Msg = "删除失败"
            }));
        }
Exemplo n.º 2
0
        public ActionResult AddDept(string deptName)
        {
            RtxUserManager rum = new RtxUserManager();

            if (rum.AddRtxUser(deptName, 1))
            {
                return(Json(new AjaxResult {
                    Status = "ok", Msg = "添加成功", Data = deptName
                }));
            }
            return(Json(new AjaxResult {
                Status = "error", Msg = "添加失败"
            }));
        }
Exemplo n.º 3
0
        public ActionResult DelUser(string userName)
        {
            string         filePath  = Server.MapPath("~/ADConfig.xml");
            AdOperate      ado       = new AdOperate(filePath);
            DirectoryEntry entry     = ado.GetEntry();
            DirectoryEntry userEntry = ado.GetUserEntry(entry, userName);

            ado.DelEntry(userEntry);
            RtxUserManager rum = new RtxUserManager();

            rum.RemoveUser(userName);
            return(Json(new AjaxResult {
                Status = "ok", Msg = "用户删除成功"
            }));
        }
Exemplo n.º 4
0
        public ActionResult SyncRtx(string comName)
        {
            string    filePath = Server.MapPath("~/ADConfig.xml");
            AdOperate ado      = new AdOperate(filePath);
            //ado.GetADConfig(filePath,comName);
            DirectoryEntry entry  = ado.GetEntry();
            RtxDeptManager dept   = new RtxDeptManager();
            RtxUserManager user   = new RtxUserManager();
            string         filter = "objectclass=organizationalUnit";

            ado.OUEntrySyncRtx(entry, filter, dept);
            filter = "(&(objectCategory=person)(objectClass=user))";
            ado.UserEntrySyncRtx(entry, filter, user, dept);
            return(Json(new AjaxResult {
                Status = "ok", Msg = "success"
            }));
        }
Exemplo n.º 5
0
        static void Main6(string[] args)
        {
            string         filePath = @" F:\1708\RtxLdap\TestCode\ADConfig.xml";
            AdOperate      ado      = new AdOperate(filePath);
            DirectoryEntry entry    = ado.GetEntry();
            RtxDeptManager dept     = new RtxDeptManager();
            RtxUserManager user     = new RtxUserManager();
            string         filter   = "objectclass=organizationalUnit";

            ado.OUEntrySyncRtx(entry, filter, dept);
            filter = "(&(objectCategory=person)(objectClass=user))";
            ado.UserEntrySyncRtx(entry, filter, user, dept);
            //if(ado.CheckADUser(path,"leinuo","Asd654123"))
            //{
            //    Console.WriteLine("测试成功");
            //}
            Console.WriteLine("测试成功");
            Console.ReadKey();
        }