How can I get access permissions for a file for the current user (user that runs the application) ?
public static DirectoryInfo di = new DirectoryInfo(rootPath);
var dirSecurity = di.GetAccessControl();
var accRules = dirSecurity.GetAccessRules(true, true, typeof(System.Security.Principal.NTAccount));
accRules
contains array of FileSystemAccessRule
. I guess these are the permissions for different roles.
How can I know which of them applies for the user that currently runs the application ?