1
0
mirror of https://github.com/bitwarden/directory-connector synced 2026-01-04 17:43:31 +00:00

users rule for UAC

This commit is contained in:
Kyle Spearrin
2017-08-28 16:15:54 -04:00
parent 259c1bbce6
commit 41d0b53898

View File

@@ -40,12 +40,12 @@ namespace Service
private void AfterInstalled(object sender, InstallEventArgs e)
{
if(!Directory.Exists(Constants.BaseStoragePath))
var info = new DirectoryInfo(Constants.BaseStoragePath);
if(!info.Exists)
{
Directory.CreateDirectory(Constants.BaseStoragePath);
info.Create();
}
var info = new DirectoryInfo(Constants.BaseStoragePath);
var sec = info.GetAccessControl();
var adminRule = new FileSystemAccessRule(
@@ -56,13 +56,13 @@ namespace Service
AccessControlType.Allow);
sec.AddAccessRule(adminRule);
var userRule = new FileSystemAccessRule(
WindowsIdentity.GetCurrent().Name,
var usersRule = new FileSystemAccessRule(
new SecurityIdentifier(WellKnownSidType.BuiltinUsersSid, null),
FileSystemRights.FullControl | FileSystemRights.Write | FileSystemRights.Read,
InheritanceFlags.None,
PropagationFlags.NoPropagateInherit,
AccessControlType.Allow);
sec.AddAccessRule(userRule);
sec.AddAccessRule(usersRule);
sec.SetAccessRuleProtection(isProtected: true, preserveInheritance: false);
info.SetAccessControl(sec);