Beispiel #1
0
        public virtual MenuItemState DetermineStateFor(MenuNode node)
        {
            if (node.BehaviorChain == null)
            {
                return(MenuItemState.Available);
            }

            var rights = _authorizor.Authorize(node.BehaviorChain, node.UrlInput);

            if (rights != AuthorizationRight.Allow)
            {
                return(node.UnauthorizedState);
            }

            if (_current.OriginatingChain == node.BehaviorChain)
            {
                return(MenuItemState.Active);
            }

            if (_conditionals.IsTrue(node.HideIfConditional))
            {
                return(MenuItemState.Hidden);
            }

            if (_conditionals.IsTrue(node.IsEnabledBy()))
            {
                return(MenuItemState.Available);
            }

            return(MenuItemState.Disabled);
        }
Beispiel #2
0
 protected override Endpoint createResult(object model, BehaviorChain chain)
 {
     return(new Endpoint()
     {
         IsAuthorized = _authorizor.Authorize(chain, model) == AuthorizationRight.Allow,
         Url = chain.Route.CreateUrlFromInput(model).ToAbsoluteUrl()
     });
 }
Beispiel #3
0
        protected override Endpoint createResult(object model, BehaviorChain chain)
        {
            var urlFromInput = chain.Route.CreateUrlFromInput(model);

            return(new Endpoint {
                IsAuthorized = _authorizor.Authorize(chain, model) == AuthorizationRight.Allow,
                Url = _httpRequest.ToFullUrl(urlFromInput)
            });
        }
Beispiel #4
0
        protected override Endpoint createResult(object model, BehaviorChain chain)
        {
            var url = _urlResolver.UrlFor(model, chain);

            return(new Endpoint {
                IsAuthorized = _authorizor.Authorize(chain, model) == AuthorizationRight.Allow,
                Url = url,
                Chain = chain
            });
        }
 protected override AuthorizationRight createResult(object model, BehaviorChain chain)
 {
     return(_authorizor.Authorize(chain, model));
 }