Skip to content

Commit

Permalink
orElse limit
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasCAI-mlv authored and loicgreffier committed Aug 9, 2024
1 parent adf0587 commit 3904203
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 3904203

Please sign in to comment.