Skip to content

Commit

Permalink
🔧 (configuration.json): add TfsUserMappingTool configuration for user…
Browse files Browse the repository at this point in the history
… mapping

💡 (TfsUserMappingTool.cs): improve error handling for missing user mapping file

📝 (MigrationTools.xml): update documentation with new version details

The TfsUserMappingTool configuration is added to the configuration.json to enable user mapping functionality, specifying the file path and identity fields to check. This change allows for more flexible user identity management during migrations. In TfsUserMappingTool.cs, error handling is improved by logging an error message when the user mapping file is missing, ensuring users are informed of configuration issues. The MigrationTools.xml documentation is updated to reflect the new version, ensuring consistency and clarity in version tracking.
  • Loading branch information
MrHinsh committed Oct 3, 2024
1 parent 23fae28 commit 7165c5c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 15 deletions.
12 changes: 12 additions & 0 deletions configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,18 @@
"UpdateTeamSettings": true,
"MigrateTeamCapacities": true,
"Teams": [ "Team 1", "Team 2" ]
},
"TfsUserMappingTool": {
"Enabled": true,
"UserMappingFile": "C:\\temp\\userExport.json",
"IdentityFieldsToCheck": [
"System.AssignedTo",
"System.ChangedBy",
"System.CreatedBy",
"Microsoft.VSTS.Common.ActivatedBy",
"Microsoft.VSTS.Common.ResolvedBy",
"Microsoft.VSTS.Common.ClosedBy"
]
}
},
"Processors": [
Expand Down
14 changes: 7 additions & 7 deletions docs/Reference/Generated/MigrationTools.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,12 @@ public void MapUserIdentityField(TfsProcessor processor, Field field)

private Dictionary<string, string> GetMappingFileData()
{
if (_UserMappings == null && System.IO.File.Exists(Options.UserMappingFile))
if (!System.IO.File.Exists(Options.UserMappingFile))
{
Log.LogError("TfsUserMappingTool::GetMappingFileData:: The UserMappingFile '{UserMappingFile}' cant be found! Provide a valid file or disable TfsUserMappingTool!", Options.UserMappingFile);
_UserMappings = new Dictionary<string, string>();
}
if (_UserMappings == null)
{
var fileData = System.IO.File.ReadAllText(Options.UserMappingFile);
try
Expand All @@ -101,14 +106,7 @@ private Dictionary<string, string> GetMappingFileData()
}

}
else
{
Log.LogError($"TfsUserMappingTool::GetMappingFileData::No User Mapping file Provided! Provide file or disable TfsUserMappingTool");
_UserMappings = new Dictionary<string, string>();
}

return _UserMappings;

}

private List<IdentityItemData> GetUsersListFromServer(IGroupSecurityService gss)
Expand Down

0 comments on commit 7165c5c

Please sign in to comment.