Пример #1
0
 public ActionResult Impower(Authorize authorize)
 {
     try
     {
         Core.AuthorizeManager.Add(Core.AuthorizeManager.Get(HttpContext));
     }
     catch (Exception ex)
     {
         throw new ArgumentException(ex.Message);
     }
     ViewBag.List   = Core.AuthorizeManager.GetList();
     ViewBag.Groups = ADController.GetGroupDict().DictToTable();
     return(View());
 }
Пример #2
0
 public ActionResult Impower()
 {
     ViewBag.List   = Core.AuthorizeManager.GetList();
     ViewBag.Groups = ADController.GetGroupDict().DictToTable();
     return(View());
 }
Пример #3
0
        static void Work()
        {
            var big   = XmlHelper.GetDitrict();
            var codes = big.Select(e => e.Substring(0, 4)).ToList();
            var dict  = ADController.GetGroupDict();

            foreach (var entry in dict)
            {
                var    name = entry.Key;
                ADType type = ADType.Other;
                if (name == "目录权限")//目录权限
                {
                    #region 更新目录权限组
                    type = ADType.Catalog;
                    #endregion
                }
                else
                {
                    if (name.Length >= 4)
                    {
                        var key = name.Substring(0, 4);
                        if (codes.Contains(key))//浙江省行政区权限组
                        {
                            type = ADType.Organication;

                            #region 更新城市权限组
                            //var current = oldgranication.FirstOrDefault(e => e.Name.ToUpper() == name.ToUpper());
                            //if (current == null)
                            //{
                            //    current = manager.Save(new Model.ADGroup { Name = name });
                            //    var insertgroup = entry.Value.Select(e => new ADGroup { Name = e.Name, Type = ADType.Group, OID = current.ID }).ToList();
                            //    manager.Save(insertgroup);
                            //}
                            //else
                            //{
                            //    var oldgroup = manager.GetByOID(current.ID);
                            //    oldgranication.Remove(current);
                            //    foreach (var item in entry.Value)
                            //    {
                            //        var gname = item.Name;
                            //        var gcurrent = oldgroup.FirstOrDefault(e => e.Name.ToUpper() == gname.ToUpper());
                            //        if (gcurrent == null)
                            //        {
                            //            gcurrent = manager.Save(new ADGroup { Name = gname, OID = current.ID });
                            //        }
                            //        else
                            //        {
                            //            oldgroup.Remove(gcurrent);
                            //            if (gcurrent.OID != current.ID)
                            //            {
                            //                gcurrent.OID = current.ID;
                            //                manager.Update(gcurrent);
                            //            }
                            //        }
                            //    }
                            //    if (oldgroup.Count > 0)
                            //    {
                            //        manager.Remove(oldgroup);
                            //    }
                            //}
                            #endregion
                        }
                    }
                }
                CheckRecord(name, type, entry.Value);
            }

            if (_parents.Count > 0)
            {
                _manager.Remove(_parents);
            }
        }