ClaimView

in namespace DotVVM.Framework.Controls

Renders different content to the users who have a specified claim and to users who haven't.

Usage & Scenarios

Allows to display different content to users who have a specific claim.

Sample 1: ClaimView

The Claim property specifies the type of claim the user must have.

The Values property optionally contains a comma-separated list of accepted values. If it is missing, all values are accepted.

The HasClaimTemplate defines the content displayed to the users who have the Claim with at least one of accepted values.

The HasNotClaimTemplate defines the content displayed to other users.

By default, the control is hidden completely to the users who are not authenticated. If you want to display the HasNotClaimTemplate even to the anonymous users, set the HideForAnonymousUsers property to false.

<dot:ClaimView Claim="Permission" Values="CanAddUsers" HideForAnonymousUsers="false">
    <HasClaimTemplate>
        I can add new users.
    </HasClaimTemplate>
    <HasNotClaimTemplate>
        I can't add new users.
    </HasNotClaimTemplate>
</dot:ClaimView>

Properties

Name Type Description Notes Default Value
property icon Attributes Dictionary<String,Object>
attribute
inner element
static value
bindable
default
null
property icon Claim String Gets or sets the type of claim the user must have.
attribute
inner element
static value
bindable
default
null
property icon ClientIDMode ClientIDMode Gets or sets the client ID generation algorithm.
attribute
inner element
static value
bindable
default
Static
property icon DataContext Object Gets or sets a data context for the control and its children. All value and command bindings are evaluated in context of this value.
attribute
inner element
static value
bindable
default
null
property icon HasClaimTemplate ITemplate Gets or sets the content displayed to the users who have the Claim with one or more of accepted values.
attribute
inner element
static value
bindable
default
null
property icon HasNotClaimTemplate ITemplate Gets or sets the content displayed to the users who don't have the Claim with any of accepted values.
attribute
inner element
static value
bindable
default
null
property icon HideForAnonymousUsers Boolean Gets or sets whether the control will be hidden completely to anonymous users. If set to false, the HasNotClaimTemplate will be rendered to anonymous users.
attribute
inner element
static value
bindable
default
True
property icon ID String Gets or sets the unique control ID.
attribute
inner element
static value
bindable
default
null
property icon InnerText String Gets or sets the inner text of the HTML element.
attribute
inner element
static value
bindable
default
null
property icon RenderWrapperTag Boolean Gets or sets whether the control should render a wrapper element.
attribute
inner element
static value
bindable
default
False
property icon Values String[] Gets or sets a comma-separated list of accepted values. If specified; the user must have the Claim with one or more of the values. Otherwise; all values are accepted.
attribute
inner element
static value
bindable
default
null
property icon Visible Boolean Gets or sets whether the control is visible.
attribute
inner element
static value
bindable
default
True
property icon WrapperTagName String Gets or sets the name of the tag that wraps the Repeater.
attribute
inner element
static value
bindable
default
div

HTML produced by the control

The control renders the contents of the HasClaimTemplate or HasNotClaimTemplate property. Optionally you can enable wrapper tag rendering using the RenderWrapperTag property. The tag name can be changed using the WrapperTagName property.

<div>
    <!-- Contents of the HasClaimTemplate or HasNotClaimTemplate -->
</div>