For example I have 3 roles: admin, developer, project manager. If i want to disable controls for all users except for admin, i'll write:
<i:Interaction.Behaviors>
<catel:Authentication AuthenticationTag="admin" Action="Collapse" />
</i:Interaction.Behaviors>
It works good
But if i want enable control for admin and project manager (2 or more roles) and disabled for other users, i'll write this:
<i:Interaction.Behaviors>
<catel:Authentication AuthenticationTag="admin" Action="Collapse" />
<catel:Authentication AuthenticationTag="project manager" Action="Collapse" />
</i:Interaction.Behaviors>
It doesn't work Help me please
Here is AuthenticationProvider.cs
public class AuthenticationProvider : IAuthenticationProvider
{
/// <summary>
/// Gets or sets the role the user is currently in.
/// </summary>
/// <value>The role.</value>
public string Role { get; set; }
public bool CanCommandBeExecuted(ICatelCommand command, object commandParameter)
{
return true;
}
public bool HasAccessToUIElement(FrameworkElement element, object tag, object authenticationTag)
{
var authenticationTagAsString = authenticationTag as string;
if (authenticationTagAsString != null)
{
if (string.Compare(authenticationTagAsString, Role, true) == 0)
{
return true;
}
}
return false;
}
}