feat: replace_with_assignments import type
This commit is contained in:
@@ -43,6 +43,10 @@ function Invoke-InitializeModule
|
|||||||
Name = "Replace (Preview)"
|
Name = "Replace (Preview)"
|
||||||
Value = "replace"
|
Value = "replace"
|
||||||
},
|
},
|
||||||
|
[PSCustomObject]@{
|
||||||
|
Name = "Replace with assignments (Preview)"
|
||||||
|
Value = "replace_with_assignments"
|
||||||
|
},
|
||||||
[PSCustomObject]@{
|
[PSCustomObject]@{
|
||||||
Name = "Update (Preview)"
|
Name = "Update (Preview)"
|
||||||
Value = "update"
|
Value = "update"
|
||||||
@@ -2353,7 +2357,10 @@ function Reset-GraphObject
|
|||||||
# Clone the object before removing properties
|
# Clone the object before removing properties
|
||||||
$obj = $fileObj.Object | ConvertTo-Json -Depth 50 | ConvertFrom-Json
|
$obj = $fileObj.Object | ConvertTo-Json -Depth 50 | ConvertFrom-Json
|
||||||
Start-GraphPreImport $obj $objectType
|
Start-GraphPreImport $obj $objectType
|
||||||
Remove-Property $obj "Assignments"
|
if ($global:cbImportType.SelectedValue -eq "replace"){
|
||||||
|
# will use the assignments from the file for "replace_with_assignments" type
|
||||||
|
Remove-Property $obj "Assignments"
|
||||||
|
}
|
||||||
Remove-Property $obj "isAssigned"
|
Remove-Property $obj "isAssigned"
|
||||||
|
|
||||||
if($global:cbImportType.SelectedValue -eq "update")
|
if($global:cbImportType.SelectedValue -eq "update")
|
||||||
@@ -2417,7 +2424,7 @@ function Reset-GraphObject
|
|||||||
}
|
}
|
||||||
return $true
|
return $true
|
||||||
}
|
}
|
||||||
elseif($global:cbImportType.SelectedValue -eq "replace")
|
elseif($global:cbImportType.SelectedValue -in @("replace","replace_with_assignments"))
|
||||||
{
|
{
|
||||||
$replace = $true
|
$replace = $true
|
||||||
$import = $true
|
$import = $true
|
||||||
@@ -2466,8 +2473,13 @@ function Reset-GraphObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($global:cbImportType.SelectedValue -eq "replace")
|
||||||
Import-GraphObjectAssignment $newObj $objectType $curObject.Object.Assignments $fileObj.FileInfo.FullName -CopyAssignments | Out-Null
|
{
|
||||||
|
Import-GraphObjectAssignment $newObj $objectType $curObject.Object.Assignments $fileObj.FileInfo.FullName -CopyAssignments | Out-Null
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Import-GraphObjectAssignment $newObj $objectType $obj.Assignments $file.FileInfo.FullName | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
if($delete)
|
if($delete)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user