Does this example in "user guide" actually work? -- solved

https://docs.gradle.org/current/userguide/init_scripts.html#sec:init_script_plugins

I made my own init.gradle script and need the same functionality - define global repositories and to deny adding the third party repositories.

When I add the in-house repository, it does not get added - dependencies do not get found.

So does this do the same?

apply plugin:EnterpriseRepositoryPlugin

class EnterpriseRepositoryPlugin implements Plugin<Gradle> {
    void apply(Gradle gradle) {
        gradle.allprojects{ project ->
            project.repositories {
                // the enterprise repository
                maven {
                    url "http://url"
                }
            }
        }
    }
}

As this code in init.gradle:

allprojects {
    repositories {
        maven { url "http://url" }
    }
}

EDIT: apparently it works now