@@ -53,28 +53,25 @@ ProfileTypeDefinitionDAL _profileTypeDefinitionDAL
5353 }
5454 public override LookupDataType CheckForExisting ( LookupDataTypeModel model , UserToken userToken , bool cacheOnly = false )
5555 {
56+ //2024-08-12
57+ //Issue - FIX - must also consider owner id match unless match comes from a core nodeset (/ua or /ua/di).
58+ // We were having scenario if user 1 imports a nodeset A and then user 2 imports the same nodeset A, some of the attribute
59+ // custom type of user 1's nodeset are getting assigned to user B.
5660 var matches = base . FindByCondition ( userToken , dt =>
57- (
58- ( model . ID != 0 && model . ID != null && dt . ID == model . ID )
61+ ( ( model . ID != 0 && model . ID != null && dt . ID == model . ID )
5962 || ( dt . Name == model . Name && dt . Code == model . Code
6063 && ( ( ( model . CustomTypeId ?? 0 ) != 0 && ( dt . CustomTypeId ?? 0 ) != 0 && dt . CustomTypeId == model . CustomTypeId )
6164 || ( model . CustomType != null &&
6265 dt . CustomType . Profile . Namespace == model . CustomType . Profile . Namespace
6366 && dt . CustomType . Profile . PublishDate == model . CustomType . Profile . PublishDate
6467 && dt . CustomType . Profile . Version == model . CustomType . Profile . Version
6568 && dt . CustomType . OpcNodeId == model . CustomType . OpcNodeId
66- ) ) ) )
67- , cacheOnly ) . ToList ( ) ;
69+ ) ) ) ) &&
70+ ( dt . CustomType == null || ! dt . CustomType . OwnerId . HasValue || dt . CustomType . OwnerId . Value == userToken . UserId )
71+ , cacheOnly ) ;
6872
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 ] ;
73+ var result = matches ? . FirstOrDefault ( ) ;
74+ return result ;
7875 }
7976
8077 public override async Task < int ? > UpdateAsync ( LookupDataTypeModel model , UserToken userToken )
0 commit comments