Ejemplo n.º 1
0
        public AUser GetZTOPAccount(string SAMAccountName)
        {
            var user = ADController.GetUser(SAMAccountName);

            if (user.Type == GroupType.Guest)
            {
                return(user);
            }
            user.Managers = Core.AuthorizeManager.GetList(user.Name);
            user.MGroup   = ADController.GetGroupList(SAMAccountName);
            if (ADController.IsAdministrator(user))
            {
                user.Type = GroupType.Administrator;
            }
            else if (ADController.IsManager(user))
            {
                user.Type = GroupType.Manager;
            }
            else
            {
                if (user.Managers != null && user.Managers.Count != 0)
                {
                    user.Type = GroupType.Manager;
                }
                else
                {
                    user.Type = GroupType.Member;
                }
            }
            return(user);
        }
Ejemplo n.º 2
0
        public bool Examine(DataBook dataBook, out string error)
        {
            error = string.Empty;
            if (dataBook.Span.Days > 0 || dataBook.Span.Hours > 0 || dataBook.Span.Minutes > 0 || dataBook.Span.Seconds > 0)
            {
                return(false);
            }
            string str = "";

            if (ADController.DeleteUserFromGroup(dataBook.sAMAccountName, dataBook.GroupName, out str))
            {
                dataBook.Label = true;
                try
                {
                    Edit(dataBook);
                }catch (Exception ex)
                {
                    error = ex.Message;
                    return(false);
                }
            }
            else
            {
                error = str;
                return(false);
            }
            return(true);
        }
Ejemplo n.º 3
0
        public static bool Examine(DataBook book, out string Error)
        {
            Error = string.Empty;
            if (book.Span.Days > 0 || book.Span.Hours > 0 || book.Span.Minutes > 0 || book.Span.Seconds > 0)
            {
                return(false);
            }
            string str = string.Empty;

            if (ADController.DeleteUserFromGroup(book.Name, book.GroupName, out str))
            {
                book.Label = true;
                try
                {
                    Edit(book);
                }catch (Exception ex) {
                    Error = ex.Message;
                    return(false);
                }
            }
            else
            {
                Error = str;
                return(false);
            }
            return(true);
        }
Ejemplo n.º 4
0
 public User Get(UserIdentity Identity)
 {
     return(new User()
     {
         Name = Identity.Name,
         MGroup = ADController.GetGroupList(Identity.Name)
     });
 }
Ejemplo n.º 5
0
        /// <summary>
        /// 管理员查看申请权限记录以及进行审核
        /// </summary>
        /// <returns></returns>
        public ActionResult Manager()
        {
            var groups = ADController.GetGroupList();

            ViewBag.Wait    = Core.DataBookManager.Get(groups, CheckStatus.Wait);
            ViewBag.DGroups = ADController.GetUserDict(groups);
            return(View());
        }
Ejemplo n.º 6
0
        public User Login(string Name, string Password)
        {
            if (!ADController.Login(Name, Password))
            {
                throw new ArgumentException("当前域中不存在该用户或者密码不正确");
            }

            return(Get(Name));
        }
Ejemplo n.º 7
0
        public ActionResult Manager(int ID, string Reason, int?Day, bool?Check, CheckStatus status = CheckStatus.Wait)
        {
            Core.DataBookManager.Check(ID, Reason, Identity.Name, Day, Check, status);
            var groups = ADController.GetGroupList();

            ViewBag.Wait    = Core.DataBookManager.Get(groups, CheckStatus.Wait);
            ViewBag.DGroups = ADController.GetUserDict(groups);
            return(View());
        }
Ejemplo n.º 8
0
        public ActionResult GJson()
        {
            var treeObject = ADController.GetTreeObject();

            //return Content(treeObject.ToJson());
            return(Json(treeObject, JsonRequestBehavior.AllowGet));
            //var group = ADController.GetTree();
            //return Content(group.ToJson());
            //return JsonGroup(group);
        }
Ejemplo n.º 9
0
        public ActionResult ChangeCode(string Old, string Word)
        {
            string message = string.Empty;

            if (!ADController.SetUserPassword(sAMAccountName, Old, Word, out message))
            {
                throw new ArgumentException("修改密码失败!1、密码最少六位,推荐使用八位以上密码;2、密码包括大写字符、小写字符、数字、符号中三类;" + message);
            }
            return(Redirect("/Home/Index"));
        }
Ejemplo n.º 10
0
        public ActionResult Manager(int ID, string Reason, int?Day, bool?Check, CheckStatus status = CheckStatus.Wait)
        {
            Core.DataBookManager.Check(ID, Reason, sAMAccountName, Day, Check, status);
            Core.MessageManager.Add(Core.DataBookManager.Get(ID), ADController.GetNameBysAMAccountName(sAMAccountName));
            var groups = ADController.GetGroupList();

            ViewBag.Wait    = Core.DataBookManager.Get(groups, CheckStatus.Wait);
            ViewBag.DGroups = ADController.GetUserDict(groups);
            return(View());
        }
Ejemplo n.º 11
0
        public ActionResult Manager()
        {
            //获取我管理的组
            var groups = Core.AuthorizeManager.GetList(Identity.Name);

            //获取当前管理组的权限审核列表
            ViewBag.Wait = Core.DataBookManager.Get(groups, CheckStatus.Wait);

            ViewBag.DGroups = ADController.GetUserDict(groups);

            return(View());
        }
Ejemplo n.º 12
0
    void Awake()
    {
        if (ad != this && ad != null)
        {
            if (ad.haveAdmobApp)
            {
                ad.ctlAdmobApp.closeBanner();
            }
        }

        ad           = this;
        _admobAppCtl = GetComponent <GoogleAdmobApp> ();
    }
Ejemplo n.º 13
0
        public ActionResult ActiveUser(string sAMAccountName)
        {
            try
            {
                ADController.ActiveAccount(sAMAccountName);
            }
            catch (Exception ex)
            {
                throw new ArgumentException(ex.Message);
            }

            return(RedirectToAction("UserList", new { IsActive = true }));
        }
Ejemplo n.º 14
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.GetGroupList().ListToTable();
     return(View());
 }
Ejemplo n.º 15
0
 public ActionResult Move(string sAMAccountName, string NewOrganization)
 {
     try
     {
         if (!ADController.MoveUserToGroup(sAMAccountName, NewOrganization))
         {
             throw new ArgumentException("移动用户到新租失败!");
         }
     }
     catch (Exception ex)
     {
         throw new ArgumentException("移动用户到新组失败,错误信息:" + ex.Message);
     }
     return(Redirect("/Jurisdiction/Admin/UserList?IsActive=true"));
 }
Ejemplo n.º 16
0
 public void Screen(string[] Origin, string sAMAccountName, out List <string> None, out List <string> Have)
 {
     None = new List <string>();
     Have = new List <string>();
     foreach (var item in Origin)
     {
         if (ADController.IsMember(item, sAMAccountName))
         {
             Have.Add(item);
         }
         else
         {
             None.Add(item);
         }
     }
 }
Ejemplo n.º 17
0
 public ActionResult CreateUser(string Name, string sAMAccountName, string Organization, string FirstPassword)
 {
     if (string.IsNullOrEmpty(sAMAccountName) || string.IsNullOrEmpty(Name) || string.IsNullOrEmpty(Organization) || string.IsNullOrEmpty(FirstPassword))
     {
         throw new ArgumentException("姓名、账户名或者初始密码不能为空");
     }
     try
     {
         ADController.CreateUser(Name, sAMAccountName, Organization, FirstPassword);
     }
     catch (Exception ex)
     {
         throw new ArgumentException(ex.Message);
     }
     return(Redirect("/Jurisdiction/Admin/UserList?IsActive=true"));
 }
Ejemplo n.º 18
0
 private User LoginActiveDirectory(string username, string password)
 {
     if (ADController.TryLogin(username, password))
     {
         var user = Core.UserManager.GetUser2(username);
         if (user == null)
         {
             user = new User
             {
                 Username = username,
                 RealName = username.GetDisplayName(),
                 GroupID  = Core.UserManager.GetGroupID(username.GetGroupName())
             };
             Core.UserManager.Save(user);
         }
         return(user);
     }
     return(null);
 }
Ejemplo n.º 19
0
        public DataBook Check(int ID, string Reason, string Checker, int?Day, bool?Check, CheckStatus status)
        {
            if (string.IsNullOrEmpty(Checker))
            {
                return(null);
            }
            var book = Get(ID);

            if (book == null)
            {
                throw new ArgumentException("内部服务器错误!");
            }
            if (status == CheckStatus.Agree)
            {
                ADController.AddUserToGroup(book.sAMAccountName, book.GroupName);
            }

            if (status != CheckStatus.Wait)
            {
                book.Checker   = Checker;
                book.Reason    = Reason;
                book.CheckTime = DateTime.Now;
                book.Status    = status;
                var time = book.CheckTime;
                if (Day.HasValue)
                {
                    time = time.AddDays(Day.Value);
                }
                var span = time.Subtract(book.CheckTime);
                if (span.Days == 0 && span.Minutes == 0 && span.Hours == 0 && span.Seconds == 0)
                {
                    time = new DateTime(9999, 12, 31, 12, 00, 00);
                }
                if (Check.HasValue && Check.Value)
                {
                    time = new DateTime(9999, 12, 31, 12, 00, 00);
                }
                book.MaturityTime = time;
                Edit(book);
            }
            return(book);
        }
Ejemplo n.º 20
0
        public ActionResult Manager(int ID, string Reason, int?Day, bool?Check, CheckStatus status = CheckStatus.Wait)
        {
            var book = Core.DataBookManager.Check(ID, Reason, Identity.Name, Day, Check, status);

            Core.MessageManager.Add(new Message
            {
                Sender   = Identity.Name,
                Info     = string.Format("申请{0}的权限已经确认!", book.GroupName),
                Receiver = book.Name
            });
            var groups = ADController.GetGroupList();

            ViewBag.Wait = Core.DataBookManager.Get(groups, CheckStatus.Wait);
            if (Identity.GroupType == GroupType.Manager)
            {
                ViewBag.DGroups = ADController.GetUserDict(groups);
            }

            return(View());
        }
Ejemplo n.º 21
0
        public ActionResult Manager()
        {
            List <string> groups;

            //获取我管理的组
            if (ADController.IsManager(LUser))
            {
                groups = ADController.GetGroupList();
            }
            else
            {
                groups = Core.AuthorizeManager.GetList(ADController.GetNameBysAMAccountName(sAMAccountName));
            }
            //获取当前管理组的权限审核列表
            ViewBag.Wait = Core.DataBookManager.Get(groups, CheckStatus.Wait);

            ViewBag.DGroups = ADController.GetUserDict(groups);

            return(View());
        }
Ejemplo n.º 22
0
        public ActionResult MyManager()
        {
            List <FastGroupUserView> fasts = Session["Fasts"] as List <FastGroupUserView>;

            Session["Fasts"] = null;
            Session.Remove("Fasts");

            fasts         = Core.AuthorizeManager.RichFGUV(fasts);
            ViewBag.Fasts = fasts;
            var groups = fasts.Select(e => e.Name).ToList();

            if (groups != null)
            {
                if (Identity.GroupType == GroupType.Manager || Identity.GroupType == GroupType.Administrator)
                {
                    ViewBag.DGroups = ADController.GetUserDict(groups);
                }
            }
            return(View());
        }
Ejemplo n.º 23
0
        public ActionResult Apply(string Boss)
        {
            var           groups = HttpContext.GetValue("Group");
            List <string> None;
            List <string> Have;
            List <int>    Indexs;

            Core.AuthorizeManager.Screen(groups, sAMAccountName, out None, out Have);
            try
            {
                Indexs = Core.DataBookManager.Add(None, sAMAccountName);
                Core.MessageManager.Add(None, ADController.GetNameBysAMAccountName(sAMAccountName), Boss);
            }
            catch (Exception ex)
            {
                throw new ArgumentException(ex.Message);
            }
            ViewBag.Have = Have;
            ViewBag.Book = Core.DataBookManager.Get(Indexs);
            return(View("ASuccess"));
        }
Ejemplo n.º 24
0
        private User Get(string Name)
        {
            var user = ADController.GetUser(Name);

            user.Managers = Core.AuthorizeManager.GetList(user.Name);
            if (user.Group.Contains("Administrators"))
            {
                user.Type = GroupType.Administrator;
            }
            else
            {
                if (user.Managers.Count != 0)
                {
                    user.Type = GroupType.Manager;
                }
                else
                {
                    user.Type = GroupType.Member;
                }
            }
            return(user);
        }
Ejemplo n.º 25
0
        public ActionResult Manager(int ID, string Reason, int?Day, bool?Check, CheckStatus status = CheckStatus.Wait)
        {
            Core.DataBookManager.Check(ID, Reason, sAMAccountName, Day, Check, status);
            Core.MessageManager.Add(Core.DataBookManager.Get(ID), ADController.GetNameBysAMAccountName(sAMAccountName));
            //待审批列表
            List <string> groups;

            if (ADController.IsManager(LUser))
            {
                groups = ADController.GetGroupList();
            }
            else
            {
                groups = Core.AuthorizeManager.GetList(ADController.GetNameBysAMAccountName(sAMAccountName));
            }


            ViewBag.Wait = Core.DataBookManager.Get(groups, CheckStatus.Wait);

            ViewBag.DGroups = ADController.GetUserDict(groups);
            return(View());
        }
Ejemplo n.º 26
0
        public User GetWindowsAccount(string sAMAccountName)
        {
            if (string.IsNullOrEmpty(sAMAccountName))
            {
                return(null);
            }
            var user = ADController.GetUser(sAMAccountName);

            if (user.Type == GroupType.Guest)
            {
                return(user);
            }
            user.Managers = Core.AuthorizeManager.GetList(user.Name);
            user.MGroup   = ADController.GetGroupList(sAMAccountName);
            if (ADController.IsAdministrator(user))
            {
                user.Type = GroupType.Administrator;
            }
            else if (ADController.IsManager(user))
            {
                user.Type = GroupType.Manager;
            }
            else
            {
                if (user.Managers.Count != 0)
                {
                    user.Type = GroupType.Manager;
                }
                else
                {
                    user.Type = GroupType.Member;
                }
            }

            return(user);
        }
Ejemplo n.º 27
0
 public ActionResult ActiveUser(string sAMAccountName)
 {
     ADController.ActiveAccount(sAMAccountName);
     return(Redirect("/Jurisdiction/Admin/UserList?IsActive=true"));
 }
Ejemplo n.º 28
0
        public ActionResult GJson()
        {
            var treeObject = ADController.GetTreeObject();

            return(Json(treeObject, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 29
0
 public ActionResult Impower()
 {
     ViewBag.List   = Core.AuthorizeManager.GetList();
     ViewBag.Groups = ADController.GetGroupDict().DictToTable();
     return(View());
 }
Ejemplo n.º 30
0
        public ActionResult Gain()
        {
            var list = ADController.GetUserList();

            return(Json(list, JsonRequestBehavior.AllowGet));
        }