Beispiel #1
0
        /// <summary>
        /// 判断是否有权限
        /// </summary>
        /// <param name="context"></param>
        public void CheckIsPrivilege(System.Web.HttpContext context)
        {
            context.Response.ContentType = "application/json";

            string rightname = context.Request["rightname"];

            object obj = (Privilege)Enum.Parse(typeof(Privilege), rightname);

            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("{");

            bool flag = ManagerHelper.CheckIsPrivilege((Privilege)obj);

            if (flag)
            {
                stringBuilder.Append("\"Status\":\"OK\"");
                stringBuilder.Append("}");
            }
            else
            {
                stringBuilder.Append("\"Status\":\"NO\""); //没有权限
                stringBuilder.Append("}");
            }

            context.Response.Write(stringBuilder.ToString());
        }