Exemple #1
0
        /// <summary>
        /// 检查组件页面是否需要高级授权
        /// </summary>
        /// <param name="context"></param>
        /// <param name="nScope"></param>
        /// <param name="redirectUrl"></param>
        /// <returns></returns>
        private string CheckCompentPage(HttpContext context, string nScope, string redirectUrl)
        {
            if (nScope == "snsapi_userinfo")
            {
                return(nScope);
            }
            string compentPage1 = "/customize/comeoncloud/index.aspx";
            string compentPage2 = "/customize/comeoncloud/m/index.aspx";
            string ngPage       = redirectUrl.ToLower();

            if (!ngPage.Contains(compentPage1) && !ngPage.Contains(compentPage2))
            {
                return(nScope);
            }

            var cgid = context.Request["cgid"];
            var key  = context.Request["key"];

            if (string.IsNullOrWhiteSpace(key) && string.IsNullOrWhiteSpace(cgid))
            {
                return(nScope);
            }
            //替换配置
            ZentCloud.BLLJIMP.BLLComponent    bll   = new ZentCloud.BLLJIMP.BLLComponent();
            ZentCloud.BLLJIMP.Model.Component model = new ZentCloud.BLLJIMP.Model.Component();
            if (!string.IsNullOrWhiteSpace(key))
            {
                model = bll.GetComponentByKey(key, bll.WebsiteOwner);
            }
            else
            {
                model = bll.Get <ZentCloud.BLLJIMP.Model.Component>(string.Format(" WebsiteOwner='{0}' AND AutoId={1}", bll.WebsiteOwner, cgid));
            }
            if (model.IsWXSeniorOAuth == 1)
            {
                return("snsapi_userinfo");
            }

            return(nScope);
        }