Ejemplo n.º 1
0
 public void ProcessRequest(HttpContext context)
 {
     try
     {
         context.Response.ContentType = "text/plain";
         int             roleid    = int.Parse(context.Request.Form["roleid"]);
         string          authorize = context.Request.Form["authorize"];
         Entity.Sys_Role role      = new DataAccess.Sys_Role().GetModel(roleid);
         role.MenuAuthorize = authorize;
         if (new DataAccess.Sys_Role().Update(role))
         {
             context.Response.Write("");
         }
         else
         {
             context.Response.Write("修改失败!入库出错,请联系管理员!");
         }
     }
     catch (Exception ex)
     {
         context.Response.Write("修改失败!请联系管理员!" + ex.ToString());
     }
 }
Ejemplo n.º 2
0
        public string AuthorizeJudge(string setting, string functionId)
        {
            bool IsAuthorize = false;

            string[] roles = PageBase.CommonObject.ManagerUserInfo.role.Split('#');
            if (setting == "False")
            {
                if (PageBase.CommonObject.ManagerUserInfo.isSuperUser)
                {
                    IsAuthorize = true;
                }
                else
                {
                    foreach (string roleid in roles)
                    {
                        if (!string.IsNullOrEmpty(roleid))
                        {
                            Entity.Sys_Role role = new DataAccess.Sys_Role().GetModel(int.Parse(roleid));
                            if (role.FunctionAuthorize.IndexOf(functionId) >= 0)
                            {
                                IsAuthorize = true;
                                break;
                            }
                        }
                    }
                }
            }
            if (IsAuthorize)
            {
                return(string.Empty);
            }
            else
            {
                return("disabled = 'disabled'");
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            bool   IsAuthorize = false;
            string param       = context.Request.Form["param"];

            string[]        roles = PageBase.CommonObject.ManagerUserInfo.role.Split('#');
            Entity.Sys_Menu menu  = new DataAccess.Sys_Menu().DataRowToModel(new DataAccess.Sys_Menu().GetList(string.Format("MenuCode='{0}'", param)).Tables[0].Rows[0]);
            if (PageBase.CommonObject.ManagerUserInfo.isSuperUser)
            {
                IsAuthorize = true;
            }
            else
            {
                foreach (string roleid in roles)
                {
                    if (!string.IsNullOrEmpty(roleid))
                    {
                        Entity.Sys_Role role = new DataAccess.Sys_Role().GetModel(int.Parse(roleid));
                        if (role.MenuAuthorize.IndexOf(menu.ID.ToString()) >= 0)
                        {
                            IsAuthorize = true;
                            break;
                        }
                    }
                }
            }
            if (IsAuthorize)
            {
                context.Response.Write(menu.MenuUrl);
            }
            else
            {
                context.Response.Write("../PowerError.aspx");
            }
        }