Repository: kestra-io/kestra
File: core/src/main/java/io/kestra/core/runners/AclChecker.java (Java)

Code before:
package io.kestra.core.runners;

import io.kestra.core.services.FlowService;

import java.util.List;
import java.util.Objects;

public interface AclChecker {

    void checkAllowAllNamespace();

    void checkAllowNamespace(String namespace);

    void checkAllowNamespaces(List<String> namespaces);

    void checkAllowResources(AllowedResources allowedResources);

    interface AllowedResources {
        void checkAllowed(RunContext.FlowInfo flowInfo);
    }

    class AllowAllNamespace implements AllowedResources {
        private final FlowService flowService;

        AllowAllNamespace(FlowService flowService) {
            this.flowService = Objects.requireNonNull(flowService);
        }

        @Override
        public void checkAllowed(RunContext.FlowInfo flowInfo) {
            this.flowService.checkAllowedAllNamespaces(flowInfo.tenantId(), flowInfo.tenantId(), flowInfo.namespace());
        }
    }

    class AllowNamespaces implements AllowedResources {
        private final FlowService flowService;
        private final List<String> namespaces;


Review comment (suggestion):
I'm not very fan of the current interface. I think we could provide something more user-friendly with a nice DSL something like: 

```java
public interface AclChecker {

    AllowedResources allowNamespace(String namespace);
    AllowedResources allowNamespaces(List<String> namespaces);
    AllowedResources allowAllNamespaces();

    interface AllowedResources {
        void check();
   }
   
   //...
```

This will allow us to have:

* `runContext.acl().allowNamespace("my-ns").check()`
* `runContext.acl().allowNamespaces(List.of("ns1", "ns2")).check()`
* `runContext.acl().allowAllNamespaces().check()`

Then, in your `AclCheckerImpl` class

```java
    @Override
    public AllowedResources allowNamespace(String namespace) {
        return new AllowNamespace(runContext.flowInfo(), flowService, namespace);  // RunContext or FlowInfo must be injected the AclCheckerImpl constructror
    }
```

Code after:
package io.kestra.core.runners;

import java.util.List;

/**
 * Check if the current taskrun has access to the requested resources.
 *
 * <p>
 * IMPORTANT: remember to call the <code>check()</code> method to check the ACL.
 *
 * @see AllowedResources
 */
public interface AclChecker {

    /**Tasks that need to access resources outside their namespace should use this interface to check ACL (Allowed namespaces in EE).
     * Allow all namespaces.
     * <p>
     * IMPORTANT: remember to call the <code>check()</code> method to check the ACL.
     */
    AllowedResources allowAllNamespaces();

    /**
     * Allow only the given namespace.
     * <p>
     * IMPORTANT: remember to call the <code>check()</code> method to check the ACL.
     */
    AllowedResources allowNamespace(String namespace);

    /**
     * Allow only the given namespaces.
     * <p>
     * IMPORTANT: remember to call the <code>check()</code> method to check the ACL.
     */
    AllowedResources allowNamespaces(List<String> namespaces);

    /**
     * Represents a set of allowed resources.
     * Tasks that need to access resources outside their namespace should call the <code>check()</code> method to check the ACL (Allowed namespaces in EE).