@Override
    public Result apply(String action, Class<? extends Validatable> aClass, String resource, String resourceToOperateWithin) {
        if (matchesAction(action) && matchesType(aClass) && matchesResource(resource)) {
            return Result.ALLOW;
        }

        if (isRequestForElasticAgentProfiles(aClass) && matchesAction(action) && matchesResource(resourceToOperateWithin)) {
            return Result.ALLOW;
        }

        return Result.SKIP;
    }
@Test
    void forAdministerOfAllClusterProfiles() {
        Allow directive = new Allow("administer", "cluster_profile", "*");

        Result viewAllElasticAgentProfiles = directive.apply("view", ElasticProfile.class, "*", null);
        Result viewAllClusterProfiles = directive.apply("view", ClusterProfile.class, "*", null);
        Result administerAllElasticAgentProfiles = directive.apply("administer", ElasticProfile.class, "*", null);
        Result administerAllClusterProfiles = directive.apply("administer", ClusterProfile.class, "*", null);

        assertThat(viewAllElasticAgentProfiles).isEqualTo(Result.ALLOW);
        assertThat(viewAllClusterProfiles).isEqualTo(Result.ALLOW);
        assertThat(administerAllElasticAgentProfiles).isEqualTo(Result.ALLOW);
        assertThat(administerAllClusterProfiles).isEqualTo(Result.ALLOW);
    }