This repository was archived by the owner on Aug 4, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
src/Lithnet.Laps.Web/Lithnet.Laps.Web/Controllers Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -140,7 +140,7 @@ private TargetElement GetMatchingTargetOrNull(ComputerPrincipal computer)
140
140
{
141
141
List < TargetElement > matchingTargets = new List < TargetElement > ( ) ;
142
142
143
- foreach ( TargetElement target in LapsConfigSection . Configuration . Targets . OfType < TargetElement > ( ) . OrderBy ( t => t . Type == TargetType . Computer ) . ThenBy ( t => t . Type == TargetType . Group ) )
143
+ foreach ( TargetElement target in LapsConfigSection . Configuration . Targets . OfType < TargetElement > ( ) )
144
144
{
145
145
if ( target . Type == TargetType . Container )
146
146
{
@@ -186,7 +186,10 @@ private TargetElement GetMatchingTargetOrNull(ComputerPrincipal computer)
186
186
}
187
187
}
188
188
189
- return matchingTargets . OrderBy ( t => t . Type == TargetType . Computer ) . ThenBy ( t => t . Type == TargetType . Group ) . FirstOrDefault ( ) ;
189
+ return
190
+ matchingTargets . FirstOrDefault ( t => t . Type == TargetType . Computer ) ??
191
+ matchingTargets . FirstOrDefault ( t => t . Type == TargetType . Group ) ??
192
+ matchingTargets . FirstOrDefault ( ) ;
190
193
}
191
194
192
195
private bool IsReaderAuthorized ( ReaderElement reader , UserPrincipal currentUser )
You can’t perform that action at this time.
0 commit comments