C# Windows Forms (chociaż nie koniecznie)
Wtyczki oparte o MEF.
Stoję przed wyborem sposobu obsługi ACL
mam dwie możliwości do wyboru
Pierwsze oparte na zabezpieczeniach Windows
class UserIdentity : IIdentity
{
public string AuthenticationType { get; }
public bool IsAuthenticated { get; }
private static string AuthenticationTypeString = "Database";
private Hashtable UserInfo;
private UserIdentity(Hashtable UserInfo)
public static UserIdentity CreateUserIdentity(Hashtable UserInfo)
...
public class SecurityPrincipal : IPrincipal
{
private SecurityPrincipal(Hashtable SecurityGroups,
Hashtable SecurityRights,
Hashtable UserInfo)
public static SecurityPrincipal
CreateSecurityPrincipal(Hashtable SecurityGroups,
Hashtable SecurityRights,
Hashtable UserInfo)
public IIdentity Identity
public bool IsInRole(string Role)
public bool HasPermission(string Permission)
public static IPrincipal SetSecurityPrincipal(Hashtable SecurityGroups,
Hashtable SecurityRights,
Hashtable UserInfo)
i W kodzie
AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
Hashtable SecurityGroups = new Hashtable();
Hashtable SecurityRights = new Hashtable();
Hashtable UserInfo = new Hashtable();
SecurityGroups[0] = "Ksiegowi";
SecurityRights[0] = "karol";
SecurityPrincipal Princi = SecurityPrincipal.CreateSecurityPrincipal(SecurityGroups, SecurityRights, UserInfo);
//Princi.Identity.
Thread.CurrentPrincipal=Princi;
bool walid = CheckSecurityPermission("karol");
Drugie rozwiązanie
https://www.codeproject.com/Articles/1056853/Lightning-Fast-Access-Control-Lists-in-Csharp
A jak wy to robicie ewentualnie wasze podejście do tematu?