|
using System;
using System.Linq;
using System.Security.Principal;
namespace CompanyFeeds.Tests.Fakes
{
public class FakePrincipal : IPrincipal
{
private readonly IIdentity _identity;
private readonly string[] _roles;
public FakePrincipal(IIdentity identity, string[] roles)
{
_identity = identity;
_roles = roles;
}
public IIdentity Identity
{
get { return _identity; }
}
public bool IsInRole(string role)
{
if (_roles == null)
return false;
return _roles.Contains(role);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.