Skip to content
This repository has been archived by the owner on Mar 11, 2020. It is now read-only.

Commit

Permalink
Merge pull request #49 from sixeyed/master
Browse files Browse the repository at this point in the history
Change ownership to app pool user for copied files
  • Loading branch information
sixeyed authored May 3, 2017
2 parents 1e19ec1 + e06b295 commit d6bd5e5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion Functions/Private/Artifacts/IIS/Generate_IIS.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function IncludePath([string[]] $pathParts) {

function ProcessDirectory([System.Text.StringBuilder] $DirectoryBuilder,
[System.Text.StringBuilder] $CopyBuilder,
[System.Text.StringBuilder] $AclBuilder,
[string] $SourcePath,
[bool] $FirstDirectory) {
Write-Verbose "Processing source directory: $SourcePath"
Expand All @@ -56,6 +57,12 @@ function ProcessDirectory([System.Text.StringBuilder] $DirectoryBuilder,
$copy = 'COPY ["{0}", "{1}"]' -f (Split-Path $SourcePath -Leaf),($targetPath -Replace "\\","/")
$null = $CopyBuilder.AppendLine($copy)

$null = $AclBuilder.AppendLine('RUN $path=' + "'C:$targetPath'; ``")
$null = $AclBuilder.AppendLine(' $acl = Get-Acl $path; `')
$null = $AclBuilder.AppendLine(' $newOwner = [System.Security.Principal.NTAccount](''BUILTIN\IIS_IUSRS''); `')
$null = $AclBuilder.AppendLine(' $acl.SetOwner($newOwner); `')
$null = $AclBuilder.AppendLine(' dir -r $path | Set-Acl -aclobject $acl')

$fullSourcePath = $SourcePath
if ($global:SourceType -eq [SourceType]::Image -or
$global:SourceType -eq [SourceType]::Remote) {
Expand Down Expand Up @@ -127,7 +134,8 @@ if ($Artifact.Status -eq 'Present') {
# process the main site path
$DirectoryBuilder = New-Object System.Text.StringBuilder
$CopyBuilder = New-Object System.Text.StringBuilder
ProcessDirectory -DirectoryBuilder $DirectoryBuilder -CopyBuilder $CopyBuilder -SourcePath $mainVirtualDir.PhysicalPath -FirstDirectory $true
$AclBuilder = New-Object System.Text.StringBuilder
ProcessDirectory -DirectoryBuilder $DirectoryBuilder -CopyBuilder $CopyBuilder -AclBuilder $AclBuilder -SourcePath $mainVirtualDir.PhysicalPath -FirstDirectory $true

# creating the website creates the default app & vdir underneath it
$sourcePath = $mainVirtualDir.PhysicalPath
Expand Down Expand Up @@ -200,6 +208,9 @@ if ($Artifact.Status -eq 'Present') {

$null = $ResultBuilder.AppendLine($CopyBuilder.ToString().Trim().TrimEnd('``'))
$null = $ResultBuilder.AppendLine('')

$null = $ResultBuilder.AppendLine($AclBuilder.ToString().Trim().TrimEnd('``'))
$null = $ResultBuilder.AppendLine('')
}
}

Expand Down
2 changes: 1 addition & 1 deletion Image2Docker.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'Image2Docker.psm1'

# Version number of this module.
ModuleVersion = '1.8.1'
ModuleVersion = '1.8.2'

# Supported PSEditions
### NOTE: This module will not work with PowerShell Core.
Expand Down

0 comments on commit d6bd5e5

Please sign in to comment.