Cześć,
mam pytanie, odnośnie c#. Od niedawna zacząłem używać linq i zastanawiam się dlaczego poniższy kod zawsze mi zwraca fałsz w ifie, skoro istnieje taki katalog i użytkownik ma pełne prawa do katalogu
var rules = File.GetAccessControl(directory).GetAccessRules(true, true, typeof(SecurityIdentifier));
var groups = WindowsIdentity.GetCurrent().Groups;
string sidCurrentUser = WindowsIdentity.GetCurrent().User.Value;
if (
rules.OfType<FileSystemAccessRule>()
.Any(
r =>
r.IdentityReference.Value.Equals(sidCurrentUser)
&& r.AccessControlType == AccessControlType.Allow
&& (r.FileSystemRights & FileSystemRights.ReadData) == FileSystemRights.Read))
{
System.Windows.Forms.MessageBox.Show("Folder ma własność odczytu");
}
else
{
System.Windows.Forms.MessageBox.Show("asdasdasd");
}
Z góry dzięki za szybkie odpowiedzi :)