2016-04-04 4 views
0

私はmvcsitemapproviderプロジェクトを使用して次のサイトマップXMLを持っています。MVCサイトマッププロバイダーのセキュリティを適切に調整する方法

<mvcSiteMapNode url="~/Form.aspx" title="Form Editor" roles="ItemBank User" />

は、代わりに、それだけで「フォーム」というタイトルunclickableリンクを示しています。子どもたちのすべては、ユーザーにアクセスできないとき

これは、次のノードを隠していません。

MVCSitemapProviderは、どの子もエンドユーザーに表示されていないときに、親のリンク先を隠すようにしますか?

<?xml version="1.0" encoding="utf-8" ?> 
 
<mvcSiteMap xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 
      xmlns="http://mvcsitemap.codeplex.com/schemas/MvcSiteMap-File-4.0" 
 
      xsi:schemaLocation="http://mvcsitemap.codeplex.com/schemas/MvcSiteMap-File-4.0 MvcSiteMapSchema.xsd"> 
 

 
    <mvcSiteMapNode url="~/Default.aspx" title="Web Site" roles="*" > 
 
    <mvcSiteMapNode title="Forms" clickable="false"> 
 
     <mvcSiteMapNode url="~/Form.aspx" title="Form Editor" roles="ItemBank User" /> 
 
     <mvcSiteMapNode url="~/FormHierarchy.aspx" title="Form Hiearchy" roles="ItemBank User" /> 
 
     <mvcSiteMapNode url="~/ContentCodeEditor.aspx" title="Content Code Editor" roles="ItemBank User"/> 
 
     <mvcSiteMapNode url="~/FormCopy.aspx" title="Form Copy" roles="ItemBank User"/> 
 
     <mvcSiteMapNode controller="Home" action="Index" area="Mvc" title="Mvc Area Non-Admin"/> 
 
     <mvcSiteMapNode controller="Home" action="Index2" area="Mvc" title="Mvc Area Admin"/> 
 
    </mvcSiteMapNode> 
 
    <mvcSiteMapNode title="Items" clickable="false" roles="ItemBank User"> 
 
     <mvcSiteMapNode url="~/Items.aspx" title="Item Editor" roles="ItemBank User" /> 
 
     <mvcSiteMapNode url="~/NewItem.aspx" title="New Item" roles="ItemBank User" /> 
 
     <mvcSiteMapNode url="~/ItemPairings.aspx" title="Item Pairings" roles="ItemBank User" /> 
 
     <mvcSiteMapNode url="~/ItemCopy.aspx" title="Item Copy" roles="ItemBank User" /> 
 
     <mvcSiteMapNode url="~/ContentReclassification.aspx" title="Content Reclassification" roles="ItemBank User"/> 
 
    </mvcSiteMapNode> 
 
    </mvcSiteMapNode> 
 
</mvcSiteMap>

答えて

0

この特定の目的のためにTrimEmptyGroupingNodesVisibilityProviderがあります。

<mvcSiteMapNode url="~/Form.aspx" title="Form Editor" roles="ItemBank User" 
    visibilityProvider="MvcSiteMapProvider.TrimEmptyGroupingNodesVisibilityProvider, MvcSiteMapProvider" /> 

参考:https://github.com/maartenba/MvcSiteMapProvider/issues/375

注:デフォルトの実装が動作するために、非クリッカブルするノードが必要です。ただし、このケースを処理するためのカスタム表示プロバイダを作成できます。

関連する問題