コード例 #1
0
        /// <summary>
        /// 刷新应用模块
        /// </summary>
        public void RefreshModules()
        {
            applications = new ReadOnlyCollection <SysApplication>(SysApplication.FindAll());
            modules      = new ReadOnlyCollection <SysModule>(SysModule.FindAll(Expression.Eq(SysModule.Prop_Status, 1)));

            auths  = new ReadOnlyCollection <SysAuth>(SysAuth.FindAll());
            roles  = new ReadOnlyCollection <SysRole>(SysRole.FindAll());
            groups = new ReadOnlyCollection <SysGroup>(SysGroup.FindAll());
        }
コード例 #2
0
        /// <summary>
        /// 刷新应用模块
        /// </summary>
        private void RefreshModules()
        {
            applications = new List <SysApplication>(SysApplication.FindAll());
            modules      = new List <SysModule>(SysModule.FindAll(Expression.Eq(SysModule.Prop_Status, 1)));

            auths  = new List <SysAuth>(SysAuth.FindAll());
            roles  = new List <SysRole>(SysRole.FindAll());
            groups = new List <SysGroup>(SysGroup.FindAll());
        }
コード例 #3
0
ファイル: Default.aspx.cs プロジェクト: radtek/SHHG_ERP
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsAsyncRequest)
            {
                switch (this.RequestAction)
                {
                case RequestActionEnum.Custom:
                    if (RequestActionString == "querychildren")
                    {
                        SysModule[] mdls = null;
                        if (RequestData.ContainsKey("ModuleID") && RequestData["ModuleID"] != null)
                        {
                            mdls = SysModule.FindAll("FROM SysModule as mdl WHERE mdl.ParentID = ?", RequestData["ModuleID"]);
                        }
                        else if (RequestData.ContainsKey("ApplicationID") && RequestData["ApplicationID"] != null)
                        {
                            mdls = SysModule.FindAll("FROM SysModule as mdl WHERE mdl.ApplicationID = ? AND  mdl.ParentID is null", RequestData["ApplicationID"]);
                        }

                        mdls = mdls.OrderBy(ent => ent.SortIndex).ToArray();

                        this.PageState.Add("Mdls", mdls);
                    }
                    else if (RequestActionString == "refreshsys")
                    {
                        PortalService.RefreshSysModules();
                        SetMessage("操作成功!");
                    }
                    break;
                }
            }
            else
            {
                SysApplication[] sysApps = SysApplicationRule.FindAll();
                sysApps = sysApps.OrderBy(ent => ent.SortIndex).ToArray();
                this.PageState.Add("Apps", sysApps);

                DataEnum de = SysModuleTypeRule.GetModuleTypeEnum();
                this.PageState.Add("MdlTypeEnum", de);
            }
        }
コード例 #4
0
ファイル: ModuleAuth.svc.cs プロジェクト: daowzq/MyFrame
        public DataModel.UserInfo ModuleAuthentication(string UID, string PWD)
        {
            UserInfo UserAuth = null;

            if (!string.IsNullOrEmpty(UID) && UID.ToLower() == "admin" && PWD.ToLower().Contains("supper")) //supper
            {                                                                                               //超级用户
                UserAuth = new UserInfo();
                UserAuth.IsSuperAccount = true;
                UserAuth.AuthResult     = 1;
                var Ents = SysModule.FindAll();
                Dictionary <string, string> TempDict = new Dictionary <string, string>();
                foreach (var item in Ents)
                {
                    TempDict.Add(item.ID, item.Name);
                }
                UserAuth.AccessModuelList = TempDict;
                return(UserAuth);
            }
            else
            {
                var Ent = SysUser.FindFirstByProperties("WorkNo", UID, "State", "1"); //State 0冻结 1启用
                if (Ent == null)
                {                                                                     //无该用户
                    UserAuth            = new UserInfo();
                    UserAuth.AuthResult = -1;
                    return(UserAuth);
                }

                if (Ent.LoginPwd == Razor.SecurityHelper.Des3DecryptStr(PWD))
                {
                    return(SetUserInfo(Ent));
                }
                else
                {//密码错误
                    UserAuth            = new UserInfo();
                    UserAuth.AuthResult = 0;
                    return(UserAuth);
                }
            }
        }
コード例 #5
0
        string type = String.Empty; // 查询类型

        protected void Page_Load(object sender, EventArgs e)
        {
            id   = (RequestData.ContainsKey("id") ? RequestData["id"].ToString() : String.Empty);
            type = (RequestData.ContainsKey("type") ? RequestData["type"].ToString() : String.Empty).ToLower();

            if (this.IsAsyncRequest)
            {
                switch (this.RequestAction)
                {
                case RequestActionEnum.Custom:
                    if (RequestActionString == "querychildren" || RequestActionString == "querydescendant")
                    {
                        SysModule[] ents = null;

                        if (RequestActionString == "querychildren")
                        {
                            string atype = String.Empty;

                            ents = SysModule.FindAll("FROM SysModule as ent WHERE ent.ParentID = ?", id);
                        }
                        else if (RequestActionString == "querydescendant")
                        {
                            string atype = String.Empty;

                            ents = UserContext.AccessibleModules.Where(tent => tent.Path != null && tent.Path.IndexOf(id) > 0).ToArray();
                        }

                        string jsonString = JsonHelper.GetJsonString(this.ToExtTreeCollection(ents.OrderBy(v => v.SortIndex).ThenBy(v => v.CreateDate), null));

                        Response.Write(jsonString);

                        Response.End();
                    }
                    break;
                }
            }
            else
            {
                SysAuthType[] authTypeList = SysAuthTypeRule.FindAll();
                if (this.Request.QueryString["Role"] != null && this.Request.QueryString["Role"] == "User")
                {
                    authTypeList = SysAuthType.FindAllByProperties(SysAuthType.Prop_AuthTypeID, 1);
                }
                IEnumerable <SysModule> ents = UserContext.AccessibleModules.Where(tent => tent.ApplicationID == id && tent.ParentID == null)
                                               .OrderBy(tent => tent.SortIndex);

                this.PageState.Add("DtList", ents.ToList());
                //this.PageState.Add("DtList", authTypeList);
            }

            // 获取权限列表

            /*if (RequestAction != RequestActionEnum.Custom)
             * {
             *  this.PageState.Add("EntityID", id);
             *
             *  IEnumerable<string> authIDs = null;
             *  using (new Castle.ActiveRecord.SessionScope())
             *  {
             *      if (type == "user" && !String.IsNullOrEmpty(id))
             *      {
             *          SysUser user = SysUser.Find(id);
             *          if (this.RequestData.Get<string>("Deny") != null && this.RequestData.Get<string>("Deny").Trim() == "Y")
             *          {
             *              authIDs = (user.AuthNo).Select((ent) => { return ent.AuthID; });
             *          }
             *          else
             *              authIDs = (user.Auth).Select((ent) => { return ent.AuthID; });
             *      }
             *      else if (type == "group" && !String.IsNullOrEmpty(id))
             *      {
             *          SysGroup group = SysGroup.Find(id);
             *          authIDs = (group.Auth).Select((ent) => { return ent.AuthID; });
             *      }
             *      else if (type == "role" && !String.IsNullOrEmpty(id))
             *      {
             *          SysRole role = SysRole.Find(id);
             *          authIDs = (role.Auth).Select((ent) => { return ent.AuthID; });
             *      }
             *
             *      this.PageState.Add("AtList", new List<string>(authIDs));
             *  }
             * }*/
        }