public virtual bool HasAdminAccess(AuthorizationContext filterContext)
        {
            // filterContext.HttpContext
            IWorkContext       wc = new WebWorkContext(filterContext.HttpContext, new CustomerService());
            IPermissionService permissionService = new PermissionService(wc);
            bool result = permissionService.Authorize(StandardPermissionProvider.AccessAdminPanel);

            return(result);
        }
 /// <summary>
 /// 将工作上下文转换为Web工作上下文。
 /// </summary>
 /// <param name="workContext">工作上下文。</param>
 /// <returns>Web工作上下文。</returns>
 public static WebWorkContext AsWebWorkContext(this WorkContext workContext)
 {
     var work = workContext.GetState<WebWorkContext>("WebWorkContext");
     if (work != null)
         return work;
     work = new WebWorkContext(workContext);
     workContext.SetState("WebWorkContext", work);
     return work;
 }
예제 #3
0
        public sealed override void InitHelpers()
        {
            base.InitHelpers();
            var baseController = ((this.ViewContext.Controller) as InfrastructureController);

            if (baseController != null)
            {
                WorkContext = baseController.WorkContext;
            }
        }
예제 #4
0
        public ActionResult LoginOut()
        {
            WebWorkContext.LoginOut();
            //if (ConfigurationSettings.AppSettings["IsUseSSO"] != null &&
            //    ConfigurationSettings.AppSettings["IsUseSSO"].ToLower() == "true")
            //{
            SsoModel ssoModel = new SsoModel();

            ssoModel.Appkey     = ConfigurationManager.AppSettings["SsoAppId"];
            ssoModel.Appsecret  = ConfigurationManager.AppSettings["SsoAppSecret"];
            ssoModel.SsoBaseUrl = ConfigurationManager.AppSettings["SsoHost"];
            ssoModel.LoginOut(Request.Url.AbsoluteUri.ToLower().Replace("loginout", "Login"));
            //}
            //else
            //{
            //    return RedirectToAction("Index");
            //}
            return(RedirectToAction("Login"));
        }
예제 #5
0
 public ActionResult LoginOut()
 {
     WebWorkContext.CustomerLoginOut();
     return(RedirectToAction("Index"));
 }