, , , , , . , IAuthorizeable IEnumerable. .
, , , , , . , , , .
. User , , , , , , .
:
class User
{
private IAuthenticator authenticator;
public string Name { get; set; }
public Guid Id { get; set; }
public User(string name, Guid id, IAuthenticator authenticator)
{
Name = name;
Id = id;
this.authenticator = authenticator;
}
public Rights Authenticate()
{
return authenticator.Authenticate(Name, Id);
}
}
, :
public class WebAuthenticator : IAuthenticator
{
public Rights Authenticate(string name, Guid id)
{
}
}
:
[Flags]
public enum Rights
{
None = 0, Read = 1, Write = 1 << 1, Execute = 1 << 2
}
, , . , , , , , .