Exemplo n.º 1
0
 public override void OnAuthorization(AuthorizationContext context)
 {
     Ciira.Models.User cu = new Ciira.Business.GateBusiness().CurrentUser();
     if (cu != null && cu.Code != null && cu.Code.Trim().Length > 0)
     {
         if (!AllowedUserKinds.Contains((Ciira.Models.UserKind)cu.Kind))
         {
             throw new HttpException(403, "AccessDenied");
         }
     }
     else
     {
         context.RequestContext.HttpContext.Response.StatusCode = 401;
     }
 }
Exemplo n.º 2
0
 public override void OnAuthorization(AuthorizationContext context)
 {
     Ciira.Models.User cu = new Ciira.Business.GateBusiness().CurrentUser();
     if (cu != null && cu.Code != null && cu.Code.Trim().Length > 0)
     {
         if (!AllowedUserKinds.Contains((Ciira.Models.UserKind)cu.Kind))
         {
             throw new HttpException(403, "AccessDenied");
         }
     }
     else
     {
         context.RequestContext.HttpContext.Response.StatusCode = 401;
     }
 }
Exemplo n.º 3
0
        public ActionResult Login(Ciira.Models.LoginModel model)
        {
            string message = "";

            message = new Ciira.Business.GateBusiness().Login(model);

            if (message.Length == 0)
            {
                if (model.ReturnUrl != null && model.ReturnUrl.Trim().Length > 0)
                {
                    return(Redirect(model.ReturnUrl));
                }
                else
                {
                    return(RedirectToAction("Index", "Gate"));
                }
            }

            ViewBag.Message = message;

            return(View(model));
        }