Created
May 11, 2012 17:15
-
-
Save gprasant/2661085 to your computer and use it in GitHub Desktop.
A user class implementing IPrincipal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class User : IPrincipal | |
{ | |
public string Name { get; set; } | |
public string EMail { get; set; } | |
public string Phone1 { get; set; } | |
public string Phone2 { get; set; } | |
public virtual IEnumerable<Permission> Permissions { get; set; } | |
public User() | |
{ | |
Permissions = new List<Permission>(); | |
} | |
public IIdentity Identity{get; set; } | |
public bool IsInRole(string role) | |
{ | |
if (this.Permissions.Select(p => p.Name.ToLower()).Contains(role.ToLower())) | |
return true; | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment