Skip to content

Commit

Permalink
orElse limit
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasCAI-mlv committed Aug 5, 2024
1 parent 39c391a commit a213599
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,8 @@ public class AclController extends NamespacedResourceController {
@Get("{?limit}")
public List<AccessControlEntry> list(String namespace, Optional<AclLimit> limit,
@QueryValue(defaultValue = "*") String name) {
if (limit.isEmpty()) {
limit = Optional.of(AclLimit.ALL);
}

Namespace ns = getNamespace(namespace);
return switch (limit.get()) {
return switch (limit.orElse(AclLimit.ALL)) {
case GRANTEE -> aclService.findByWildcardNameGrantedToNamespace(ns, name)
.stream()
.sorted(Comparator.comparing((AccessControlEntry acl) -> acl.getMetadata().getNamespace()))
Expand Down

0 comments on commit a213599

Please sign in to comment.