コード例 #1
0
ファイル: MenuStateService.cs プロジェクト: zzekikaya/fubumvc
        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);
        }
コード例 #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()
     });
 }
コード例 #3
0
ファイル: EndpointService.cs プロジェクト: rmueller/fubumvc
        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)
            });
        }
コード例 #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
            });
        }
コード例 #5
0
 protected override AuthorizationRight createResult(object model, BehaviorChain chain)
 {
     return(_authorizor.Authorize(chain, model));
 }