当前位置: 首页>>代码示例>>C#>>正文


C# Security.CheckGroup方法代码示例

本文整理汇总了C#中Security.CheckGroup方法的典型用法代码示例。如果您正苦于以下问题:C# Security.CheckGroup方法的具体用法?C# Security.CheckGroup怎么用?C# Security.CheckGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Security的用法示例。


在下文中一共展示了Security.CheckGroup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            // Generic response package ///////////////////////////////////
            Dictionary<String, Object> responsePackage = new Dictionary<String, Object>();
            List<Dictionary<String, String>> responses = new List<Dictionary<String, String>>();
            Dictionary<String, String> response = new Dictionary<String, String>();
            Dictionary<String, String> status = new Dictionary<String, String>();
            ///////////////////////////////////////////////////////////////
            JavaScriptSerializer rs = new JavaScriptSerializer();

            try
            {
                /*
                Response.Write("Hello");
                return;
                Response.Write(System.Environment.GetEnvironmentVariable("PPL.Env"));
                return;
                */
                String credentialUID = Request.QueryString["u"];
                String credentialPSWD = Request.QueryString["p"];
                String credentialEPSWD = null;
                // Comment out the following line for production.
                credentialEPSWD = Request.QueryString["ep"];

                if (credentialPSWD != null)
                {
                    Security security = new Security();
                    Response.Write(security.encrypt(credentialUID, credentialPSWD));
                    return;
                }
                else if (credentialEPSWD != null)
                {
                    Security security = new Security();
                    Response.Write(security.decrypt(credentialUID, credentialEPSWD));
                    return;
                }

                Dictionary<String, Object> jsonRequest = new Dictionary<String, Object>();
                //JavaScriptSerializer rs = new JavaScriptSerializer();

                try
                {
                    String[] theFormRequest = Request.Form.GetValues(0);
                    jsonRequest = rs.Deserialize<Dictionary<String, Object>>(theFormRequest[0]);
                }
                catch (Exception tmpE)
                {
                    Stream instream = Page.Request.InputStream;
                    BinaryReader br = new BinaryReader(instream,
                    System.Text.Encoding.UTF8);
                    byte[] bytes = br.ReadBytes((int)instream.Length);

                    System.Text.Encoding enc = System.Text.Encoding.ASCII;
                    jsonRequest = rs.Deserialize<Dictionary<String, Object>>(enc.GetString(bytes));
                }

                String request = (String)jsonRequest["request"];
                String action = (String)jsonRequest["action"];
                //String connectionType = (String)jsonRequest["connectionType"];
                Dictionary<String, Object> requestData = (Dictionary<String, Object>)jsonRequest["requestData"];

                DataConnection theDB = new DataConnection();

                String userName = Request.ServerVariables["AUTH_USER"];

                //Security securityA = new Security();
                //Boolean ok = securityA.CheckGroup(new String[] {"PPL\\ISD-DL-GIS","aaa"});

                switch (action)
                {
                    case "getUserId":
                        response.Add("userid", userName.Substring(userName.LastIndexOf("\\") + 1));
                        //response.Add("userid", System.Web.HttpContext.Current.Request.LogonUserIdentity.Name);

                        status.Add("result", "true");
                        status.Add("message", "");
                        responsePackage.Add("data", response);
                        responsePackage.Add("status", status);

                        Response.Write(rs.Serialize(responsePackage));

                        //Response.Write(rs.Serialize(response));
                        return;
                        //break;
                    case "checkSecurity":
                        Security security = new Security();
                        if //(security.CheckGroup(((ArrayList)requestData["groups"])))
                            (security.CheckGroup((ArrayList)requestData["groups"]))
                        {
                            response.Add("success", "true");
                        }
                        else
                        {
                            response.Add("success", "false");
                        }

                        status.Add("result", "true");
                        status.Add("message", "");
                        responsePackage.Add("data", response);
                        responsePackage.Add("status", status);
//.........这里部分代码省略.........
开发者ID:RandomMinds,项目名称:WebAppToolkit,代码行数:101,代码来源:default.aspx.cs


注:本文中的Security.CheckGroup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。