Skip to content

Commit 204e702

Browse files
committed
[r] to LINQ
1 parent 37e08b0 commit 204e702

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Collections.Generic;
2+
using System.Linq;
23
using System.Security.Claims;
34
using Simplify.Web.Controllers.Meta;
45

@@ -11,10 +12,9 @@ public SecurityStatus CheckSecurityRules(IControllerMetadata metaData, ClaimsPri
1112
if (metaData.Security is not { IsAuthorizationRequired: true })
1213
return SecurityStatus.Ok;
1314

14-
foreach (var check in checks)
15-
if (check.IsViolated(metaData.Security, user))
16-
return check.ViolationStatus;
17-
18-
return SecurityStatus.Ok;
15+
return (from check in checks
16+
where check.IsViolated(metaData.Security, user)
17+
select check.ViolationStatus)
18+
.FirstOrDefault();
1919
}
2020
}

0 commit comments

Comments
 (0)