public override void OnAuthorization(AuthorizationContext filterContext) { /*In case a simpleuser is logged in, tried to reach the List Users site, * and then after a log out, a superadmin reached the listUser site, he got an invalid errormessage * because the filtercontext.Controller.TempData still contained value.*/ filterContext.Controller.TempData.Remove(_redirectToAction.ToString()); bool authorized = AuthorizeCore(filterContext.HttpContext); if (!authorized) { HandleUnauthorizedRequest(filterContext); } }
protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext) { var redirect = _redirectToResult.ToString(); var controller = _redirectToController.ToString(); filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary { { "action", redirect }, { "controller", controller } }); }
public void Show(string newText = "", ActionNames actionName = ActionNames.Default) { Initialize(); if (newText != "") { interractText.text = newText; } else { interractText.text = originalInterractText; } Hide(); interractText.gameObject.SetActive(true); SpriteRenderer xboxIcon = allIcons.Find(icon => icon.name == ("Xbox" + actionName.ToString())); SpriteRenderer keyboardIcon = allIcons.Find(icon => icon.name == ("Keyboard" + actionName.ToString())); if (ControllerHelper.IsXboxControllerPluggedIn()) { xboxIcon.enabled = true; keyboardIcon.enabled = false; HideAnimationOfIcon(keyboardIcon); ShowAnimationOfIcon(xboxIcon); } else { keyboardIcon.enabled = true; xboxIcon.enabled = false; HideAnimationOfIcon(xboxIcon); ShowAnimationOfIcon(keyboardIcon); } }
public IAction this[ActionNames name] { get { return(this[name.ToString()]); } }
public BaseStackedWindowControlAction(ActionNames actionName) { this.actionName = actionName.ToString(); }