Exemplo n.º 1
0
        private void InitPageInfo()
        {
            IRoleManage irm = GetInterface.GetIRoleManage();

            MR_PageInfo pinfo = irm.GetNode(this.NodeId);

            if (pinfo.PID != this.NodeId || pinfo.PID <= 0)
            {
                return;
            }

            this.NodeName = pinfo.PName;
            this.NodeURL  = pinfo.PUrl;

            IList <MR_PageInfo> pageinfos = irm.GetHidePage(this.NodeId);

            this.dl_InChild.DataSource = pageinfos;
            this.dl_InChild.DataBind();
            this.NowInListId = new List <int>();
            if (pageinfos != null)
            {
                foreach (MR_PageInfo apage in pageinfos)
                {
                    this.NowInListId.Add(apage.PID);
                }
            }
            IList <MR_PageInfo> waitpageinfos = irm.GetListToList(-1, false);

            this.dl_MenuList.DataSource = waitpageinfos;
            this.dl_MenuList.DataBind();
        }
Exemplo n.º 2
0
        private void LoadChilds()
        {
            MR_Admin adminInfo = AdminPageStatic.GetLoginUserInfo();
            int      aid       = adminInfo.AID;
            int      gid       = adminInfo.GID;

            IRoleManage irm = GetInterface.GetIRoleManage();

            this.MenuTitle = irm.GetNode(this.PageId).PName;
            if (gid > 0)
            {
                this.Childs = SiteRuleCheck.GetAdminPages(aid, gid, PageId, true);
            }
            else if (gid == -1)
            {
                this.Childs = irm.GetList(PageId, false, true);
            }
            else
            {
                this.Childs = new List <MR_PageInfo>();
            }
            if (this.Childs == null)
            {
                this.Childs = new List <MR_PageInfo>();
            }
            rep_Nav.DataSource = this.Childs;
            rep_Nav.DataBind();
        }
Exemplo n.º 3
0
        /// <summary>
        /// 点击添加新隐藏页按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void lb_save_Click(object sender, EventArgs e)
        {
            string      pname    = this.tb_add_pname.Text.Trim();
            string      purl     = this.tb_add_url.Text.Trim();
            int         parentid = -1;
            IRoleManage irm      = GetInterface.GetIRoleManage();

            irm.AddNode(pname, purl, parentid, 0);
            InitPageInfo();

            SiteRuleCheck.FlushPageAndRightCache();
        }
Exemplo n.º 4
0
        /// <summary>
        /// 取得对象在选择的根目录下的权限,同时绑定待选页面
        /// </summary>
        private void BindChildRight()
        {
            //取得正确的接口用于取子项
            IRightsSetting irs = GetInterface.GetIRightsSetting(this.NowSettingType);

            if (irs == null)
            {
                return;
            }

            // 取得对象列表
            string foridlist = this.ddl_For.SelectedValue;

            // 取根目录
            int parentid = this.ddl_Root.SelectedValue.GetInt(0, false);

            this.NowSelectRootName = this.ddl_Root.SelectedItem.Text.ToString();
            this.NowSelectRootId   = parentid;

            IRoleManage         rmobj    = GetInterface.GetIRoleManage();
            IList <MR_PageInfo> NowChild = rmobj.GetListToList(parentid, false);//取得目录下的子节点


            IList <MR_PageInfo> nowRight;

            if (foridlist.IsNumber(false))  //如果是单个管理员或用户组
            {
                int forid = foridlist.GetInt(0, false);
                nowRight = irs.GetChildMenuToList(forid, parentid, false);
            }
            else    //如果是多个管理员或用户组
            {
                nowRight = this.NowAddToIdList;
            }


            this.NowInListId = new List <int>();
            foreach (MR_PageInfo aright in nowRight)
            {
                if (!this.NowInListId.Contains(aright.PID))
                {
                    this.NowInListId.Add(aright.PID);
                }
            }

            this.gvInRole.DataSource = nowRight;
            this.gvInRole.DataBind();

            this.dl_MenuList.DataSource = NowChild;
            this.dl_MenuList.DataBind();
        }
Exemplo n.º 5
0
        /// <summary>
        /// 绑定一级目录
        /// </summary>
        /// <param name="parendId"></param>
        private void BindMenu()
        {
            this.ddl_Root.Items.Clear();
            IRoleManage         irmobj = GetInterface.GetIRoleManage();
            IList <MR_PageInfo> pinfos = irmobj.GetList(0, false, true);
            IList <MR_PageInfo> toList = new List <MR_PageInfo>();

            AdminPageStatic.ParseMenuChild(pinfos, 0, ref toList);
            this.ddl_Root.DataSource     = toList;
            this.ddl_Root.DataTextField  = "PName";
            this.ddl_Root.DataValueField = "PID";
            this.ddl_Root.DataBind();
            this.ddl_Root.Items.Insert(0, new ListItem("根目录", "0"));
        }
Exemplo n.º 6
0
        private void LoadMenus()
        {
            MR_Admin adminobj = AdminPageStatic.GetLoginUserInfo();
            int      adminid  = adminobj.AID;
            int      groupid  = adminobj.GID;

            IList <MR_PageInfo> info = new List <MR_PageInfo>();

            if (groupid > 0)
            {
                info = SiteRuleCheck.GetAdminPages(adminid, groupid, 0, false);
            }
            else if (groupid == -1)
            {
                IRoleManage irm = GetInterface.GetIRoleManage();
                info = irm.GetListToList(0, false);
            }
            else
            {
                Session["ErrInfo"] = "找不到用户组!";
                AdminPageStatic.RedirectToLoginPage(false);
                return;
            }
            StringBuilder sb = new StringBuilder();

            sb.Append(" [");
            string span = "";

            if (info.Count > 0)
            {
                OnLoadId = info[0].PID;
            }
            foreach (MR_PageInfo tmp in info)
            {
                sb.Append(span);
                sb.Append("{");
                sb.AppendFormat(" 'Text': '{0}', 'Id': '{1}', 'URL': '{2}'", tmp.PName, tmp.PID, tmp.PUrl);
                sb.Append("}");
                span = ",";
            }
            sb.Append(" ]");
            this.Menus = sb.ToString();
        }
Exemplo n.º 7
0
        /// <summary>
        /// 添加菜单项到当前选中的对象中
        /// </summary>
        /// <param name="pid"></param>
        /// <param name="defautExp"></param>
        private void AddPageRight(int pid, string defautExp)
        {
            int    rootid   = this.ddl_Root.SelectedValue.GetInt(0);
            string idlist   = this.ddl_For.SelectedValue;
            bool   isidlist = !idlist.IsNumber(false);

            IRightsSetting irs = GetInterface.GetIRightsSetting(this.NowSettingType);
            IRoleManage    irm = GetInterface.GetIRoleManage();

            //如果权限没有设置,手动设为000000
            if (string.IsNullOrEmpty(defautExp))
            {
                defautExp = "0000000";
            }

            //将这个权限赋给对象
            irs.AddRole(pid, idlist.ToIntList(','), defautExp, false);

            if (isidlist)  //如果对象是一组ID列表,需要将当前的表单缓存起来
            {
                if (this.NowAddToIdList.Count(t => t.PID == pid) == 0)
                {
                    MR_PageInfo info = irm.GetNode(pid);
                    info.BtnRightExp = defautExp;
                    this.NowAddToIdList.Add(info);
                }
                else
                {
                    MR_PageInfo info = this.NowAddToIdList.First(t => t.PID == pid);
                    info.BtnRightExp = defautExp;
                }
            }

            BindChildRight();

            SiteRuleCheck.FlushPageAndRightCache();
        }
Exemplo n.º 8
0
 public HomeController(IUserManage userManage, IRoleManage roleManage)
 {
     _userManage = userManage;
     _roleManage = roleManage;
 }
Exemplo n.º 9
0
 public HomeController(IUserManage userManage, IRoleManage roleManage)
 {
     _userManage = userManage;
     _roleManage = roleManage;
 }
Exemplo n.º 10
0
 /// <summary>
 ///  重写控制器
 /// </summary>
 /// <param name="roleManage"></param>
 public RoleController(IRoleManage roleManage)
 {
     _roleManage = roleManage;
 }
Exemplo n.º 11
0
 public RoleService(IRoleManage manage, IExamDbContext cxt)
 {
     this.roleManage = manage ?? throw new ArgumentNullException(nameof(roleManage));
     this.context    = cxt ?? throw new ArgumentNullException(nameof(context));
 }
Exemplo n.º 12
0
 public RoleService(IRoleManage imge)
 {
     this.iManage = imge;
 }