1 Reply Latest reply: Mar 4, 2010 8:44 AM by Owain North RSS

    Setting windows directory security with ColdFusion

    ilssac Community Member

      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

        • 1. Re: Setting windows directory security with ColdFusion
          Owain North Community Member

          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.