Skip to content

Commit 40f4bf1

Browse files
authored
Merge pull request #120 from cesmii/FIX/InconsistentDatabaseUsageError
Fix/inconsistent database usage error
2 parents a5927cc + 3c954b3 commit 40f4bf1

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

api/CESMII.ProfileDesigner.DAL/LookupDataTypeDAL.cs

+12-4
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ ProfileTypeDefinitionDAL _profileTypeDefinitionDAL
5353
}
5454
public override LookupDataType CheckForExisting(LookupDataTypeModel model, UserToken userToken, bool cacheOnly = false)
5555
{
56-
var entityResult = base.FindByCondition(userToken, dt =>
56+
var matches = base.FindByCondition(userToken, dt =>
5757
(
5858
(model.ID != 0 && model.ID != null && dt.ID == model.ID)
5959
|| ( dt.Name == model.Name && dt.Code == model.Code
@@ -64,9 +64,17 @@ public override LookupDataType CheckForExisting(LookupDataTypeModel model, UserT
6464
&& dt.CustomType.Profile.Version == model.CustomType.Profile.Version
6565
&& dt.CustomType.OpcNodeId == model.CustomType.OpcNodeId
6666
))))
67-
, cacheOnly);
68-
var entity = entityResult?.FirstOrDefault();
69-
return entity;
67+
, cacheOnly).ToList();
68+
69+
//2024-08-12
70+
//Issue - FIX - must also consider owner id match unless match comes from a core nodeset (/ua or /ua/di).
71+
// We were having scenario if user 1 imports a nodeset A and then user 2 imports the same nodeset A, some of the attribute
72+
// custom type of user 1's nodeset are getting assigned to user B.
73+
matches = matches.Where(x =>
74+
x.CustomType == null ||
75+
!x.CustomType.OwnerId.HasValue ||
76+
x.CustomType.OwnerId.Value == userToken.UserId).ToList();
77+
return matches == null || matches.Count == 0 ? null : matches[0];
7078
}
7179

7280
public override async Task<int?> UpdateAsync(LookupDataTypeModel model, UserToken userToken)

frontend/src/components/OnLoginHandler.js

+1
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ export const onAADLogin = (setLoadingProps) => {
117117
//get current search criteria data
118118
setLoadingProps({
119119
loginStatusCode: 200,
120+
refreshLookupData: true,
120121
refreshSearchCriteria: true,
121122
refreshProfileSearchCriteria: true,
122123
refreshCloudLibImporterSearchCriteria: true,

0 commit comments

Comments
 (0)