diff --git a/api/CESMII.ProfileDesigner.DAL/LookupDataTypeDAL.cs b/api/CESMII.ProfileDesigner.DAL/LookupDataTypeDAL.cs index f14ee2ea..9193b2bf 100644 --- a/api/CESMII.ProfileDesigner.DAL/LookupDataTypeDAL.cs +++ b/api/CESMII.ProfileDesigner.DAL/LookupDataTypeDAL.cs @@ -53,7 +53,7 @@ ProfileTypeDefinitionDAL _profileTypeDefinitionDAL } public override LookupDataType CheckForExisting(LookupDataTypeModel model, UserToken userToken, bool cacheOnly = false) { - var entityResult = base.FindByCondition(userToken, dt => + var matches = base.FindByCondition(userToken, dt => ( (model.ID != 0 && model.ID != null && dt.ID == model.ID) || ( dt.Name == model.Name && dt.Code == model.Code @@ -64,9 +64,17 @@ public override LookupDataType CheckForExisting(LookupDataTypeModel model, UserT && dt.CustomType.Profile.Version == model.CustomType.Profile.Version && dt.CustomType.OpcNodeId == model.CustomType.OpcNodeId )))) - , cacheOnly); - var entity = entityResult?.FirstOrDefault(); - return entity; + , cacheOnly).ToList(); + + //2024-08-12 + //Issue - FIX - must also consider owner id match unless match comes from a core nodeset (/ua or /ua/di). + // We were having scenario if user 1 imports a nodeset A and then user 2 imports the same nodeset A, some of the attribute + // custom type of user 1's nodeset are getting assigned to user B. + matches = matches.Where(x => + x.CustomType == null || + !x.CustomType.OwnerId.HasValue || + x.CustomType.OwnerId.Value == userToken.UserId).ToList(); + return matches == null || matches.Count == 0 ? null : matches[0]; } public override async Task UpdateAsync(LookupDataTypeModel model, UserToken userToken) diff --git a/frontend/src/components/OnLoginHandler.js b/frontend/src/components/OnLoginHandler.js index adf9faf1..90f6d203 100644 --- a/frontend/src/components/OnLoginHandler.js +++ b/frontend/src/components/OnLoginHandler.js @@ -117,6 +117,7 @@ export const onAADLogin = (setLoadingProps) => { //get current search criteria data setLoadingProps({ loginStatusCode: 200, + refreshLookupData: true, refreshSearchCriteria: true, refreshProfileSearchCriteria: true, refreshCloudLibImporterSearchCriteria: true,