@@ -53,28 +53,25 @@ ProfileTypeDefinitionDAL _profileTypeDefinitionDAL
53
53
}
54
54
public override LookupDataType CheckForExisting ( LookupDataTypeModel model , UserToken userToken , bool cacheOnly = false )
55
55
{
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.
56
60
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 )
59
62
|| ( dt . Name == model . Name && dt . Code == model . Code
60
63
&& ( ( ( model . CustomTypeId ?? 0 ) != 0 && ( dt . CustomTypeId ?? 0 ) != 0 && dt . CustomTypeId == model . CustomTypeId )
61
64
|| ( model . CustomType != null &&
62
65
dt . CustomType . Profile . Namespace == model . CustomType . Profile . Namespace
63
66
&& dt . CustomType . Profile . PublishDate == model . CustomType . Profile . PublishDate
64
67
&& dt . CustomType . Profile . Version == model . CustomType . Profile . Version
65
68
&& 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 ) ;
68
72
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 ;
78
75
}
79
76
80
77
public override async Task < int ? > UpdateAsync ( LookupDataTypeModel model , UserToken userToken )
0 commit comments