Skip to content

Commit 6294190

Browse files
authored
User mapping logic error (#2417)
🔧 (configuration.json): add TfsUserMappingTool configuration for user 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.
2 parents 23fae28 + 7165c5c commit 6294190

File tree

3 files changed

+25
-15
lines changed

3 files changed

+25
-15
lines changed

configuration.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,18 @@
132132
"UpdateTeamSettings": true,
133133
"MigrateTeamCapacities": true,
134134
"Teams": [ "Team 1", "Team 2" ]
135+
},
136+
"TfsUserMappingTool": {
137+
"Enabled": true,
138+
"UserMappingFile": "C:\\temp\\userExport.json",
139+
"IdentityFieldsToCheck": [
140+
"System.AssignedTo",
141+
"System.ChangedBy",
142+
"System.CreatedBy",
143+
"Microsoft.VSTS.Common.ActivatedBy",
144+
"Microsoft.VSTS.Common.ResolvedBy",
145+
"Microsoft.VSTS.Common.ClosedBy"
146+
]
135147
}
136148
},
137149
"Processors": [

docs/Reference/Generated/MigrationTools.xml

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/MigrationTools.Clients.TfsObjectModel/Tools/TfsUserMappingTool.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,12 @@ public void MapUserIdentityField(TfsProcessor processor, Field field)
8686

8787
private Dictionary<string, string> GetMappingFileData()
8888
{
89-
if (_UserMappings == null && System.IO.File.Exists(Options.UserMappingFile))
89+
if (!System.IO.File.Exists(Options.UserMappingFile))
90+
{
91+
Log.LogError("TfsUserMappingTool::GetMappingFileData:: The UserMappingFile '{UserMappingFile}' cant be found! Provide a valid file or disable TfsUserMappingTool!", Options.UserMappingFile);
92+
_UserMappings = new Dictionary<string, string>();
93+
}
94+
if (_UserMappings == null)
9095
{
9196
var fileData = System.IO.File.ReadAllText(Options.UserMappingFile);
9297
try
@@ -101,14 +106,7 @@ private Dictionary<string, string> GetMappingFileData()
101106
}
102107

103108
}
104-
else
105-
{
106-
Log.LogError($"TfsUserMappingTool::GetMappingFileData::No User Mapping file Provided! Provide file or disable TfsUserMappingTool");
107-
_UserMappings = new Dictionary<string, string>();
108-
}
109-
110109
return _UserMappings;
111-
112110
}
113111

114112
private List<IdentityItemData> GetUsersListFromServer(IGroupSecurityService gss)

0 commit comments

Comments
 (0)