Example #1
0
        public void add_permissions_to(string path)
        {
            SecurityIdentifier user          = WindowsIdentity.GetCurrent().User;
            Path filePath                    = _path.CombineWithWindowsPath(path);
            FileSystemSecurity accessControl = filePath.AccessControl();

            accessControl.AddAccessRule(
                new FileSystemAccessRule(
                    user, FileSystemRights.Read, InheritanceFlags.None,
                    PropagationFlags.None, AccessControlType.Allow)
                );
            filePath.AccessControl(accessControl);
        }