Skip to content

Instantly share code, notes, and snippets.

@kradcliffe kradcliffe/iis.rb
Created Jul 7, 2010

Embed
What would you like to do?
def add_acl app_path, desiredFilesystemRights, groupOrAccountName
di = DirectoryInfo.new app_path
ds = di.GetAccessControl
simple_rule = FileSystemAccessRule.new(
groupOrAccountName,
desiredFilesystemRights,
AccessControlType.Allow
)
full_rule = FileSystemAccessRule.new(
groupOrAccountName,
desiredFilesystemRights,
InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit,
PropagationFlags.InheritOnly,
AccessControlType.Allow
)
#Both rules need to run to give rights
ds.AddAccessRule(simple_rule)
ds.AddAccessRule(full_rule)
Directory.SetAccessControl app_path, ds
puts "Gives #{groupOrAccountName} #{desiredFilesystemRights} to #{app_path}"
end
@kradcliffe

This comment has been minimized.

Copy link
Owner Author

kradcliffe commented Jul 7, 2010

As discussed on the mailing list: http://www.ruby-forum.com/topic/212515

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.