Skip to main content
ilssac
Inspiring
March 4, 2010
Question

Setting windows directory security with ColdFusion

  • March 4, 2010
  • 1 reply
  • 413 views

If one was to build an application that could be creating directories on a windows system.  Is there any way to set specific permissions on that newly created directory.  I understand that the <cfdirectory...> tag has the ability to set the UNIX permissions.  But, of course, windows is not so simple.
If this is at all possible, would it matter if the directories being created where on a file server and not directly on the web server.

TIA
Ian

    This topic has been closed for replies.

    1 reply

    Owainnorth
    Inspiring
    March 4, 2010

    Never tried it, but don't see why it wouldn't work - how about using .NET objects through Coldfusion? I had to create a VB.net program recently which sets NTFS permissions, and the code was thus:

         Dim dirInfo As New DirectoryInfo(homePath)
         Dim dirSecurity As DirectorySecurity = dirInfo.GetAccessControl()

         Dim accessRule As New FileSystemAccessRule(ntUsername, FileSystemRights.FullControl, _

               InheritanceFlags.ContainerInherit + InheritanceFlags.ObjectInherit,

                          PropagationFlags.None, AccessControlType.Allow)
         dirSecurity.AddAccessRule(accessRule)
         dirInfo.SetAccessControl(dirSecurity)

    Don't know if you could do that through CF? As long as the user context running CF has permissions, I'd forsee no issues doing it over a network.

    O.